mirror of
https://github.com/2dust/v2rayN.git
synced 2026-03-22 00:08:16 +05:00
Code cleanup: pattern matching and minor fixes
This commit is contained in:
@@ -95,7 +95,7 @@ public class Global
|
||||
|
||||
public const string PolicyGroupDefaultAllFilter = $"^(?!.*(?:{PolicyGroupExcludeKeywords})).*$";
|
||||
|
||||
public static readonly List<string> PolicyGroupDefaultFilterList =
|
||||
public static readonly List<string> PolicyGroupDefaultFilterList =
|
||||
[
|
||||
// All nodes (exclude traffic/expiry info)
|
||||
PolicyGroupDefaultAllFilter,
|
||||
|
||||
@@ -81,7 +81,9 @@ public class NodeValidator
|
||||
{
|
||||
var transportError = ValidateSingboxTransport(item.ConfigType, net);
|
||||
if (transportError != null)
|
||||
{
|
||||
v.Error(transportError);
|
||||
}
|
||||
|
||||
if (!Global.SingboxSupportConfigType.Contains(item.ConfigType))
|
||||
{
|
||||
|
||||
@@ -1040,8 +1040,8 @@ public static class ConfigHandler
|
||||
|
||||
if (profileItem.StreamSecurity.IsNotEmpty())
|
||||
{
|
||||
if (profileItem.StreamSecurity != Global.StreamSecurity
|
||||
&& profileItem.StreamSecurity != Global.StreamSecurityReality)
|
||||
if (profileItem.StreamSecurity is not Global.StreamSecurity
|
||||
and not Global.StreamSecurityReality)
|
||||
{
|
||||
profileItem.StreamSecurity = string.Empty;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,6 @@ public class ServerTestItem
|
||||
public EConfigType ConfigType { get; set; }
|
||||
public bool AllowTest { get; set; }
|
||||
public int QueueNum { get; set; }
|
||||
public required ProfileItem Profile { get; set; }
|
||||
public ProfileItem Profile { get; set; }
|
||||
public ECoreType CoreType { get; set; }
|
||||
}
|
||||
|
||||
@@ -243,7 +243,6 @@ public partial class CoreConfigSingboxService
|
||||
if (Utils.IsIpv6(predefined))
|
||||
{
|
||||
rule.answer = new List<string> { $"*. IN AAAA {predefined}" };
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -8,9 +8,9 @@ public partial class ClashConnectionsView : ReactiveUserControl<ClashConnections
|
||||
public ClashConnectionsView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
_config = AppManager.Instance.Config;
|
||||
|
||||
|
||||
ViewModel = new ClashConnectionsViewModel(UpdateViewHandler);
|
||||
btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click;
|
||||
|
||||
@@ -65,7 +65,7 @@ public partial class ClashConnectionsView : ReactiveUserControl<ClashConnections
|
||||
{
|
||||
ViewModel?.ClashConnectionClose(false);
|
||||
}
|
||||
|
||||
|
||||
#region UI
|
||||
|
||||
private void RestoreUI()
|
||||
|
||||
@@ -97,8 +97,7 @@ public partial class ProfilesSelectWindow
|
||||
|
||||
private void LstProfiles_ColumnHeader_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var colHeader = sender as DataGridColumnHeader;
|
||||
if (colHeader == null || colHeader.TabIndex < 0 || colHeader.Column == null)
|
||||
if (sender is not DataGridColumnHeader colHeader || colHeader.TabIndex < 0 || colHeader.Column == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -233,8 +233,7 @@ public partial class ProfilesView
|
||||
|
||||
private void LstProfiles_ColumnHeader_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var colHeader = sender as DataGridColumnHeader;
|
||||
if (colHeader == null || colHeader.TabIndex < 0 || colHeader.Column == null)
|
||||
if (sender is not DataGridColumnHeader colHeader || colHeader.TabIndex < 0 || colHeader.Column == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user