diff --git a/v2rayN/v2rayN/App.xaml.cs b/v2rayN/v2rayN/App.xaml.cs index 406cd3ac71..73467ee344 100644 --- a/v2rayN/v2rayN/App.xaml.cs +++ b/v2rayN/v2rayN/App.xaml.cs @@ -59,6 +59,7 @@ private void Init() Environment.Exit(0); return; } + LazyConfig.Instance.SetConfig(_config); //Under Win10 if (Environment.OSVersion.Version.Major < 10) diff --git a/v2rayN/v2rayN/Converters/MaterialDesignFonts.cs b/v2rayN/v2rayN/Converters/MaterialDesignFonts.cs index 5ce0328668..0e8fac70c6 100644 --- a/v2rayN/v2rayN/Converters/MaterialDesignFonts.cs +++ b/v2rayN/v2rayN/Converters/MaterialDesignFonts.cs @@ -11,7 +11,7 @@ static MaterialDesignFonts() { try { - var fontFamily = LazyConfig.Instance.GetConfig().uiItem.currentFontFamily; + var fontFamily = LazyConfig.Instance.Config.uiItem.currentFontFamily; if (!Utils.IsNullOrEmpty(fontFamily)) { var fontPath = Utils.GetFontsPath(); diff --git a/v2rayN/v2rayN/Handler/ClashApiHandler.cs b/v2rayN/v2rayN/Handler/ClashApiHandler.cs index 1e04bf1e0a..bc2daa769e 100644 --- a/v2rayN/v2rayN/Handler/ClashApiHandler.cs +++ b/v2rayN/v2rayN/Handler/ClashApiHandler.cs @@ -87,7 +87,7 @@ public void ClashProxiesDelayTest(bool blAll, List lstProxy, Ac return; } var urlBase = $"{GetApiUrl()}/proxies"; - urlBase += @"/{0}/delay?timeout=10000&url=" + LazyConfig.Instance.GetConfig().speedTestItem.speedPingTestUrl; + urlBase += @"/{0}/delay?timeout=10000&url=" + LazyConfig.Instance.Config.speedTestItem.speedPingTestUrl; List tasks = new List(); foreach (var it in lstProxy) diff --git a/v2rayN/v2rayN/Handler/ConfigHandler.cs b/v2rayN/v2rayN/Handler/ConfigHandler.cs index 3fda6adf11..09c45c32ba 100644 --- a/v2rayN/v2rayN/Handler/ConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/ConfigHandler.cs @@ -206,7 +206,6 @@ public static int LoadConfig(ref Config? config) }; } - LazyConfig.Instance.SetConfig(config); return 0; } diff --git a/v2rayN/v2rayN/Handler/CoreConfig/CoreConfigHandler.cs b/v2rayN/v2rayN/Handler/CoreConfig/CoreConfigHandler.cs index b1b810ddc7..b8aa4b4092 100644 --- a/v2rayN/v2rayN/Handler/CoreConfig/CoreConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/CoreConfig/CoreConfigHandler.cs @@ -20,7 +20,7 @@ public static int GenerateClientConfig(ProfileItem node, string? fileName, out s msg = ResUI.CheckServerSettings; return -1; } - var config = LazyConfig.Instance.GetConfig(); + var config = LazyConfig.Instance.Config; msg = ResUI.InitialConfiguration; if (node.configType == EConfigType.Custom) diff --git a/v2rayN/v2rayN/Handler/DownloadHandler.cs b/v2rayN/v2rayN/Handler/DownloadHandler.cs index c6ead790ad..99ba06a6b9 100644 --- a/v2rayN/v2rayN/Handler/DownloadHandler.cs +++ b/v2rayN/v2rayN/Handler/DownloadHandler.cs @@ -34,7 +34,7 @@ public async Task DownloadDataAsync(string url, WebProxy webProxy, int down { try { - Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().guiItem.enableSecurityProtocolTls13); + Utils.SetSecurityProtocol(LazyConfig.Instance.Config.guiItem.enableSecurityProtocolTls13); var progress = new Progress(); progress.ProgressChanged += (sender, value) => @@ -66,7 +66,7 @@ public async Task DownloadFileAsync(string url, bool blProxy, int downloadTimeou { try { - Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().guiItem.enableSecurityProtocolTls13); + Utils.SetSecurityProtocol(LazyConfig.Instance.Config.guiItem.enableSecurityProtocolTls13); UpdateCompleted?.Invoke(this, new ResultEventArgs(false, $"{ResUI.Downloading} {url}")); var progress = new Progress(); @@ -96,7 +96,7 @@ await DownloaderHelper.Instance.DownloadFileAsync(webProxy, public async Task UrlRedirectAsync(string url, bool blProxy) { - Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().guiItem.enableSecurityProtocolTls13); + Utils.SetSecurityProtocol(LazyConfig.Instance.Config.guiItem.enableSecurityProtocolTls13); var webRequestHandler = new SocketsHttpHandler { AllowAutoRedirect = false, @@ -185,7 +185,7 @@ await DownloaderHelper.Instance.DownloadFileAsync(webProxy, { try { - Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().guiItem.enableSecurityProtocolTls13); + Utils.SetSecurityProtocol(LazyConfig.Instance.Config.guiItem.enableSecurityProtocolTls13); var webProxy = GetWebProxy(blProxy); var client = new HttpClient(new SocketsHttpHandler() { @@ -230,7 +230,7 @@ await DownloaderHelper.Instance.DownloadFileAsync(webProxy, { try { - Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().guiItem.enableSecurityProtocolTls13); + Utils.SetSecurityProtocol(LazyConfig.Instance.Config.guiItem.enableSecurityProtocolTls13); var webProxy = GetWebProxy(blProxy); @@ -264,7 +264,7 @@ public async Task RunAvailabilityCheck(IWebProxy? webProxy) try { - var config = LazyConfig.Instance.GetConfig(); + var config = LazyConfig.Instance.Config; int responseTime = await GetRealPingTime(config.speedTestItem.speedPingTestUrl, webProxy, 10); return responseTime; } diff --git a/v2rayN/v2rayN/Handler/HotkeyHandler.cs b/v2rayN/v2rayN/Handler/HotkeyHandler.cs index d91cddeb95..4dbe2ba448 100644 --- a/v2rayN/v2rayN/Handler/HotkeyHandler.cs +++ b/v2rayN/v2rayN/Handler/HotkeyHandler.cs @@ -19,7 +19,7 @@ public sealed class HotkeyHandler private Config _config { - get => LazyConfig.Instance.GetConfig(); + get => LazyConfig.Instance.Config; } private Dictionary> _hotkeyTriggerDic; diff --git a/v2rayN/v2rayN/Handler/LazyConfig.cs b/v2rayN/v2rayN/Handler/LazyConfig.cs index 7224c5322c..62f4529889 100644 --- a/v2rayN/v2rayN/Handler/LazyConfig.cs +++ b/v2rayN/v2rayN/Handler/LazyConfig.cs @@ -7,12 +7,12 @@ public sealed class LazyConfig { private static readonly Lazy _instance = new(() => new()); private Config _config; - - public static LazyConfig Instance => _instance.Value; - private int? _statePort; private int? _statePort2; + public static LazyConfig Instance => _instance.Value; + public Config Config => _config; + public int StatePort { get @@ -45,15 +45,7 @@ public LazyConfig() #region Config - public void SetConfig(Config config) - { - _config = config; - } - - public Config GetConfig() - { - return _config; - } + public void SetConfig(Config config) => _config = config; public int GetLocalPort(EInboundProtocol protocol) { diff --git a/v2rayN/v2rayN/Handler/UpdateHandler.cs b/v2rayN/v2rayN/Handler/UpdateHandler.cs index a2576bf875..4f2e1be6c8 100644 --- a/v2rayN/v2rayN/Handler/UpdateHandler.cs +++ b/v2rayN/v2rayN/Handler/UpdateHandler.cs @@ -548,7 +548,7 @@ private async Task AskToDownload(DownloadHandler downloadHandle, string url, boo //} //if (blDownload) //{ - await downloadHandle.DownloadFileAsync(url, true, 600); + await downloadHandle.DownloadFileAsync(url, true, 600); //} } diff --git a/v2rayN/v2rayN/ViewModels/AddServer2ViewModel.cs b/v2rayN/v2rayN/ViewModels/AddServer2ViewModel.cs index 449f3bfe85..aa70027ef1 100644 --- a/v2rayN/v2rayN/ViewModels/AddServer2ViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/AddServer2ViewModel.cs @@ -24,7 +24,7 @@ public class AddServer2ViewModel : MyReactiveObject public AddServer2ViewModel(ProfileItem profileItem, Func? updateView) { _noticeHandler = Locator.Current.GetService(); - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _updateView = updateView; if (profileItem.indexId.IsNullOrEmpty()) diff --git a/v2rayN/v2rayN/ViewModels/AddServerViewModel.cs b/v2rayN/v2rayN/ViewModels/AddServerViewModel.cs index 9987f0980c..bb9f4f0e87 100644 --- a/v2rayN/v2rayN/ViewModels/AddServerViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/AddServerViewModel.cs @@ -19,7 +19,7 @@ public class AddServerViewModel : MyReactiveObject public AddServerViewModel(ProfileItem profileItem, Func? updateView) { - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _noticeHandler = Locator.Current.GetService(); _updateView = updateView; diff --git a/v2rayN/v2rayN/ViewModels/ClashConnectionsViewModel.cs b/v2rayN/v2rayN/ViewModels/ClashConnectionsViewModel.cs index e93f9e167e..43de0b5c94 100644 --- a/v2rayN/v2rayN/ViewModels/ClashConnectionsViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/ClashConnectionsViewModel.cs @@ -31,7 +31,7 @@ public class ClashConnectionsViewModel : MyReactiveObject public ClashConnectionsViewModel(Func? updateView) { - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _updateView = updateView; SortingSelected = _config.clashUIItem.connectionsSorting; AutoRefresh = _config.clashUIItem.connectionsAutoRefresh; diff --git a/v2rayN/v2rayN/ViewModels/ClashProxiesViewModel.cs b/v2rayN/v2rayN/ViewModels/ClashProxiesViewModel.cs index 97c04f8c82..7bb2d92c72 100644 --- a/v2rayN/v2rayN/ViewModels/ClashProxiesViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/ClashProxiesViewModel.cs @@ -50,7 +50,7 @@ public class ClashProxiesViewModel : MyReactiveObject public ClashProxiesViewModel(Func? updateView) { _noticeHandler = Locator.Current.GetService(); - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _updateView = updateView; SelectedGroup = new(); diff --git a/v2rayN/v2rayN/ViewModels/DNSSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/DNSSettingViewModel.cs index 48351d2309..ea3ce40dba 100644 --- a/v2rayN/v2rayN/ViewModels/DNSSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/DNSSettingViewModel.cs @@ -28,7 +28,7 @@ public class DNSSettingViewModel : MyReactiveObject public DNSSettingViewModel(Func? updateView) { - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _noticeHandler = Locator.Current.GetService(); _updateView = updateView; diff --git a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs index d15388c8e2..22cd0d44bc 100644 --- a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs @@ -159,7 +159,7 @@ public class MainWindowViewModel : MyReactiveObject public MainWindowViewModel(Func? updateView) { - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _noticeHandler = Locator.Current.GetService(); _updateView = updateView; diff --git a/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs index ffb35a7d95..286ef3aa25 100644 --- a/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs @@ -107,7 +107,7 @@ public class OptionSettingViewModel : MyReactiveObject public OptionSettingViewModel(Func? updateView) { - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _noticeHandler = Locator.Current.GetService(); _updateView = updateView; @@ -301,7 +301,7 @@ private void SaveSetting() _config.hysteriaItem.up_mbps = hyUpMbps; _config.hysteriaItem.down_mbps = hyDownMbps; _config.coreBasicItem.enableFragment = enableFragment; - + _config.guiItem.autoRun = AutoRun; _config.guiItem.enableStatistics = EnableStatistics; _config.guiItem.keepOlderDedupl = KeepOlderDedupl; diff --git a/v2rayN/v2rayN/ViewModels/ProfilesViewModel.cs b/v2rayN/v2rayN/ViewModels/ProfilesViewModel.cs index 4681c91aea..6cc41d1e4e 100644 --- a/v2rayN/v2rayN/ViewModels/ProfilesViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/ProfilesViewModel.cs @@ -101,7 +101,7 @@ public class ProfilesViewModel : MyReactiveObject public ProfilesViewModel(Func? updateView) { - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _noticeHandler = Locator.Current.GetService(); _updateView = updateView; diff --git a/v2rayN/v2rayN/ViewModels/RoutingRuleDetailsViewModel.cs b/v2rayN/v2rayN/ViewModels/RoutingRuleDetailsViewModel.cs index 8a0491141b..087a95462b 100644 --- a/v2rayN/v2rayN/ViewModels/RoutingRuleDetailsViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/RoutingRuleDetailsViewModel.cs @@ -34,7 +34,7 @@ public class RoutingRuleDetailsViewModel : MyReactiveObject public RoutingRuleDetailsViewModel(RulesItem rulesItem, Func? updateView) { - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _noticeHandler = Locator.Current.GetService(); _updateView = updateView; diff --git a/v2rayN/v2rayN/ViewModels/RoutingRuleSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/RoutingRuleSettingViewModel.cs index e3f6b9f717..2468a85420 100644 --- a/v2rayN/v2rayN/ViewModels/RoutingRuleSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/RoutingRuleSettingViewModel.cs @@ -41,7 +41,7 @@ public class RoutingRuleSettingViewModel : MyReactiveObject public RoutingRuleSettingViewModel(RoutingItem routingItem, Func? updateView) { - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _noticeHandler = Locator.Current.GetService(); _updateView = updateView; SelectedSource = new(); diff --git a/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs index 47c3cf8fce..30a9853e54 100644 --- a/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs @@ -72,7 +72,7 @@ public class RoutingSettingViewModel : MyReactiveObject public RoutingSettingViewModel(Func? updateView) { - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _noticeHandler = Locator.Current.GetService(); _updateView = updateView; SelectedSource = new(); diff --git a/v2rayN/v2rayN/ViewModels/SubEditViewModel.cs b/v2rayN/v2rayN/ViewModels/SubEditViewModel.cs index 825ed28ead..1f6dec866c 100644 --- a/v2rayN/v2rayN/ViewModels/SubEditViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/SubEditViewModel.cs @@ -19,7 +19,7 @@ public class SubEditViewModel : MyReactiveObject public SubEditViewModel(SubItem subItem, Func? updateView) { - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _noticeHandler = Locator.Current.GetService(); _updateView = updateView; diff --git a/v2rayN/v2rayN/ViewModels/SubSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/SubSettingViewModel.cs index 51752eabdd..e6f9b56d7a 100644 --- a/v2rayN/v2rayN/ViewModels/SubSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/SubSettingViewModel.cs @@ -30,7 +30,7 @@ public class SubSettingViewModel : MyReactiveObject public SubSettingViewModel(Func? updateView) { - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _noticeHandler = Locator.Current.GetService(); _updateView = updateView; diff --git a/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs index 8e17e499e0..ffb8cebea8 100644 --- a/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/ThemeSettingViewModel.cs @@ -38,7 +38,7 @@ public class ThemeSettingViewModel : MyReactiveObject public ThemeSettingViewModel() { - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _noticeHandler = Locator.Current.GetService(); MainFormHandler.Instance.RegisterSystemColorSet(_config, Application.Current.MainWindow, (bool bl) => { ModifyTheme(bl); }); diff --git a/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs b/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs index 4a191f4f86..c204ad9887 100644 --- a/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs +++ b/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs @@ -38,7 +38,7 @@ public AddServer2Window(ProfileItem profileItem) this.BindCommand(ViewModel, vm => vm.EditServerCmd, v => v.btnEdit).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SaveServerCmd, v => v.btnSave).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.GetConfig().uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.GetConfig().uiItem.colorModeDark); + WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.Config.uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.Config.uiItem.colorModeDark); } private bool UpdateViewHandler(EViewAction action, object? obj) diff --git a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs index 61fbe2be61..bad8e9243d 100644 --- a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs @@ -222,7 +222,7 @@ public AddServerWindow(ProfileItem profileItem) }); this.Title = $"{profileItem.configType}"; - WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.GetConfig().uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.GetConfig().uiItem.colorModeDark); + WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.Config.uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.Config.uiItem.colorModeDark); } private bool UpdateViewHandler(EViewAction action, object? obj) diff --git a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs index 48124dfbdf..e0c933f0ab 100644 --- a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs @@ -17,7 +17,7 @@ public DNSSettingWindow() InitializeComponent(); this.Owner = Application.Current.MainWindow; - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; ViewModel = new DNSSettingViewModel(UpdateViewHandler); @@ -54,7 +54,7 @@ public DNSSettingWindow() this.BindCommand(ViewModel, vm => vm.ImportDefConfig4V2rayCmd, v => v.btnImportDefConfig4V2ray).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.ImportDefConfig4SingboxCmd, v => v.btnImportDefConfig4Singbox).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.GetConfig().uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.GetConfig().uiItem.colorModeDark); + WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.Config.uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.Config.uiItem.colorModeDark); } private bool UpdateViewHandler(EViewAction action, object? obj) diff --git a/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs b/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs index b12bb6cc20..47f3056a68 100644 --- a/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs @@ -19,7 +19,7 @@ public GlobalHotkeySettingWindow() InitializeComponent(); this.Owner = Application.Current.MainWindow; - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; _config.globalHotkeys ??= new List(); txtGlobalHotkey0.KeyDown += TxtGlobalHotkey_PreviewKeyDown; diff --git a/v2rayN/v2rayN/Views/MainWindow.xaml.cs b/v2rayN/v2rayN/Views/MainWindow.xaml.cs index 109d232365..34082e9fc0 100644 --- a/v2rayN/v2rayN/Views/MainWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/MainWindow.xaml.cs @@ -25,7 +25,7 @@ public MainWindow() { InitializeComponent(); - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; App.Current.SessionEnding += Current_SessionEnding; this.Closing += MainWindow_Closing; diff --git a/v2rayN/v2rayN/Views/MsgView.xaml.cs b/v2rayN/v2rayN/Views/MsgView.xaml.cs index a8877cbe7e..baea115345 100644 --- a/v2rayN/v2rayN/Views/MsgView.xaml.cs +++ b/v2rayN/v2rayN/Views/MsgView.xaml.cs @@ -17,7 +17,7 @@ public partial class MsgView public MsgView() { InitializeComponent(); - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; MessageBus.Current.Listen(Global.CommandSendMsgView).Subscribe(x => DelegateAppendText(x)); Global.PresetMsgFilters.ForEach(it => { diff --git a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs index d44fe6f389..01800f504b 100644 --- a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs @@ -20,7 +20,7 @@ public OptionSettingWindow() InitializeComponent(); this.Owner = Application.Current.MainWindow; - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; var lstFonts = GetFonts(Utils.GetFontsPath()); ViewModel = new OptionSettingViewModel(UpdateViewHandler); @@ -169,7 +169,7 @@ public OptionSettingWindow() this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.GetConfig().uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.GetConfig().uiItem.colorModeDark); + WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.Config.uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.Config.uiItem.colorModeDark); } private bool UpdateViewHandler(EViewAction action, object? obj) diff --git a/v2rayN/v2rayN/Views/ProfilesView.xaml.cs b/v2rayN/v2rayN/Views/ProfilesView.xaml.cs index e8b4f495a4..bff475ec36 100644 --- a/v2rayN/v2rayN/Views/ProfilesView.xaml.cs +++ b/v2rayN/v2rayN/Views/ProfilesView.xaml.cs @@ -27,7 +27,7 @@ public ProfilesView() InitializeComponent(); lstGroup.MaxHeight = Math.Floor(SystemParameters.WorkArea.Height * 0.20 / 40) * 40; - _config = LazyConfig.Instance.GetConfig(); + _config = LazyConfig.Instance.Config; Application.Current.Exit += Current_Exit; btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click; diff --git a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs index 2d1a16bc63..ce643ce2b7 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs @@ -61,7 +61,7 @@ public RoutingRuleDetailsWindow(RulesItem rulesItem) this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.GetConfig().uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.GetConfig().uiItem.colorModeDark); + WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.Config.uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.Config.uiItem.colorModeDark); } private bool UpdateViewHandler(EViewAction action, object? obj) diff --git a/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs index ff6340b4dc..acd027be87 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs @@ -62,7 +62,7 @@ public RoutingRuleSettingWindow(RoutingItem routingItem) this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.GetConfig().uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.GetConfig().uiItem.colorModeDark); + WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.Config.uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.Config.uiItem.colorModeDark); } private bool UpdateViewHandler(EViewAction action, object? obj) diff --git a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs index 68560429cf..f74cdebc76 100644 --- a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs @@ -69,7 +69,7 @@ public RoutingSettingWindow() this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.GetConfig().uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.GetConfig().uiItem.colorModeDark); + WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.Config.uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.Config.uiItem.colorModeDark); } private bool UpdateViewHandler(EViewAction action, object? obj) diff --git a/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs b/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs index 4c6e7b74ef..a8fed5b018 100644 --- a/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs @@ -40,7 +40,7 @@ public SubEditWindow(SubItem subItem) this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.GetConfig().uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.GetConfig().uiItem.colorModeDark); + WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.Config.uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.Config.uiItem.colorModeDark); } private bool UpdateViewHandler(EViewAction action, object? obj) diff --git a/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs index 63836f5a14..5e1a4ac9f9 100644 --- a/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs @@ -35,7 +35,7 @@ public SubSettingWindow() this.BindCommand(ViewModel, vm => vm.SubEditCmd, v => v.menuSubEdit).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SubShareCmd, v => v.menuSubShare).DisposeWith(disposables); }); - WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.GetConfig().uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.GetConfig().uiItem.colorModeDark); + WindowsUtils.SetDarkBorder(this, LazyConfig.Instance.Config.uiItem.followSystemTheme ? !WindowsUtils.IsLightTheme() : LazyConfig.Instance.Config.uiItem.colorModeDark); } private bool UpdateViewHandler(EViewAction action, object? obj)