public static async void CheckForUpdates(bool force = false)
        {
#if (SQUIRREL)
            using (var mgr = await UpdateManager.GitHubUpdateManager("https://github.com/Epix37/HDT-Releases", prerelease: Config.Instance.CheckForBetaUpdates))
            {
                var release = await mgr.UpdateApp();

                if (release != null)
                {
                    StatusBar.Visibility = Visibility.Visible;
                }
            }
#else
            if (!force)
            {
                if (!Config.Instance.CheckForUpdates || TempUpdateCheckDisabled || Core.Game.IsRunning || _showingUpdateMessage ||
                    (DateTime.Now - _lastUpdateCheck) < new TimeSpan(0, 10, 0))
                {
                    return;
                }
            }
            _lastUpdateCheck = DateTime.Now;
            _release         = await GetLatestRelease(false);

            if (_release != null)
            {
                StatusBar.Visibility = Visibility.Visible;
                ShowNewUpdateMessage(false);
            }
            else if (Config.Instance.CheckForBetaUpdates)
            {
                _release = await GetLatestRelease(true);

                if (_release != null)
                {
                    ShowNewUpdateMessage(true);
                }
            }
#endif
        }
		public static async void CheckForUpdates(bool force = false)
		{
			if(!force)
			{
				if(!Config.Instance.CheckForUpdates || TempUpdateCheckDisabled || Core.Game.IsRunning || _showingUpdateMessage
				   || (DateTime.Now - _lastUpdateCheck) < new TimeSpan(0, 10, 0))
					return;
			}
			_lastUpdateCheck = DateTime.Now;
			_release = await GetLatestRelease(false);
			if(_release != null)
			{
				StatusBar.Visibility = Visibility.Visible;
				ShowNewUpdateMessage(false);
			}
			else if(Config.Instance.CheckForBetaUpdates)
			{
				_release = await GetLatestRelease(true);
				if(_release != null)
					ShowNewUpdateMessage(true);
			}
		}
Ejemplo n.º 3
0
 internal static async void StartUpdate()
 {
     Log.Info("Starting update...");
     if (_release == null || (DateTime.Now - _lastUpdateCheck) > new TimeSpan(0, 10, 0))
     {
         _release = await GetLatestRelease(Config.Instance.CheckForBetaUpdates);
     }
     if (_release == null)
     {
         Log.Error("Could not get latest version. Not updating.");
         return;
     }
     try
     {
         Process.Start("HDTUpdate.exe", $"{Process.GetCurrentProcess().Id} {_release.Assets[0].Url}");
         Core.MainWindow.Close();
         Application.Current.Shutdown();
     }
     catch (Exception ex)
     {
         Log.Error("Error starting updater\n" + ex);
         Helper.TryOpenUrl($"{_release.Assets[0].Url}");
     }
 }
		internal static async void StartUpdate()
		{
			Log.Info("Starting update...");
			if(_release == null || (DateTime.Now - _lastUpdateCheck) > new TimeSpan(0, 10, 0))
				_release = await GetLatestRelease(Config.Instance.CheckForBetaUpdates);
			if(_release == null)
			{
				Log.Error("Could not get latest version. Not updating.");
				return;
			}
			try
			{
				Process.Start("HDTUpdate.exe", $"{Process.GetCurrentProcess().Id} {_release.Assets[0].Url}");
				Core.MainWindow.Close();
				Application.Current.Shutdown();
			}
			catch(Exception ex)
			{
				Log.Error("Error starting updater\n" + ex);
				Helper.TryOpenUrl($"{_release.Assets[0].Url}");
			}
		}