public override bool SaveOptions() { if (!IsOptionsChanged()) { return(false); } // mode if (VgcApis.Misc.Utils.TryParseAddress(tboxDefImportAddr.Text, out string ip, out int port)) { setting.CustomDefImportIp = ip; setting.CustomDefImportPort = port; } setting.CustomDefImportMode = cboxDefImportMode.SelectedIndex; setting.CustomDefImportSsShareLink = chkImportSsShareLink.Checked; setting.CustomDefImportGlobalImport = chkImportInjectGlobalImport.Checked; setting.CustomDefImportBypassCnSite = chkImportBypassCnSite.Checked; // speedtest setting.isUseCustomSpeedtestSettings = chkSetSpeedtestIsUse.Checked; setting.CustomSpeedtestUrl = cboxDefSpeedtestUrl.Text; setting.CustomSpeedtestCycles = VgcApis.Misc.Utils.Str2Int(tboxSetSpeedtestCycles.Text); setting.CustomSpeedtestExpectedSizeInKib = VgcApis.Misc.Utils.Str2Int(cboxDefSpeedtestExpectedSize.Text); setting.CustomSpeedtestTimeout = VgcApis.Misc.Utils.Str2Int(tboxSetSpeedtestTimeout.Text); setting.SaveUserSettingsNow(); return(true); }
public override bool SaveOptions() { if (!IsOptionsChanged()) { return(false); } var pageSize = VgcApis.Misc.Utils.Str2Int(cboxPageSize.Text); if (pageSize != setting.serverPanelPageSize) { setting.serverPanelPageSize = pageSize; Services.Servers.Instance.RequireFormMainReload(); } setting.isEnableDebugLogFile = chkIsEnableDebugLogFile.Checked; setting.DebugLogFilePath = tboxDebugLogFilePath.Text; setting.maxConcurrentV2RayCoreNum = VgcApis.Misc.Utils.Str2Int(tboxMaxCoreNum.Text); var index = cboxLanguage.SelectedIndex; if (IsIndexValide(index) && ((int)setting.culture != index)) { setting.culture = (Models.Datas.Enums.Cultures)index; } var keepTracking = chkServAutoTrack.Checked; var trackerSetting = setting.GetServerTrackerSetting(); if (trackerSetting.isTrackerOn != keepTracking) { trackerSetting.isTrackerOn = keepTracking; setting.SaveServerTrackerSetting(trackerSetting); setting.isServerTrackerOn = keepTracking; servers.OnAutoTrackingOptionChanged(); } setting.QuickSwitchServerLantency = VgcApis.Misc.Utils.Str2Int(cboxRandomSelectServerLatency.Text); setting.isUpdateUseProxy = chkSetUpdateUseProxy.Checked; setting.isCheckVgcUpdateWhenAppStart = chkSetCheckVgcUpdateWhenAppStart.Checked; setting.isCheckV2RayCoreUpdateWhenAppStart = chkSetCheckV2RayCoreUpdateWhenAppStart.Checked; setting.isSupportSelfSignedCert = chkSetIsSupportSelfSignedCert.Checked; setting.uTlsFingerprint = cboxSettingsUtlsFingerprint.Text; setting.isEnableUtlsFingerprint = chkSetIsEnableUtlsFingerprint.Checked; setting.isPortable = chkPortableMode.Checked; setting.isUseV4 = chkSetUseV4.Checked; // Must enable v4 mode first. setting.isEnableStatistics = setting.isUseV4 && chkSetEnableStat.Checked; setting.SaveUserSettingsNow(); return(true); }