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 = @"^\[(?:[^*.,]+|([^*.,]+(,[^,]+)+))\]$";
|
||||
|
||||
#if NETSTANDARD2_0
|
||||
private static readonly Regex _patternsRegex = new (PatternsRegexString);
|
||||
#endif
|
||||
|
||||
#if NET8_0
|
||||
#if NET8_0_OR_GREATER
|
||||
[GeneratedRegex(PatternsRegexString)]
|
||||
private static partial Regex GetPatternsRegex();
|
||||
#else
|
||||
private static readonly Regex _patternsRegex = new (PatternsRegexString);
|
||||
#endif
|
||||
|
||||
public const string PART_Button = "PART_Button";
|
||||
@@ -237,12 +235,11 @@ public partial class PathPicker : TemplatedControl
|
||||
if (string.IsNullOrWhiteSpace(str))
|
||||
return null;
|
||||
|
||||
#if NETSTANDARD2_0
|
||||
if (!_patternsRegex.IsMatch(str))
|
||||
#endif
|
||||
|
||||
#if NET8_0
|
||||
#if NET8_0_OR_GREATER
|
||||
if (!GetPatternsRegex().IsMatch(str))
|
||||
#else
|
||||
if (!_patternsRegex.IsMatch(str))
|
||||
#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]");
|
||||
|
||||
|
||||
@@ -9,11 +9,9 @@ public class DrawerCloseTestPopupControlVM : IDialogContext
|
||||
RequestClose?.Invoke(this, Result);
|
||||
}
|
||||
|
||||
#if NET8_0
|
||||
#if NET8_0_OR_GREATER
|
||||
public int Result { get; } = Random.Shared.Next();
|
||||
#endif
|
||||
|
||||
#if NETSTANDARD2_0
|
||||
#else
|
||||
private static Random r = new Random();
|
||||
public int Result { get; } = r.Next();
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user