Exemple #1
0
        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);
        }