From b5e0be47a59d5ea46dc1333b9f517c9edcb03225 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Fri, 17 Jul 2026 09:25:13 +0800 Subject: [PATCH] Code clean --- .../ViewModels/OptionSettingViewModel.cs | 56 ++++--------------- 1 file changed, 11 insertions(+), 45 deletions(-) diff --git a/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs index 63413b5f..fe28d496 100644 --- a/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs @@ -35,18 +35,6 @@ public class OptionSettingViewModel : MyReactiveObject, ICloseable #endregion Core - #region Core KCP - - //[Reactive] public int Kcpmtu { get; set; } - //[Reactive] public int Kcptti { get; set; } - //[Reactive] public int KcpuplinkCapacity { get; set; } - //[Reactive] public int KcpdownlinkCapacity { get; set; } - //[Reactive] public int KcpreadBufferSize { get; set; } - //[Reactive] public int KcpwriteBufferSize { get; set; } - //[Reactive] public bool Kcpcongestion { get; set; } - - #endregion Core KCP - #region UI [Reactive] public bool AutoRun { get; set; } @@ -175,18 +163,6 @@ public class OptionSettingViewModel : MyReactiveObject, ICloseable #endregion Core - #region Core KCP - - //Kcpmtu = _config.kcpItem.mtu; - //Kcptti = _config.kcpItem.tti; - //KcpuplinkCapacity = _config.kcpItem.uplinkCapacity; - //KcpdownlinkCapacity = _config.kcpItem.downlinkCapacity; - //KcpreadBufferSize = _config.kcpItem.readBufferSize; - //KcpwriteBufferSize = _config.kcpItem.writeBufferSize; - //Kcpcongestion = _config.kcpItem.congestion; - - #endregion Core KCP - #region UI AutoRun = _config.GuiItem.AutoRun; @@ -325,28 +301,18 @@ public class OptionSettingViewModel : MyReactiveObject, ICloseable || EnableHWA != _config.GuiItem.EnableHWA || CurrentFontFamily != _config.UiItem.CurrentFontFamily; - //if (Utile.IsNullOrEmpty(Kcpmtu.ToString()) || !Utile.IsNumeric(Kcpmtu.ToString()) - // || Utile.IsNullOrEmpty(Kcptti.ToString()) || !Utile.IsNumeric(Kcptti.ToString()) - // || Utile.IsNullOrEmpty(KcpuplinkCapacity.ToString()) || !Utile.IsNumeric(KcpuplinkCapacity.ToString()) - // || Utile.IsNullOrEmpty(KcpdownlinkCapacity.ToString()) || !Utile.IsNumeric(KcpdownlinkCapacity.ToString()) - // || Utile.IsNullOrEmpty(KcpreadBufferSize.ToString()) || !Utile.IsNumeric(KcpreadBufferSize.ToString()) - // || Utile.IsNullOrEmpty(KcpwriteBufferSize.ToString()) || !Utile.IsNumeric(KcpwriteBufferSize.ToString())) - //{ - // NoticeHandler.Instance.Enqueue(ResUI.FillKcpParameters); - // return; - //} - //Core - _config.Inbound.First().LocalPort = LocalPort; - _config.Inbound.First().SecondLocalPortEnabled = SecondLocalPortEnabled; - _config.Inbound.First().UdpEnabled = UdpEnabled; - _config.Inbound.First().SniffingEnabled = SniffingEnabled; - _config.Inbound.First().DestOverride = DestOverride?.ToList(); - _config.Inbound.First().RouteOnly = RouteOnly; - _config.Inbound.First().AllowLANConn = AllowLANConn; - _config.Inbound.First().NewPort4LAN = NewPort4LAN; - _config.Inbound.First().User = User; - _config.Inbound.First().Pass = Pass; + var inbound = _config.Inbound.First(); + inbound.LocalPort = LocalPort; + inbound.SecondLocalPortEnabled = SecondLocalPortEnabled; + inbound.UdpEnabled = UdpEnabled; + inbound.SniffingEnabled = SniffingEnabled; + inbound.DestOverride = DestOverride?.ToList(); + inbound.RouteOnly = RouteOnly; + inbound.AllowLANConn = AllowLANConn; + inbound.NewPort4LAN = NewPort4LAN; + inbound.User = User; + inbound.Pass = Pass; if (_config.Inbound.Count > 1) { _config.Inbound.RemoveAt(1);