private void CheckUpdateForFirstRun()
        {
            Configuration config = controller.GetConfigurationCopy();

            if (config.isDefault)
            {
                return;
            }
            _isStartupChecking = true;
            updateChecker.CheckUpdate(config, 3000);
        }
Beispiel #2
0
        private void CheckUpdateForFirstRun()
        {
            Configuration config = controller.GetConfigurationCopy();

            if (config.isDefault)
            {
                return;
            }
            _isStartupChecking = true;
            Task.Factory.StartNew(async() => await updateChecker.CheckUpdate(config, TimeSpan.FromSeconds(3)));
        }
 private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
 {
     updateChecker.CheckUpdate(controller.GetConfiguration());
     if (timerDelayCheckUpdate != null)
     {
         timerDelayCheckUpdate.Elapsed -= timer_Elapsed;
         timerDelayCheckUpdate.Stop();
         timerDelayCheckUpdate          = new System.Timers.Timer(1000.0 * 60 * 60 * 2);
         timerDelayCheckUpdate.Elapsed += timer_Elapsed;
         timerDelayCheckUpdate.Start();
     }
 }
Beispiel #4
0
 private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
 {
     if (timerDelayCheckUpdate != null)
     {
         if (timerDelayCheckUpdate.Interval <= 1000.0 * 30)
         {
             timerDelayCheckUpdate.Interval = 1000.0 * 60 * 5;
         }
         else
         {
             timerDelayCheckUpdate.Interval = 1000.0 * 60 * 60 * 2;
         }
     }
     updateChecker.CheckUpdate(controller.GetConfiguration());
 }
        static void Main(string[] args)
        {
            TestMyWebClient();
            Console.WriteLine();

            UpdateChecker checker = GetChecker();

            checker.CheckUpdate((latest) =>
            {
                Console.WriteLine("Name: " + latest.name);
                Console.WriteLine("Tag:" + latest.tag_name);
                Console.WriteLine("说明:\n" + latest.body);

                int result = UpdateChecker.VersionComparer.CompareVersion(latest.tag_name, checker.CurrentVersion);
                if (result > 0)
                {
                    Console.WriteLine("有新版本。");
                }
                else if (result < 0)
                {
                    Console.WriteLine("当前版本为最新。");
                }
                else
                {
                    Console.WriteLine("没有新版本。");
                }
            });

            Console.ReadKey();
        }
Beispiel #6
0
        public MenuViewController(ShadowsocksController controller)
        {
            LoadMenu();
            LoadTrayIcon();

            this.controller = controller;
            controller.EnableStatusChanged       += controller_EnableStatusChanged;
            controller.ConfigChanged             += controller_ConfigChanged;
            controller.PACFileReadyToOpen        += controller_PACFileReadyToOpen;
            controller.ShareOverLANStatusChanged += controller_ShareOverLANStatusChanged;
            controller.EnableGlobalChanged       += controller_EnableGlobalChanged;

            this.updateChecker             = new UpdateChecker();
            updateChecker.NewVersionFound += updateChecker_NewVersionFound;

            LoadCurrentConfiguration();

            updateChecker.CheckUpdate();

            if (controller.GetConfiguration().isDefault)
            {
                _isFirstRun = true;
                ShowConfigForm();
            }
        }
        public MenuViewController(ShadowsocksController controller)
        {
            LoadMenu();
            LoadTrayIcon();

            this.controller = controller;
            controller.EnableStatusChanged += controller_EnableStatusChanged;
            controller.ConfigChanged += controller_ConfigChanged;
            controller.PACFileReadyToOpen += controller_PACFileReadyToOpen;
            controller.ShareOverLANStatusChanged += controller_ShareOverLANStatusChanged;
            controller.EnableGlobalChanged += controller_EnableGlobalChanged;
            controller.Errored += controller_Errored;

            this.updateChecker = new UpdateChecker();
            updateChecker.NewVersionFound += updateChecker_NewVersionFound;

            LoadCurrentConfiguration();

            updateChecker.CheckUpdate();

            if (controller.GetConfiguration().isDefault)
            {
                _isFirstRun = true;
                ShowConfigForm();
            }
        }
