From 386c86bfa685605bf3214d4f79842dcc4e88beca Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Sun, 10 Aug 2025 20:12:57 +0800 Subject: [PATCH] Code clean --- v2rayN/ServiceLib/Handler/ConfigHandler.cs | 6 +-- v2rayN/ServiceLib/Handler/Fmt/AnytlsFmt.cs | 3 +- v2rayN/ServiceLib/Models/SingboxConfig.cs | 3 ++ .../CoreConfig/CoreConfigSingboxService.cs | 5 -- .../Views/DNSSettingWindow.axaml | 19 ++++---- v2rayN/v2rayN/Views/ClashConnectionsView.xaml | 6 +-- v2rayN/v2rayN/Views/ClashProxiesView.xaml | 8 ++-- v2rayN/v2rayN/Views/DNSSettingWindow.xaml | 47 +++++++++---------- v2rayN/v2rayN/Views/StatusBarView.xaml | 9 ++-- 9 files changed, 50 insertions(+), 56 deletions(-) diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs index 998c2427..dd20974f 100644 --- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs @@ -2106,7 +2106,7 @@ public class ConfigHandler public static async Task InitBuiltinDNS(Config config) { var items = await AppHandler.Instance.DNSItems(); - + // Check existing DNS items and disable those with empty NormalDNS var needsUpdate = false; foreach (var existingItem in items) @@ -2117,13 +2117,13 @@ public class ConfigHandler needsUpdate = true; } } - + // Update items if any changes were made if (needsUpdate) { await SQLiteHelper.Instance.UpdateAllAsync(items); } - + if (items.Count <= 0) { var item = new DNSItem() diff --git a/v2rayN/ServiceLib/Handler/Fmt/AnytlsFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/AnytlsFmt.cs index 3f1d40dc..f175ce82 100644 --- a/v2rayN/ServiceLib/Handler/Fmt/AnytlsFmt.cs +++ b/v2rayN/ServiceLib/Handler/Fmt/AnytlsFmt.cs @@ -1,6 +1,5 @@ -using static QRCoder.PayloadGenerator; - namespace ServiceLib.Handler.Fmt; + public class AnytlsFmt : BaseFmt { public static ProfileItem? Resolve(string str, out string msg) diff --git a/v2rayN/ServiceLib/Models/SingboxConfig.cs b/v2rayN/ServiceLib/Models/SingboxConfig.cs index 30478174..a5eec4ae 100644 --- a/v2rayN/ServiceLib/Models/SingboxConfig.cs +++ b/v2rayN/ServiceLib/Models/SingboxConfig.cs @@ -240,10 +240,13 @@ public class Server4Sbox : BaseServer4Sbox public int? server_port { get; set; } public string? path { get; set; } public Headers4Sbox? headers { get; set; } + // public List? path { get; set; } // hosts public Dictionary>? predefined { get; set; } + // Deprecated public string? address { get; set; } + public string? address_resolver { get; set; } public string? address_strategy { get; set; } public string? strategy { get; set; } diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs index b26f6336..6ea20a20 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs @@ -1,11 +1,6 @@ -using System.Collections.Generic; using System.Data; using System.Net; using System.Net.NetworkInformation; -using System.Reactive; -using System.Text; -using DynamicData; -using ServiceLib.Models; namespace ServiceLib.Services.CoreConfig; diff --git a/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml b/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml index 23ebe9fb..9ec377ff 100644 --- a/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml @@ -39,7 +39,7 @@ @@ -50,7 +50,7 @@ Margin="{StaticResource Margin4}" VerticalAlignment="Center" Text="{x:Static resx:ResUI.TbCustomDNSEnabledPageInvalid}" /> - + @@ -284,13 +284,14 @@ Grid.ColumnSpan="3" Margin="{StaticResource Margin4}" VerticalAlignment="Stretch" - Watermark="{x:Static resx:ResUI.TbDNSHostsConfig}" BorderThickness="1" Classes="TextArea" - TextWrapping="Wrap" /> + TextWrapping="Wrap" + Watermark="{x:Static resx:ResUI.TbDNSHostsConfig}" /> + @@ -298,7 +299,7 @@ - + - + - + - + diff --git a/v2rayN/v2rayN/Views/ClashConnectionsView.xaml b/v2rayN/v2rayN/Views/ClashConnectionsView.xaml index 35a93411..0e6ba6a7 100644 --- a/v2rayN/v2rayN/Views/ClashConnectionsView.xaml +++ b/v2rayN/v2rayN/Views/ClashConnectionsView.xaml @@ -1,11 +1,11 @@ - - + + Margin="{StaticResource Margin8}" + VerticalAlignment="Center" + Style="{StaticResource ToolbarTextBlock}" + Text="{x:Static resx:ResUI.TbCustomDNSEnable}" /> + x:Name="togRayCustomDNSEnableCompatible" + Margin="{StaticResource Margin8}" + HorizontalAlignment="Left" /> - + - + + Margin="{StaticResource Margin8}" + VerticalAlignment="Center" + Style="{StaticResource ToolbarTextBlock}" + Text="{x:Static resx:ResUI.TbCustomDNSEnable}" /> + x:Name="togSBCustomDNSEnableCompatible" + Margin="{StaticResource Margin8}" + HorizontalAlignment="Left" /> - + - + Style="{StaticResource MaterialDesignFloatingHintComboBox}" /> @@ -185,8 +184,7 @@ AutomationProperties.Name="{x:Static resx:ResUI.menuRouting}" DisplayMemberPath="Remarks" FontSize="{DynamicResource StdFontSize}" - Style="{StaticResource MaterialDesignFilledComboBox}"> - + Style="{StaticResource MaterialDesignFilledComboBox}" /> @@ -200,8 +198,7 @@ AutomationProperties.Name="{x:Static resx:ResUI.menuServers}" DisplayMemberPath="Text" FontSize="{DynamicResource StdFontSize}" - Style="{StaticResource MaterialDesignFilledComboBox}"> - + Style="{StaticResource MaterialDesignFilledComboBox}" />