fix: update conditional compilation symbols for .NET version handling (#820)
This commit is contained in:
@@ -20,13 +20,11 @@ public partial class PathPicker : TemplatedControl
|
|||||||
{
|
{
|
||||||
private const string PatternsRegexString = @"^\[(?:[^*.,]+|([^*.,]+(,[^,]+)+))\]$";
|
private const string PatternsRegexString = @"^\[(?:[^*.,]+|([^*.,]+(,[^,]+)+))\]$";
|
||||||
|
|
||||||
#if NETSTANDARD2_0
|
#if NET8_0_OR_GREATER
|
||||||
private static readonly Regex _patternsRegex = new (PatternsRegexString);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if NET8_0
|
|
||||||
[GeneratedRegex(PatternsRegexString)]
|
[GeneratedRegex(PatternsRegexString)]
|
||||||
private static partial Regex GetPatternsRegex();
|
private static partial Regex GetPatternsRegex();
|
||||||
|
#else
|
||||||
|
private static readonly Regex _patternsRegex = new (PatternsRegexString);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public const string PART_Button = "PART_Button";
|
public const string PART_Button = "PART_Button";
|
||||||
@@ -237,12 +235,11 @@ public partial class PathPicker : TemplatedControl
|
|||||||
if (string.IsNullOrWhiteSpace(str))
|
if (string.IsNullOrWhiteSpace(str))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
#if NETSTANDARD2_0
|
|
||||||
if (!_patternsRegex.IsMatch(str))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if NET8_0
|
#if NET8_0_OR_GREATER
|
||||||
if (!GetPatternsRegex().IsMatch(str))
|
if (!GetPatternsRegex().IsMatch(str))
|
||||||
|
#else
|
||||||
|
if (!_patternsRegex.IsMatch(str))
|
||||||
#endif
|
#endif
|
||||||
throw new ArgumentException($"{nameof(str)} Invalid parameter, please refer to the following content: [Name, Pattern], such as [123, .exe, .pdb] or [All][ImageAll][11, *.txt]");
|
throw new ArgumentException($"{nameof(str)} Invalid parameter, please refer to the following content: [Name, Pattern], such as [123, .exe, .pdb] or [All][ImageAll][11, *.txt]");
|
||||||
|
|
||||||
|
|||||||
@@ -9,11 +9,9 @@ public class DrawerCloseTestPopupControlVM : IDialogContext
|
|||||||
RequestClose?.Invoke(this, Result);
|
RequestClose?.Invoke(this, Result);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if NET8_0
|
#if NET8_0_OR_GREATER
|
||||||
public int Result { get; } = Random.Shared.Next();
|
public int Result { get; } = Random.Shared.Next();
|
||||||
#endif
|
#else
|
||||||
|
|
||||||
#if NETSTANDARD2_0
|
|
||||||
private static Random r = new Random();
|
private static Random r = new Random();
|
||||||
public int Result { get; } = r.Next();
|
public int Result { get; } = r.Next();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user