From 94e3aed30a68aff4a606e2d3af135f01bb152c5a Mon Sep 17 00:00:00 2001 From: DHR60 Date: Mon, 9 Mar 2026 23:10:27 +0800 Subject: [PATCH] Fix --- v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs | 8 ++++---- v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs b/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs index f56bb1c0..f4d62806 100644 --- a/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs @@ -27,10 +27,10 @@ public class AddServerViewModel : MyReactiveObject public string Ports { get; set; } [Reactive] - public int UpMbps { get; set; } + public int? UpMbps { get; set; } [Reactive] - public int DownMbps { get; set; } + public int? DownMbps { get; set; } [Reactive] public string HopInterval { get; set; } @@ -175,8 +175,8 @@ public class AddServerViewModel : MyReactiveObject AlterId = AlterId > 0 ? AlterId.ToString() : null, Flow = Flow.NullIfEmpty(), SalamanderPass = SalamanderPass.NullIfEmpty(), - UpMbps = UpMbps >= 0 ? UpMbps : null, - DownMbps = DownMbps >= 0 ? DownMbps : null, + UpMbps = UpMbps ?? 0, + DownMbps = DownMbps ?? 0, HopInterval = HopInterval.NullIfEmpty(), VmessSecurity = VmessSecurity.NullIfEmpty(), VlessEncryption = VlessEncryption.NullIfEmpty(), diff --git a/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs index 8462a2c3..b5bfe71f 100644 --- a/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs @@ -22,8 +22,8 @@ public class OptionSettingViewModel : MyReactiveObject [Reactive] public string defUserAgent { get; set; } [Reactive] public string mux4SboxProtocol { get; set; } [Reactive] public bool enableCacheFile4Sbox { get; set; } - [Reactive] public int hyUpMbps { get; set; } - [Reactive] public int hyDownMbps { get; set; } + [Reactive] public int? hyUpMbps { get; set; } + [Reactive] public int? hyDownMbps { get; set; } [Reactive] public bool enableFragment { get; set; } #endregion Core @@ -336,8 +336,8 @@ public class OptionSettingViewModel : MyReactiveObject _config.CoreBasicItem.DefUserAgent = defUserAgent; _config.Mux4SboxItem.Protocol = mux4SboxProtocol; _config.CoreBasicItem.EnableCacheFile4Sbox = enableCacheFile4Sbox; - _config.HysteriaItem.UpMbps = hyUpMbps; - _config.HysteriaItem.DownMbps = hyDownMbps; + _config.HysteriaItem.UpMbps = hyUpMbps ?? 0; + _config.HysteriaItem.DownMbps = hyDownMbps ?? 0; _config.CoreBasicItem.EnableFragment = enableFragment; _config.GuiItem.AutoRun = AutoRun;