Beispiel #8
0
        private void updateThread_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker        worker = (BackgroundWorker)sender;
            NewVersionWindowOptions nvwo   = new NewVersionWindowOptions {
                MyIcon = Resources.zss_main, MyImage = Resources.main
            };
            UpdateChecker updateChecker = new UpdateChecker(ZLinks.URL_UPDATE, Application.ProductName,
                                                            new Version(Adapter.AssemblyVersion),
                                                            Engine.ConfigUI.ReleaseChannel, Adapter.CheckProxySettings().GetWebProxy, nvwo);

            updateChecker.CheckUpdate();

            string status;

            if (updateChecker.UpdateInfo.Status == UpdateStatus.UpdateCheckFailed)
            {
                status = "Update check failed";
            }
            else
            {
                status = updateChecker.UpdateInfo.ToString();
            }

            worker.ReportProgress(1, status);
        }
        public MenuViewController(ShadowsocksController controller)
        {
            this.controller = controller;

            LoadMenu();

            controller.EnableStatusChanged += controller_EnableStatusChanged;
            controller.ConfigChanged += controller_ConfigChanged;
            controller.PACFileReadyToOpen += controller_FileReadyToOpen;
            controller.UserRuleFileReadyToOpen += controller_FileReadyToOpen;
            controller.ShareOverLANStatusChanged += controller_ShareOverLANStatusChanged;
            controller.EnableGlobalChanged += controller_EnableGlobalChanged;
            controller.Errored += controller_Errored;
            controller.UpdatePACFromGFWListCompleted += controller_UpdatePACFromGFWListCompleted;
            controller.UpdatePACFromGFWListError += controller_UpdatePACFromGFWListError;

            _notifyIcon = new NotifyIcon();
            UpdateTrayIcon();
            _notifyIcon.Visible = true;
            _notifyIcon.ContextMenu = contextMenu1;
            _notifyIcon.MouseDoubleClick += notifyIcon1_DoubleClick;

            this.updateChecker = new UpdateChecker();
            updateChecker.NewVersionFound += updateChecker_NewVersionFound;

            LoadCurrentConfiguration();

            updateChecker.CheckUpdate(controller.GetConfigurationCopy());

            if (controller.GetConfigurationCopy().isDefault)
            {
                _isFirstRun = true;
                ShowConfigForm();
            }
        }
Beispiel #10
0
        public MenuViewController(ShadowsocksController controller)
        {
            this.controller = controller;

            LoadMenu();

            controller.EnableStatusChanged       += controller_EnableStatusChanged;
            controller.ConfigChanged             += controller_ConfigChanged;
            controller.PACFileReadyToOpen        += controller_FileReadyToOpen;
            controller.UserRuleFileReadyToOpen   += controller_FileReadyToOpen;
            controller.ShareOverLANStatusChanged += controller_ShareOverLANStatusChanged;
            controller.EnableGlobalChanged       += controller_EnableGlobalChanged;
            controller.Errored += controller_Errored;
            controller.UpdatePACFromGFWListCompleted += controller_UpdatePACFromGFWListCompleted;
            controller.UpdatePACFromGFWListError     += controller_UpdatePACFromGFWListError;

            _notifyIcon = new NotifyIcon();
            UpdateTrayIcon();
            _notifyIcon.Visible           = true;
            _notifyIcon.ContextMenu       = contextMenu1;
            _notifyIcon.MouseDoubleClick += notifyIcon1_DoubleClick;

            this.updateChecker             = new UpdateChecker();
            updateChecker.NewVersionFound += updateChecker_NewVersionFound;

            LoadCurrentConfiguration();

            updateChecker.CheckUpdate(controller.GetConfiguration());

            if (controller.GetConfiguration().isDefault)
            {
                _isFirstRun = true;
                ShowConfigForm();
            }
        }
