private void Window_Closed(object sender, EventArgs e) { if (Settings.Default.AutoUpdate && VersionChecker.HasNewerRemote) { UpdateManager.Update(VersionChecker.LatestRemote); } }
private async void UpdateCheck() { if (ConnectionChecker.IsConnectedToInternet) { ShowFlyout(1); bool isUpdateAvaliable = await UpdateManager.IsUpdateAvailable(); ShowFlyout(1); if (isUpdateAvaliable) { ShowFlyout(3); bool success = await UpdateManager.Update(); if (success) { await this.ShowMessageAsync("UPDATE SUCCESSFUL", null); ShowFlyout(3); } else { await this.ShowMessageAsync("AN ERROR HAS OCCURED", null); ShowFlyout(3); } } await this.ShowMessageAsync("APP DB IS ON LATEST VERSION", null); } else { await this.ShowMessageAsync("UPDATE DB CHECK FAIL", "YOU ARE NOT CONNECTED TO INTERNET"); } }
private static async Task <bool> CheckUpdate() { SplashScreen.SetText("Checking for updates..."); var isUpToDate = await UpdateManager.IsUpToDate().ConfigureAwait(false); if (isUpToDate) { return(false); } SetForegroundWindow(Process.GetCurrentProcess().MainWindowHandle); bool result = App.Current.Dispatcher.Invoke(() => { var patchnotes = new UpdatePopup(); patchnotes.ShowDialog(); if ((patchnotes.DialogResult ?? false) != true) { return(false); } return(UpdateManager.Update()); }); return(result); }
static int Main(string[] args) { ApplicationSettings.Current.Logger = new Log4NetWrapper(LogManager.GetLogger(typeof(Program))); ApplicationSettings.Current.AutoClose = true; ApplicationSettings.Current.CommandLineParams = CreateCommandLineArguments(args); var settings = ConfigurationManager.GetSection("DbUpdater") as DbUpdaterConfigurationSection; var logger = ApplicationSettings.Current.Logger; var commandLineParams = ApplicationSettings.Current.CommandLineParams; if (!string.IsNullOrEmpty(commandLineParams.ConnectionString)) { settings.ConnectionString = commandLineParams.ConnectionString; } var updater = new UpdateManager(settings, logger, commandLineParams); updater.UpdateProgress += (s, e) => { Update_ProgressChanged(0, new ProgressChangedEventArgs(0, e)); }; try { updater.Update(); } catch (Exception ex) { System.Console.WriteLine($"{ex.Message}.{ex.InnerException?.Message ?? ""}"); return(1); } return(0); }
private async Task Update(CancellationToken cancellationToken) { try { while (!cancellationToken.IsCancellationRequested) { if (_isFirstCheck || DateTime.Now >= Settings.NextCheckDate) { try { _isFirstCheck = false; _logger.LogInformation("Checking for updates."); // Always reload our manifest in case it has been altered since our last check. await _manager.Load(); foreach (var install in Settings.InstalledApps) { var app = _manager.Applications.FirstOrDefault(a => a.Id == install.ApplicationId); if (app != null) { var package = app.GetLatestPackage(); if (package != null) { try { await _manager.Update(package, install.InstallUri, cancellationToken); } catch (Exception ex) { _logger.LogError(ex, $"Unable to update application '{package.Application.Name}'."); } } else { _logger.LogWarning($"Unable to get the latest package for app '{app.Name}'. No update will be applied."); } } else { _logger.LogWarning($"The app with id '{install.ApplicationId}' doesn't exist in the manifest. No update will be applied."); } } UpdateNextCheckDate(); } catch (Exception ex) { _logger.LogError(ex, "Update check failed."); } } // time to run check? await Task.Delay(TimeSpan.FromMinutes(1), cancellationToken); } // cancellation requested? } catch (TaskCanceledException) { } }
private async Task ValidateUpdate(UpdateManager manager, Guid packageId, Uri installUri) { var package = manager.Applications.SelectMany(a => a.Packages).First(p => p.Id == packageId); await manager.Update(package, installUri, CancellationToken.None); using (var zip = ZipFile.OpenRead(package.SourceUri.LocalPath)) Assert.AreEqual(zip.Entries.Count, CountFiles(installUri.LocalPath)); Assert.AreEqual(package.FileVersion.ToString(), FileVersionInfo.GetVersionInfo(Path.Combine(installUri.LocalPath, package.Application.VersionFilename)).FileVersion); }
public Launcher() { if (!UpdateManager.Update()) { throw new Exception("Update Process Failed"); } _context = new LiteDataContext(); Bootstrapper = new OverseerBootstrapper(_context); }
private static async Task <bool> CheckUpdate() { var isUpToDate = await UpdateManager.IsUpToDate().ConfigureAwait(false); if (isUpToDate) { return(false); } if (MessageBox.Show(LP.App_Do_you_want_to_update, LP.App_Update_Available, MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes) { return(false); } return(UpdateManager.Update()); }
public override void Update() { if (fpsCounter <= 0) { fpsText.Text = $"FPS: {((int)(1f / Game.DeltaTime)).ToString()}"; fpsCounter = 1; } else { fpsCounter -= Game.DeltaTime; } PhysicsManager.Update(); UpdateManager.Update(); PhysicsManager.CheckCollisions(); }
public static async Task MainAsync() { // Use IOC Container in the UI project to deal with dependencies. var output = new ConsoleTrigger(); var settings = new JsonTweakerSettings(JsonTweakerSettings.DefaultTweakerJsonFilePath); var updater = new UpdateManager(settings, output); Console.WriteLine("pso_bin is located at : " + settings.GameDirectory); var version = (settings.GameVersion ?? "version.ver not found!"); Console.WriteLine("Game version: " + version); Console.WriteLine("Game is up to date? " + await updater.IsGameUpToDate()); await updater.Update(false, true); }
private static async Task <bool> CheckUpdate() { var isUpToDate = await UpdateManager.IsUpToDate().ConfigureAwait(false); if (isUpToDate) { return(false); } SetForegroundWindow(Process.GetCurrentProcess().MainWindowHandle); if (MessageBox.Show(LP.App_Do_you_want_to_update, LP.App_Update_Available, MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes) { return(false); } return(UpdateManager.Update()); }
private static async Task <bool> CheckUpdate() { var isUpToDate = await UpdateManager.IsUpToDate().ConfigureAwait(false); if (isUpToDate) { return(false); } if (MessageBox.Show("Do you want to update the application?", "Update Available", MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes) { return(false); } return(await UpdateManager.Update()); }
public void Main(string argument, UpdateType updateSource) { Log.ClearScreen(); Cycles++; Log.Info($"Cycles: {Cycles}"); Log.Info($"State: {RunState}"); Log.Info(); switch (updateSource) { case UpdateType.Terminal: argument = argument.ToUpper(); if (Commands.ContainsKey(argument)) { Commands[argument](argument, updateSource); } else { // TODO: Unhandled argument. Panic? } break; case UpdateType.Update1: if (Updater != null) { Updater.Update(); } if (Ticks.ContainsKey(RunState)) { Ticks[RunState]?.Invoke(argument, updateSource); } else { throw new Exception($"Unhandled state during dispatch: {RunState}"); } break; default: throw new Exception($"Unhandled update source: {updateSource}"); } Log.Info(); Log.Info($"Last run time: {Runtime.LastRunTimeMs:N4}ms"); Average.Add((int)(Runtime.LastRunTimeMs * 10000)); Log.Info($"Min: {Average.Min / 10000f:N4}, Avg: {Average.Average / 10000f:N4}, Max: {Average.Max / 10000f:N4}"); Log.Info($"Instructions: {Runtime.CurrentInstructionCount}/{Runtime.MaxInstructionCount}"); }
void Update() { UpdateManager.Update(); if (Input.GetKeyDown(KeyCode.Escape)) { var page = UIEngine.Top; if (page is MainPage) { SDKManager.Exit(); } else { HeadBarFloating.instance.OnBackButton(); } } }
private void updateDB() { try { Locale locale = (Locale)cbLang.SelectedItem; Localization.Instance.ResourcesLoad(locale); } catch { } UpdateManager updateManager = new UpdateManager("SERVER\\BAUMAX", "BauMax_Test"); updateManager.OnMessage += new Baumax.DBUpdater.MessageEventHandler(onDbUpdateMessage); updateManager.OnDbUpdateComplete += new UpdateCompleteEventHandler(onDbUpdateComplete); updateManager.OnBatchComplete += new UpdateCompleteEventHandler(onDbUpdateBatchComplete); updateManager.OnProgressUpdateChanged += new UpdateProgressEventHangler(onDbUpdateProgress); updateManager.OnProgressBatchChanged += new UpdateProgressEventHangler(onDbUpdateBatchProgress); memoEdit.Text = ""; updateManager.Update(new Version("0.0.5")); }
static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); // Get the DDay.Update configuration section DDayUpdateConfigurationSection cfg = ConfigurationManager.GetSection("DDay.Update") as DDayUpdateConfigurationSection; // Set the command line parameters to the application UpdateManager.SetCommandLineParameters(args); try { // Determine if an update is available if (cfg.Automatic) { if (UpdateManager.IsUpdateAvailable(cfg.Uri, cfg.Username, cfg.Password, cfg.Domain)) { log.Debug("Update is available, beginning update process..."); // Perform the update, which performs the following steps: // 1. Updates to a new version of the application // 2. Saves new deployment and application manifests locally // 3. Removes previous versions of the application (depending on configuration settings) UpdateManager.Update(); } else { log.Debug("Application is up-to-date."); } } else { log.Debug("Automatic updates are disabled."); } } finally { // Start the application UpdateManager.StartApplication(); } log.Debug("Exiting bootstrap application..."); }
private void updateDB() { if (updateManager == null) { operationComplite(true); MessageBox.Show(res.MustConnect); } else { try { addTextToMemo(_ConnectedToServer); updateManager.Update((Version)cbVersions.Items[cbVersions.SelectedIndex]); } catch (Exception ex) { addTextToMemo(ex.Message); onDbUpdateComplete(this, new UpdateCompleteEventArgs(false)); } } }
public void Update(float delta) { if (!IsInitialized) { Console.WriteLine("GameManager not initialized (this is quite fatal)"); return; } loadingManager.Update(delta); coroutineManager.Step(); timeManager.Update(delta); worldManager.Update(delta); cameraManager.Update(delta); lightingManager.Update(delta); screenSpaceSelector.Update(delta); updateLoop.Update(delta); chunkManager.Update(delta); moduleManager.Update(delta); }
/// <summary> /// Updates the programme. /// </summary> /// <param name="p_booIsAutoCheck">Whether the check is automatic or user requested.</param> private void UpdateProgramme(bool p_booIsAutoCheck) { Updating(this, new EventArgs <IBackgroundTask>(UpdateManager.Update(ConfirmUpdaterAction, p_booIsAutoCheck))); }
public void Update(string[] args) => mgr.Update(args);
private static void Main(string[] args) { bool flag; string name = @"Global\StrongholdKingdomsAlphaUpdater"; using (new Mutex(true, name, out flag)) { DDText.loadText(Application.StartupPath + @"\"); if (!flag) { MessageBox.Show(tm(), DDText.getText(6), DDText.getText(7)); return; } AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(Program.CurrentDomain_UnhandledException); DDayUpdateConfigurationSection section = ConfigurationManager.GetSection("DDay.Update") as DDayUpdateConfigurationSection; UpdateManager.SetCommandLineParameters(args); bool flag2 = true; bool flag3 = false; bool flag4 = false; bool flag5 = false; try { if (((args != null) && (args.Length > 0)) && (args[0] == "-uninstall")) { flag2 = false; UpdateManager.Uninstall(); } log.Debug("Starting Updater V" + SelfUpdater.CurrentBuildMajorVersion.ToString() + "." + SelfUpdater.CurrentBuildMinorVersion.ToString()); Form owner = null; if (!section.Automatic || !flag2) { goto Label_03D2; } Uri uri = SelfUpdater.isSelfUpdaterAvailable(section.Uri, DDText.getText(0x17) == "XX"); if (uri != null) { MessageBoxButtons oKCancel = MessageBoxButtons.OKCancel; if (MessageBox.Show(tm(), DDText.getText(8) + Environment.NewLine + DDText.getText(9) + Environment.NewLine + Environment.NewLine + DDText.getText(10), DDText.getText(11), oKCancel) == DialogResult.OK) { string path = SelfUpdater.downloadSelfUpdater(uri); if ((path != null) && (path.Length > 0)) { SelfUpdater.runInstaller(path); } } flag2 = false; return; } if (!UpdateManager.IsUpdateAvailable(section.Uri, section.Username, section.Password, section.Domain)) { goto Label_03C1; } log.Debug("Update is available, beginning update process..."); int num = 30; Label_01D3: if (num < 0) { flag2 = false; log.Debug("Run App Cancelled 1."); flag3 = true; } else { if (num != 30) { UpdateManager.SysDelay(0x3e8); if (flag5) { UpdateManager.IsUpdateAvailable(section.Uri, section.Username, section.Password, section.Domain); } } if (UpdateManager.ManifestIssue) { MessageBox.Show(tm(), DDText.getText(12) + Environment.NewLine + Environment.NewLine + UpdateManager.ManifestString, DDText.getText(13)); flag2 = false; } else { bool flag6 = true; while (UpdateManager.ConnectionIssue) { if (num == 30) { UpdateManager.SysDelay(500); } MessageBoxButtons retryCancel = MessageBoxButtons.RetryCancel; DialogResult cancel = DialogResult.Cancel; if (UpdateManager._UpdateNotifier != null) { owner = UpdateManager._UpdateNotifier.GetForm(); } else { owner = null; } if (owner != null) { cancel = MessageBox.Show(owner, DDText.getText(14) + Environment.NewLine + Environment.NewLine + UpdateManager.WebErrorString, DDText.getText(15), retryCancel); } else { cancel = MessageBox.Show(tm(), DDText.getText(14) + Environment.NewLine + Environment.NewLine + UpdateManager.WebErrorString, DDText.getText(15), retryCancel); } if (cancel == DialogResult.Retry) { if (UpdateManager.IsUpdateAvailable(section.Uri, section.Username, section.Password, section.Domain)) { continue; } flag6 = false; } else { flag2 = false; flag6 = false; flag3 = false; flag5 = false; log.Debug("Run App Cancelled 2."); } break; } if (flag6) { flag5 = false; log.Debug("Calling Update Manager..."); UpdateManager.Update(); num--; if (UpdateManager.UserCancelled) { flag2 = false; log.Debug("Run App Cancelled 3."); flag4 = true; } else { if (UpdateManager.UserError) { flag5 = true; } if (flag5 || UpdateManager.IsUpdateAvailable(section.Uri, section.Username, section.Password, section.Domain)) { goto Label_01D3; } } } } } goto Label_04FF; Label_03C1: log.Debug("Application is up-to-date."); goto Label_04FF; Label_03D2: log.Debug("Automatic updates are disabled."); } finally { if (UpdateManager._UpdateNotifier != null) { Form form = UpdateManager._UpdateNotifier.GetForm(); if (form != null) { form.Close(); } } log.Debug("Main - Finally."); if (flag2) { log.Debug("Main - Start App."); string[] parameters = null; if (DDText.getText(0x17) == "XX") { parameters = new string[] { "-InstallerVersion", "", "", "st" }; } else { parameters = new string[] { "-InstallerVersion", "", "" }; } parameters[1] = SelfUpdater.CurrentBuildVersion.ToString(); parameters[2] = DDText.getText(0); UpdateManager.SetCommandLineParameters(parameters); UpdateManager.StartApplication(); } if (flag3 || flag5) { MessageBox.Show(tm(), DDText.getText(0x10), DDText.getText(13)); } if (flag4) { MessageBox.Show(tm(), DDText.getText(0x11), DDText.getText(13)); } } Label_04FF: log.Debug("Exiting bootstrap application..."); Application.Exit(); } }
public void Update() { _updateManager.Update(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { AppState.Current.Window = this; ScriptEngine.Create(); AppEvents.InvokeStartup(); #pragma warning disable CS4014 // This call is executed on an another thread entirely, the await is thus not needed. new Thread(() => VersionChecker.CheckVersion(false, true, (s) => this.Dispatcher.Invoke(() => UpdateManager.Update(s)))).Start(); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed if (!string.IsNullOrEmpty(this.OldWindowSaveData)) { AppState.Current.Load(this.OldWindowSaveData, out _); this.OldWindowSaveData = null; } else { // opening a new empty window AppState.Current.Save(); AppState.Current.ResetDefaultSaveFile(); } this.Language_English.IsChecked = Settings.Default.Language.Equals("en-US"); this.Language_Russian.IsChecked = Settings.Default.Language.Equals("ru-RU"); this.Skin_Default.IsChecked = Settings.Default.Skin == 0; this.Skin_Bright.IsChecked = Settings.Default.Skin == 1; this.Skin_Dark.IsChecked = Settings.Default.Skin == 2; this.Skin_Soft.IsChecked = Settings.Default.Skin == 3; this.CB_Autoupdate.IsChecked = Settings.Default.AutoUpdate; this.CB_PromptUpdates.IsChecked = !Settings.Default.HideUpdateNotification; }
static void Main(string[] args) { FileStream fs = new FileStream("service-update.log", FileMode.Create, FileAccess.Write); StreamWriter sw = new StreamWriter(fs); try { Queue <string> argList = new Queue <string>(args); // Get the name of the service that is being updated string serviceName = argList.Dequeue(); // The path of the current service executable string oldServicePath = argList.Dequeue(); // Uri is required Uri uri = new Uri(argList.Dequeue()); // Other information is not required string username = argList.Count > 0 ? argList.Dequeue() : null; string password = argList.Count > 0 ? argList.Dequeue() : null; string domain = argList.Count > 0 ? argList.Dequeue() : null; if (UpdateManager.IsUpdateAvailable(uri, username, password, domain)) { sw.WriteLine("Update is available, beginning update process..."); // Perform the update, which performs the following steps: // 1. Updates to a new version of the application // 2. Saves new deployment and application manifests locally // 3. Removes previous versions of the application (depending on configuration settings) UpdateManager.Update(); sw.WriteLine("Update complete."); // Load the application manifest from the update sw.WriteLine("Loading new application manifest..."); ApplicationManifest appManifest = UpdateManager.GetCurrentApplicationManifest(); if (appManifest != null && appManifest.EntryPoint != null) { string workingDir = Path.Combine( UpdateManager.VersionRepositoryFolder, appManifest.AssemblyIdentity.Version.ToString() ); string servicePath = Path.Combine(workingDir, appManifest.EntryPoint.CommandLine.File); // Stop the service, and all dependent services sw.WriteLine("Stopping service '" + serviceName + "'..."); ServiceManager.Stop(serviceName, true); sw.WriteLine("Service stopped."); sw.WriteLine("Uninstalling previous service..."); ServiceManager.Uninstall(Assembly.LoadFile(oldServicePath)); sw.WriteLine("Service uninstalled."); // Install the new service sw.WriteLine("Installing service at '" + servicePath + "'..."); ServiceManager.Install(Assembly.LoadFile(servicePath)); sw.WriteLine("Service installed."); // Start the service, and all dependent services sw.WriteLine("Starting service '" + serviceName + "'..."); ServiceManager.Start(serviceName, true); sw.WriteLine("Service started."); } else { sw.WriteLine("Could not get an application manifest for the new version of the service."); } } else { sw.WriteLine("Application is up-to-date."); } } finally { sw.Flush(); sw.Close(); } }
private void Update() { mng.Update(); }
public void Update() { updateManager.Update(); playerManager.Update(); }
public async Task Update() { var installUri = new Uri(Path.Combine(_testInstallFolder, "Test App 01")); await _manager.Load(); await Assert.ThrowsExceptionAsync <ArgumentNullException>(async() => await _manager.Update(null, installUri, CancellationToken.None)); await Assert.ThrowsExceptionAsync <ArgumentNullException>(async() => await _manager.Update(_manager.Applications.First().Packages.First(), null, CancellationToken.None)); await ValidateUpdate(_manager, Guid.Parse("02902554-4D3D-4159-B106-41E0AC158733"), installUri); await ValidateUpdate(_manager, Guid.Parse("61038014-97C6-418A-9262-94D78DB167E8"), installUri); }