예제 #1
0
        void RefreshLocalV2RayCoreVersion()
        {
            var el = labelCoreVersion;

            VgcApis.Misc.Utils.RunInBackground(() =>
            {
                var core    = new Libs.V2Ray.Core(setting);
                var version = core.GetCoreVersion();
                var msg     = string.IsNullOrEmpty(version) ?
                              I18N.GetCoreVerFail :
                              string.Format(I18N.CurrentCoreVerIs, version);

                VgcApis.Misc.UI.Invoke(() => el.Text = msg);
            });
        }
예제 #2
0
        void V2RayCoreUpdater()
        {
            var core      = new Libs.V2Ray.Core(setting);
            var curVerStr = core.GetCoreVersion();

            if (string.IsNullOrEmpty(curVerStr))
            {
                return;
            }

            var src  = setting.v2rayCoreDownloadSource;
            var port = -1;

            if (setting.isUpdateUseProxy)
            {
                port = servers.GetAvailableHttpProxyPort();
            }

            var vers = Misc.Utils.GetOnlineV2RayCoreVersionList(port, src);

            if (vers.Count < 1)
            {
                return;
            }
            setting.SaveV2RayCoreVersionList(vers);

            var first   = vers.First();
            var current = new Version(curVerStr);
            var latest  = new Version(first.Substring(1));

            var msg = string.Format(I18N.ConfirmUpgradeV2rayCore, first);

            if (latest > current && VgcApis.Misc.UI.Confirm(msg))
            {
                Views.WinForms.FormDownloadCore.ShowForm();
            }
        }