Beispiel #11
0
        private void CheckUpdate()
        {
            if (UpdaterAck != System.Windows.Forms.DialogResult.None)
            {
                UpdateChecker updateChecker = new UpdateChecker(ZLinks.URL_UPDATE, Application.ProductName, new Version(Adapter.AssemblyVersion),
                                                                Engine.ConfigUI.ReleaseChannel, Uploader.ProxySettings.GetWebProxy);
                updateChecker.CheckUpdate();
                UpdaterAck = System.Windows.Forms.DialogResult.None;

                if (updateChecker.UpdateInfo != null && updateChecker.UpdateInfo.Status == UpdateStatus.UpdateRequired && !string.IsNullOrEmpty(updateChecker.UpdateInfo.URL))
                {
                    UpdaterAck = MessageBox.Show("Update found. Do you want to download it?", Application.ProductName, MessageBoxButtons.YesNo,
                                                 MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                    if (UpdaterAck == DialogResult.Yes)
                    {
                        DownloaderForm downloader = new DownloaderForm(updateChecker.UpdateInfo.URL, updateChecker.Proxy, updateChecker.UpdateInfo.Summary);
                        downloader.ShowDialog();
                        if (downloader.Status == DownloaderFormStatus.InstallStarted)
                        {
                            Application.Exit();
                        }
                    }
                }
            }
        }
        private void CheckUpdate()
        {
            UpdateChecker updateChecker = new UpdateChecker(Links.URL_UPDATE, Application.ProductName, Program.AssemblyVersion,
                                                            ReleaseChannelType.Stable, Uploader.ProxyInfo.GetWebProxy());

            updateChecker.CheckUpdate();

            if (updateChecker.UpdateInfo != null)
            {
                switch (updateChecker.UpdateInfo.Status)
                {
                case UpdateStatus.UpdateRequired:
                    string updateText = string.Format("Would you like to download the update?\r\n\r\n{0} is current version.\r\n{1} is latest version.",
                                                      updateChecker.UpdateInfo.CurrentVersion, updateChecker.UpdateInfo.LatestVersion);

                    if (MessageBox.Show(updateText, "ShareX update is available", MessageBoxButtons.YesNo,
                                        MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                    {
                        UpdaterForm downloader = new UpdaterForm(updateChecker.UpdateInfo.URL, updateChecker.Proxy, updateChecker.UpdateInfo.Summary);
                        downloader.ShowDialog();
                        if (downloader.Status == DownloaderFormStatus.InstallStarted)
                        {
                            Application.Exit();
                        }
                    }
                    break;

                case UpdateStatus.UpdateCheckFailed:
                    DebugHelper.WriteLine("Update check failed.");
                    break;
                }
            }
        }
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (YouTubeSession.IsAlreadyAuthorized)
            {
                ButtonConnect_Click(sender, e);
            }

            notificationToggleCheckBox.DataContext = NotificatorManager.Notificator;
            notificationToggleCheckBox.SetBinding(CheckBox.IsCheckedProperty, new Binding(nameof(NotificatorManager.Notificator.IsEnabledNotification))
            {
                Mode = BindingMode.TwoWay,
            });

            if (await updateChecker.CheckUpdate() == true)
            {
                NotificatorManager.Notify("업데이트 확인", "Daram YouTube Uploader의 최신 버전이 있습니다.", NotifyType.Information);
            }
        }
Beispiel #14
0
        public void TestCheckUpdate2()
        {
            UpdateChecker checker = GetChecker();

            checker.CheckUpdate((latest) =>
            {
                Assert.AreEqual(latest.tag_name, "0.0.1");
                Assert.AreEqual(latest.body, "第一个版本");
            });
        }
Beispiel #15
0
        public void TestCheckUpdate1()
        {
            UpdateChecker checker = GetChecker();

            checker.CheckUpdate((version, message) =>
            {
                Assert.AreEqual(version, "0.0.1");
                Assert.AreEqual(message, "第一个版本");
            });
        }
        public MenuViewController(ShadowsocksController controller)
        {
            this.controller = controller;

            LoadMenu();

            controller.EnableStatusChanged         += controller_EnableStatusChanged;
            controller.ConfigChanged               += controller_ConfigChanged;
            controller.PACFileReadyToOpen          += controller_FileReadyToOpen;
            controller.UserRuleFileReadyToOpen     += controller_FileReadyToOpen;
            controller.ShareOverLANStatusChanged   += controller_ShareOverLANStatusChanged;
            controller.VerboseLoggingStatusChanged += controller_VerboseLoggingStatusChanged;
            controller.EnableGlobalChanged         += controller_EnableGlobalChanged;
            controller.Errored += controller_Errored;
            controller.UpdatePACFromGFWListCompleted += controller_UpdatePACFromGFWListCompleted;
            controller.UpdatePACFromGFWListError     += controller_UpdatePACFromGFWListError;

            _notifyIcon = new NotifyIcon();
            UpdateTrayIcon();
            _notifyIcon.Visible            = true;
            _notifyIcon.ContextMenu        = contextMenu1;
            _notifyIcon.BalloonTipClicked += notifyIcon1_BalloonTipClicked;
            _notifyIcon.MouseClick        += notifyIcon1_Click;
            _notifyIcon.MouseDoubleClick  += notifyIcon1_DoubleClick;
            _notifyIcon.BalloonTipClosed  += _notifyIcon_BalloonTipClosed;
            controller.TrafficChanged     += controller_TrafficChanged;

            this.updateChecker = new UpdateChecker();
            updateChecker.CheckUpdateCompleted += updateChecker_CheckUpdateCompleted;

            #region 抓取网络地址
            //var servers = GetServers.Download();
            //if (servers != null && servers.Count > 0)
            //{
            //    controller.SaveServers(servers, 1080, true);
            //}
            #endregion
            LoadCurrentConfiguration();

            Configuration config = controller.GetConfigurationCopy();



            if (config.isDefault)
            {
                _isFirstRun = true;
                ShowConfigForm();
            }
            else if (config.autoCheckUpdate)
            {
                _isStartupChecking = true;
                updateChecker.CheckUpdate(config, 3000);
            }
        }
Beispiel #17
0
        public MenuViewController(ShadowsocksController controller)
        {
            this.controller = controller;
            #region SSD
            _SetStaticMenuView();
            #endregion
            LoadMenu();

            controller.EnableStatusChanged         += controller_EnableStatusChanged;
            controller.ConfigChanged               += controller_ConfigChanged;
            controller.PACFileReadyToOpen          += controller_FileReadyToOpen;
            controller.UserRuleFileReadyToOpen     += controller_FileReadyToOpen;
            controller.ShareOverLANStatusChanged   += controller_ShareOverLANStatusChanged;
            controller.VerboseLoggingStatusChanged += controller_VerboseLoggingStatusChanged;
            controller.ShowPluginOutputChanged     += controller_ShowPluginOutputChanged;
            controller.EnableGlobalChanged         += controller_EnableGlobalChanged;
            controller.Errored += controller_Errored;
            controller.UpdatePACFromGFWListCompleted += controller_UpdatePACFromGFWListCompleted;
            controller.UpdatePACFromGFWListError     += controller_UpdatePACFromGFWListError;

            _notifyIcon = new NotifyIcon();
            UpdateTrayIconAndNotifyText();
            _notifyIcon.Visible            = true;
            _notifyIcon.ContextMenu        = contextMenu1;
            _notifyIcon.BalloonTipClicked += notifyIcon1_BalloonTipClicked;
            _notifyIcon.MouseClick        += notifyIcon1_Click;
            _notifyIcon.MouseDoubleClick  += notifyIcon1_DoubleClick;
            _notifyIcon.BalloonTipClosed  += _notifyIcon_BalloonTipClosed;
            controller.TrafficChanged     += controller_TrafficChanged;

            this.updateChecker = new UpdateChecker();
            updateChecker.CheckUpdateCompleted += updateChecker_CheckUpdateCompleted;

            LoadCurrentConfiguration();

            Configuration config = controller.GetConfigurationCopy();

            if (config.isDefault)
            {
                _isFirstRun = true;
                #region SSD
                //ShowConfigForm();
                _DisableFirstRun();
                #endregion
            }
            else if (config.autoCheckUpdate)
            {
                _isStartupChecking = true;
                updateChecker.CheckUpdate(config, 3000);
            }
            #region SSD
            _InitOther();
            #endregion
        }
Beispiel #18
0
        public void Display()
        {
            Bitmap icon = Resources.hp;

            ni.Icon                        = Icon.FromHandle(icon.GetHicon());;
            ni.Text                        = "Hostplus";
            ni.Visible                     = true;
            ni.ContextMenuStrip            = new ContextMenu().Create();
            updateChecker.NewVersionFound += updateChecker_NewVersionFound;
            updateChecker.CheckUpdate();
        }
Beispiel #19
0
        public MenuViewController(ShadowsocksController controller)
        {
            this.controller = controller;

            LoadMenu();

            controller.EnableStatusChanged         += controller_EnableStatusChanged;
            controller.ConfigChanged               += controller_ConfigChanged;
            controller.PACFileReadyToOpen          += controller_FileReadyToOpen;
            controller.UserRuleFileReadyToOpen     += controller_FileReadyToOpen;
            controller.ShareOverLANStatusChanged   += controller_ShareOverLANStatusChanged;
            controller.VerboseLoggingStatusChanged += controller_VerboseLoggingStatusChanged;
            controller.EnableGlobalChanged         += controller_EnableGlobalChanged;
            controller.Errored += controller_Errored;
            controller.UpdatePACFromGFWListCompleted += controller_UpdatePACFromGFWListCompleted;
            controller.UpdatePACFromGFWListError     += controller_UpdatePACFromGFWListError;

            _notifyIcon = new NotifyIcon();
            UpdateTrayIcon();
            _notifyIcon.Visible            = true;
            _notifyIcon.ContextMenu        = contextMenu1;
            _notifyIcon.BalloonTipClicked += notifyIcon1_BalloonTipClicked;
            _notifyIcon.MouseClick        += notifyIcon1_Click;
            _notifyIcon.MouseDoubleClick  += notifyIcon1_DoubleClick;
            _notifyIcon.BalloonTipClosed  += _notifyIcon_BalloonTipClosed;
            controller.TrafficChanged     += controller_TrafficChanged;

            this.updateChecker = new UpdateChecker();
            updateChecker.CheckUpdateCompleted += updateChecker_CheckUpdateCompleted;

            LoadCurrentConfiguration();

            Configuration config = controller.GetConfigurationCopy();

            if (config.isDefault)
            {
                _isFirstRun = true;
                ShowConfigForm();
            }
            else if (config.autoCheckUpdate)
            {
                _isStartupChecking = true;
                updateChecker.CheckUpdate(config, 3000);
            }

            if (config.grabInterval > 0)
            {
                this.getServerFromInternetTimer          = new Timer();
                this.getServerFromInternetTimer.Interval = config.grabInterval * 1000;
                this.getServerFromInternetTimer.Tick    += new System.EventHandler(this.GetServerFromInternetTimer_Tick);
                this.getServerFromInternetTimer.Enabled  = true;
            }
        }
Beispiel #20
0
        public MenuViewController(ShadowsocksController controller)
        {
            this.controller = controller;

            LoadMenu();
            enableItem.Visible       = false;
            modeItem.Visible         = false;
            PACItem.Visible          = false;
            proxyItem.Visible        = false;
            ShareOverLANItem.Visible = false;
            hotKeyItem.Visible       = false;
            //tableLayoutPanel6.Visible = false;
            //tableLayoutPanel7.Visible = false;

            controller.EnableStatusChanged         += controller_EnableStatusChanged;
            controller.ConfigChanged               += controller_ConfigChanged;
            controller.PACFileReadyToOpen          += controller_FileReadyToOpen;
            controller.UserRuleFileReadyToOpen     += controller_FileReadyToOpen;
            controller.ShareOverLANStatusChanged   += controller_ShareOverLANStatusChanged;
            controller.VerboseLoggingStatusChanged += controller_VerboseLoggingStatusChanged;
            controller.EnableGlobalChanged         += controller_EnableGlobalChanged;
            controller.Errored += controller_Errored;
            controller.UpdatePACFromGFWListCompleted += controller_UpdatePACFromGFWListCompleted;
            controller.UpdatePACFromGFWListError     += controller_UpdatePACFromGFWListError;

            _notifyIcon = new NotifyIcon();
            UpdateTrayIcon();
            _notifyIcon.Visible            = true;
            _notifyIcon.ContextMenu        = contextMenu1;
            _notifyIcon.BalloonTipClicked += notifyIcon1_BalloonTipClicked;
            _notifyIcon.MouseClick        += notifyIcon1_Click;
            _notifyIcon.MouseDoubleClick  += notifyIcon1_DoubleClick;
            _notifyIcon.BalloonTipClosed  += _notifyIcon_BalloonTipClosed;
            controller.TrafficChanged     += controller_TrafficChanged;

            this.updateChecker = new UpdateChecker();
            updateChecker.CheckUpdateCompleted += updateChecker_CheckUpdateCompleted;

            LoadCurrentConfiguration();

            Configuration config = controller.GetConfigurationCopy();

            if (config.isDefault)
            {
                _isFirstRun = true;
                ShowConfigForm();
            }
            else if (config.autoCheckUpdate)
            {
                _isStartupChecking = true;
                updateChecker.CheckUpdate(config, 3000);
            }
        }
        private void updateThread_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker        worker = (BackgroundWorker)sender;
            NewVersionWindowOptions nvwo   = new NewVersionWindowOptions {
                MyIcon = Resources.zss_main, MyImage = Resources.main
            };
            UpdateChecker updateChecker = new UpdateChecker(Engine.URL_UPDATE, Application.ProductName, new Version(Application.ProductVersion),
                                                            Engine.conf.ReleaseChannel, Adapter.CheckProxySettings().GetWebProxy, nvwo);

            worker.ReportProgress(1, updateChecker.CheckUpdate());
            updateChecker.ShowPrompt();
        }
Beispiel #22
0
        public MenuViewController(ShadowsocksController controller)
        {
            this.controller = controller;

            LoadMenu();

            controller.EnableStatusChanged       += controller_EnableStatusChanged;
            controller.ConfigChanged             += controller_ConfigChanged;
            controller.PACFileReadyToOpen        += controller_FileReadyToOpen;
            controller.UserRuleFileReadyToOpen   += controller_FileReadyToOpen;
            controller.ShareOverLANStatusChanged += controller_ShareOverLANStatusChanged;
            controller.EnableGlobalChanged       += controller_EnableGlobalChanged;
            controller.Errored += controller_Errored;
            controller.UpdatePACFromGFWListCompleted += controller_UpdatePACFromGFWListCompleted;
            controller.UpdatePACFromGFWListError     += controller_UpdatePACFromGFWListError;

            _notifyIcon = new NotifyIcon();
            UpdateTrayIcon();
            _notifyIcon.Visible            = true;
            _notifyIcon.ContextMenu        = contextMenu1;
            _notifyIcon.BalloonTipClicked += notifyIcon1_BalloonTipClicked;
            _notifyIcon.MouseClick        += notifyIcon1_Click;
            _notifyIcon.MouseDoubleClick  += notifyIcon1_DoubleClick;
            _notifyIcon.BalloonTipClosed  += _notifyIcon_BalloonTipClosed;

            this.updateChecker = new UpdateChecker();
            updateChecker.CheckUpdateCompleted += updateChecker_CheckUpdateCompleted;


            LoadCurrentConfiguration();

            var config = controller.GetConfigurationCopy();

            if (config.isDefault)
            {
                _isFirstRun = true;
            }
            else if (config.autoCheckUpdate)
            {
                _isStartupChecking = true;
                updateChecker.CheckUpdate(config, 3000);
            }



            timer.Tick += (s, e) =>
            {
                //provisional Over
                //TimerFunction();
            };

            TimerFunction();
        }
        private async Task <bool> CheckUpdate(bool silent)
        {
            try
            {
                UpdateChecker checker = new UpdateChecker("TKGP", "STALK-IRC");
                UpdateType    update  = await checker.CheckUpdate();

                if (update == UpdateType.Major || update == UpdateType.Minor)
                {
                    this.Hide();
                    timer1.Enabled = false;
                    timer3.Enabled = false;
                    AddGameMsg("Information", "A mandatory update to STALK-IRC is available! STALK-IRC is now disabled; check the client to update.");
                    SystemSounds.Asterisk.Play();
                    string notes = await checker.RenderReleaseNotes();

                    DialogResult result = new UpdateForm(notes, silent, true).ShowDialog();
                    if (result == DialogResult.Yes)
                    {
                        checker.DownloadAsset("STALK-IRC.exe");
                    }
                    doClose = true;
                    return(true);
                }
                else if (!updateSkipped && update == UpdateType.Patch)
                {
                    AddGameMsg("Information", "An optional update to STALK-IRC is available! Check the client to update.");
                    SystemSounds.Asterisk.Play();
                    string notes = await checker.RenderReleaseNotes();

                    DialogResult result = new UpdateForm(notes, silent, false).ShowDialog();
                    if (result == DialogResult.Yes)
                    {
                        this.Hide();
                        timer1.Enabled = false;
                        timer3.Enabled = false;
                        checker.DownloadAsset("STALK-IRC.exe");
                        doClose = true;
                    }
                    else
                    {
                        updateSkipped = true;
                    }
                }
            }
            catch (Octokit.RateLimitExceededException)
            {
                // Woops
            }
            return(false);
        }
Beispiel #24
0
        private void CheckUpdate()
        {
            if (!UpdateMessageBox.DontShow && !UpdateMessageBox.IsOpen)
            {
                UpdateChecker updateChecker = CreateUpdateChecker();
                updateChecker.CheckUpdate();

                if (UpdateMessageBox.Start(updateChecker, firstUpdateCheck) != DialogResult.Yes)
                {
                    TimeSpan interval = TimeSpan.FromHours(24);
                    updateTimer.Change(interval, interval);
                }

                firstUpdateCheck = false;
            }
        }
Beispiel #25
0
        public MenuViewController(FuckshadowsController controller)
        {
            this.controller = controller;

            LoadMenu();

            controller.EnableStatusChanged         += controller_EnableStatusChanged;
            controller.ConfigChanged               += controller_ConfigChanged;
            controller.PacFileReadyToOpen          += controller_FileReadyToOpen;
            controller.UserRuleFileReadyToOpen     += controller_FileReadyToOpen;
            controller.ShareOverLanStatusChanged   += controller_ShareOverLANStatusChanged;
            controller.VerboseLoggingStatusChanged += controller_VerboseLoggingStatusChanged;
            controller.EnableGlobalChanged         += controller_EnableGlobalChanged;
            controller.Errored += controller_Errored;
            controller.UpdatePacFromGfwListCompleted += controller_UpdatePACFromGFWListCompleted;
            controller.UpdatePacFromGfwListError     += controller_UpdatePACFromGFWListError;

            _notifyIcon = new NotifyIcon();
            UpdateTrayIcon();
            _notifyIcon.Visible            = true;
            _notifyIcon.ContextMenu        = _contextMenu1;
            _notifyIcon.BalloonTipClicked += notifyIcon1_BalloonTipClicked;
            _notifyIcon.MouseClick        += notifyIcon1_Click;
            _notifyIcon.MouseDoubleClick  += notifyIcon1_DoubleClick;
            _notifyIcon.BalloonTipClosed  += _notifyIcon_BalloonTipClosed;
            controller.TrafficChanged     += controller_TrafficChanged;

            this.updateChecker = new UpdateChecker();
            updateChecker.CheckUpdateCompleted += updateChecker_CheckUpdateCompleted;

            LoadCurrentConfiguration();

            Configuration config = controller.GetConfigurationCopy();

            if (config.isDefault)
            {
                _isFirstRun = true;
                ShowConfigForm();
            }
            else if (config.autoCheckUpdate)
            {
                _isStartupChecking = true;
                Task.Factory.StartNew(async() => await updateChecker.CheckUpdate(config, TimeSpan.FromSeconds(3)));
            }
        }
Beispiel #26
0
        private async void Check_Update_Click(object sender, RoutedEventArgs e)
        {
            var checker = new UpdateChecker("zapezhman", "FFWSC"); // uses your Application.ProductVersion

            UpdateType update = await checker.CheckUpdate().ConfigureAwait(true);

            if (update == UpdateType.None)
            {
                // Up to date!
            }
            else
            {
                // Ask the user if he wants to update
                // You can use the prebuilt form for this if you want (it's really pretty!)
                var result = new UpdateNotifyDialog(checker).ShowDialog();
                if (result.Equals(DialogResult.HasValue))
                {
                    checker.DownloadAsset("Converter.zip"); // opens it in the user's browser
                }
            }
        }
Beispiel #27
0
        private void CheckUpdate()
        {
            UpdateChecker updateChecker = new UpdateChecker(ZLinks.URL_UPDATE, Application.ProductName, new Version(Program.AssemblyVersion),
                                                            ReleaseChannelType.Stable, Uploader.ProxySettings.GetWebProxy);

            updateChecker.CheckUpdate();

            if (updateChecker.UpdateInfo != null && updateChecker.UpdateInfo.Status == UpdateStatus.UpdateRequired && !string.IsNullOrEmpty(updateChecker.UpdateInfo.URL))
            {
                if (MessageBox.Show("Update found. Do you want to download it?", "Update check", MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                {
                    DownloaderForm downloader = new DownloaderForm(updateChecker.UpdateInfo.URL, updateChecker.Proxy, updateChecker.UpdateInfo.Summary);
                    downloader.ShowDialog();
                    if (downloader.Status == DownloaderFormStatus.InstallStarted)
                    {
                        Application.Exit();
                    }
                }
            }
        }
        private async void BtnCheckUpdates_Click(object sender, RoutedEventArgs e)
        {
            var checker = new UpdateChecker("melonis45", "dansermenu"); // uses your Application.ProductVersion

            try
            {
                UpdateType update = await checker.CheckUpdate();

                if (update == UpdateType.None)
                {
                    MessageBox.Show("Up to date!", "Check was successful", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                else
                {
                    // Ask the user if he wants to update
                    // You can use the prebuilt form for this if you want (it's really pretty!)
                    var result = new UpdateNotifyDialog(checker).ShowDialog();
                    if (result == System.Windows.Forms.DialogResult.Yes)
                    {
                        string url       = $"https://github.com/melonis45/dansermenu/releases/download/{checker.latestTag}/DANSER-Menu-V{checker.latestTag}.zip";
                        int    processId = Process.GetCurrentProcess().Id;

                        Process          updateProcess = new Process();
                        ProcessStartInfo startInfo     = new ProcessStartInfo
                        {
                            FileName  = "Updater.exe",
                            Arguments = $"{url} {processId}"
                        };

                        updateProcess.StartInfo = startInfo;
                        updateProcess.Start();
                    }
                }
            }
            catch (System.Net.Http.HttpRequestException)
            {
                MessageBox.Show("No internet connection found!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
        }
Beispiel #29
0
        public static async Task <bool> CheckUpdate()
        {
            UpdateChecker updateChecker = new UpdateChecker("TKGP", "Chernobyl-Relay-Chat");
            UpdateType    updateType;

            try
            {
                updateType = await updateChecker.CheckUpdate();
            }
            catch (RateLimitExceededException)
            {
                return(false);
            }
            // If it got past the first one this is probably just a temporary issue
            catch (AggregateException ae)
            {
                ae.Handle(ex =>
                {
                    return(ex is HttpRequestException);
                });
                return(false);
            }
            if (updateType != UpdateType.None)
            {
                string releaseNotes = await updateChecker.RenderReleaseNotes();

                SystemSounds.Asterisk.Play();
                CRCGame.OnUpdate(CRCStrings.Localize("update_notice"));
                using (UpdateForm updateForm = new UpdateForm((updateType == UpdateType.Major || updateType == UpdateType.Minor), releaseNotes))
                {
                    DialogResult dialogResult = updateForm.ShowDialog();
                    if (dialogResult == DialogResult.OK)
                    {
                        updateChecker.DownloadAsset("Chernobyl-Relay-Chat.zip");
                    }
                }
                return(true);
            }
            return(false);
        }
Beispiel #30
0
        public MainWindow()
        {
            InitializeComponent();
            // Если требуется обновить настройки из прошлой версии
            if (Properties.Settings.Default.UpgradeRequired)
            {
                Properties.Settings.Default.Upgrade();
                Properties.Settings.Default.UpgradeRequired = false;
                Properties.Settings.Default.Save();
            }
            // Проверка на наличие новой версии
            if (UpdateChecker.CheckUpdate("Obmen_wpf.exe"))
            {
                System.Windows.Forms.MessageBox.Show("Обнаружена новая версия программы. \nНажмите \"Ок\" " +
                                                     "и программа будет автоматически обновлена.",
                                                     "Внимание!",
                                                     System.Windows.Forms.MessageBoxButtons.OK,
                                                     System.Windows.Forms.MessageBoxIcon.Asterisk);

                Process.Start("Updater.exe");
            }
        }
Beispiel #31
0
        // Note to self: prereleases are ignored

        public static bool CheckFirstUpdate()
        {
            UpdateChecker updateChecker = new UpdateChecker("TKGP", "Chernobyl-Relay-Chat");
            UpdateType    updateType;

            try
            {
                updateType = updateChecker.CheckUpdate().Result;
            }
            catch (RateLimitExceededException)
            {
                return(false);
            }
            catch (AggregateException ae)
            {
                ae.Handle(ex =>
                {
                    return(ex is HttpRequestException);
                });
                MessageBox.Show(CRCStrings.Localize("update_failed"), CRCStrings.Localize("crc_name"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(true);
            }
            if (updateType != UpdateType.None)
            {
                string releaseNotes = updateChecker.RenderReleaseNotes().Result;
                SystemSounds.Asterisk.Play();
                using (UpdateForm updateForm = new UpdateForm((updateType == UpdateType.Major || updateType == UpdateType.Minor), releaseNotes))
                {
                    DialogResult dialogResult = updateForm.ShowDialog();
                    if (dialogResult == DialogResult.OK)
                    {
                        updateChecker.DownloadAsset("Chernobyl-Relay-Chat.zip");
                    }
                }
                return(true);
            }
            return(false);
        }
        public MenuViewController(ShadowsocksController controller)
        {
            this.controller = controller;

            LoadMenu();
            //             controller.ConfigChanged += controller_ConfigChanged;
            //             controller.PACFileReadyToOpen += controller_FileReadyToOpen;
            //             controller.UserRuleFileReadyToOpen += controller_FileReadyToOpen;
            //             controller.Errored += controller_Errored;
            //             controller.UpdatePACFromGFWListCompleted += controller_UpdatePACFromGFWListCompleted;
            //             controller.UpdatePACFromGFWListError += controller_UpdatePACFromGFWListError;

            _notifyIcon = new NotifyIcon();
            UpdateTrayIconAndNotifyText();
            _notifyIcon.Visible            = true;
            _notifyIcon.ContextMenu        = contextMenu1;
            _notifyIcon.BalloonTipClicked += notifyIcon1_BalloonTipClicked;
            _notifyIcon.MouseDoubleClick  += notifyIcon1_DoubleClick;
            _notifyIcon.BalloonTipClosed  += _notifyIcon_BalloonTipClosed;
            controller.TrafficChanged     += controller_TrafficChanged;

            this.updateChecker = new UpdateChecker();
            updateChecker.CheckUpdateCompleted += updateChecker_CheckUpdateCompleted;

            Configuration config = controller.GetConfigurationCopy();

            if (config.isDefault)
            {
                _isFirstRun = true;
            }
            else if (config.autoCheckUpdate)
            {
                _isStartupChecking = true;
                updateChecker.CheckUpdate(config, 3000);
            }

            ShowConfigForm();
        }
        private void CheckUpdate()
        {
            UpdateChecker updateChecker = new UpdateChecker(ZLinks.URL_UPDATE, Application.ProductName, new Version(Program.AssemblyVersion),
                ReleaseChannelType.Stable, Uploader.ProxySettings.GetWebProxy);
            updateChecker.CheckUpdate();

            if (updateChecker.UpdateInfo != null && updateChecker.UpdateInfo.Status == UpdateStatus.UpdateRequired && !string.IsNullOrEmpty(updateChecker.UpdateInfo.URL))
            {
                if (MessageBox.Show("Update found. Do you want to download it?", "Update check", MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                {
                    DownloaderForm downloader = new DownloaderForm(updateChecker.UpdateInfo.URL, updateChecker.Proxy, updateChecker.UpdateInfo.Summary);
                    downloader.ShowDialog();
                    if (downloader.Status == DownloaderFormStatus.InstallStarted) Application.Exit();
                }
            }
        }
        public MenuViewController(ShadowsocksController controller)
        {
            this.controller = controller;

            LoadMenu();

            controller.EnableStatusChanged += controller_EnableStatusChanged;
            controller.ConfigChanged += controller_ConfigChanged;
            controller.PACFileReadyToOpen += controller_FileReadyToOpen;
            controller.UserRuleFileReadyToOpen += controller_FileReadyToOpen;
            controller.ShareOverLANStatusChanged += controller_ShareOverLANStatusChanged;
            controller.VerboseLoggingStatusChanged += controller_VerboseLoggingStatusChanged;
            controller.EnableGlobalChanged += controller_EnableGlobalChanged;
            controller.Errored += controller_Errored;
            controller.UpdatePACFromGFWListCompleted += controller_UpdatePACFromGFWListCompleted;
            controller.UpdatePACFromGFWListError += controller_UpdatePACFromGFWListError;

            _notifyIcon = new NotifyIcon();
            UpdateTrayIcon();
            _notifyIcon.Visible = true;
            _notifyIcon.ContextMenu = contextMenu1;
            _notifyIcon.BalloonTipClicked += notifyIcon1_BalloonTipClicked;
            _notifyIcon.MouseClick += notifyIcon1_Click;
            _notifyIcon.MouseDoubleClick += notifyIcon1_DoubleClick;
            _notifyIcon.BalloonTipClosed += _notifyIcon_BalloonTipClosed;
            controller.TrafficChanged += controller_TrafficChanged;

            this.updateChecker = new UpdateChecker();
            updateChecker.CheckUpdateCompleted += updateChecker_CheckUpdateCompleted;

            LoadCurrentConfiguration();

            Configuration config = controller.GetConfigurationCopy();

            if (config.isDefault)
            {
                _isFirstRun = true;
                ShowConfigForm();
            }
            else if(config.autoCheckUpdate)
            {
                _isStartupChecking = true;
                updateChecker.CheckUpdate(config, 3000);
            }
        }
        private void updateThread_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker = (BackgroundWorker)sender;
            NewVersionWindowOptions nvwo = new NewVersionWindowOptions { MyIcon = Resources.zss_main, MyImage = Resources.main };
            UpdateChecker updateChecker = new UpdateChecker(ZLinks.URL_UPDATE, Application.ProductName,
                new Version(Adapter.AssemblyVersion),
                Engine.ConfigUI.ReleaseChannel, Adapter.CheckProxySettings().GetWebProxy, nvwo);

            updateChecker.CheckUpdate();

            string status;
            if (updateChecker.UpdateInfo.Status == UpdateStatus.UpdateCheckFailed)
            {
                status = "Update check failed";
            }
            else
            {
                status = updateChecker.UpdateInfo.ToString();
            }

            worker.ReportProgress(1, status);
        }
        private void CheckUpdate()
        {
            if (UpdaterAck != System.Windows.Forms.DialogResult.None)
            {
                UpdateChecker updateChecker = new UpdateChecker(ZLinks.URL_UPDATE, Application.ProductName, new Version(Adapter.AssemblyVersion),
                    Engine.ConfigUI.ReleaseChannel, Uploader.ProxySettings.GetWebProxy);
                updateChecker.CheckUpdate();
                UpdaterAck = System.Windows.Forms.DialogResult.None;

                if (updateChecker.UpdateInfo != null && updateChecker.UpdateInfo.Status == UpdateStatus.UpdateRequired && !string.IsNullOrEmpty(updateChecker.UpdateInfo.URL))
                {
                    UpdaterAck = MessageBox.Show("Update found. Do you want to download it?", Application.ProductName, MessageBoxButtons.YesNo,
                        MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                    if (UpdaterAck == DialogResult.Yes)
                    {
                        DownloaderForm downloader = new DownloaderForm(updateChecker.UpdateInfo.URL, updateChecker.Proxy, updateChecker.UpdateInfo.Summary);
                        downloader.ShowDialog();
                        if (downloader.Status == DownloaderFormStatus.InstallStarted) Application.Exit();
                    }
                }
            }
        }