/// <summary> /// Installs the updates by calling the updater app and shutting down this application. /// </summary> /// <exception cref="ArgumentNullException"></exception> private void LaunchUpdaterApp(List <GitHubFileInfo> updates) { if (updates.IsNull()) { throw new ArgumentNullException(nameof(updates)); } if (updates.Count == 0) { this.OnUpToDate(); return; } if (!this.OnUpdatesAvailable($"{updates.Count} updates found.{Environment.NewLine}Proceed with download?")) { return; } try { var instructions = this.MakeLocalCopies(updates); // OperationFailedException. var server = new UpdaterServer(); if (!server.Run("UpdaterApp.exe", instructions)) { this.OnFailed($"Updater error: {server.LastErrorMessage}."); return; } App.Current.Shutdown(); } catch (OperationFailedException e) { var message = e.InnerException.IsNull() ? e.Message : e.InnerException.Message; this.OnFailed($"Updater error: {message}."); } }
public static void RunServerWithClientUpdater(IAppConfigBiz appConfigBiz, IFeedBusiness feedBusiness, IFeedItemBusiness feedItemBusiness, IUpdaterDurationBusiness updaterDurationBusiness) { Mn.NewsCms.Common.EventsLog.GeneralLogs.WriteLogInDB("RunServerWithClientUpdater", TypeOfLog.Start); var baseserver = new BaseServer(appConfigBiz, feedBusiness, feedItemBusiness, updaterDurationBusiness); var Clientupdater = new ClientUpdater(baseserver, feedBusiness, appConfigBiz, true); IRobotClient <BaseUpdaterClient> client = new RobotClient <BaseUpdaterClient>() { EndPoint = Clientupdater }; var server = new UpdaterServer <BaseUpdaterClient>(client, true); server.UpdateIsParting(); Clientupdater.AutoUpdateFromServer(); }
public static void RunUpdaterServer() { #region RemoteUpdater var remoteUpdater = RobotClient <string> .DefaultDistributeHostUrl; if (!string.IsNullOrEmpty(remoteUpdater) && !string.IsNullOrEmpty(Utility.GetWebText(remoteUpdater[remoteUpdater.Length - 1] == '/' ? remoteUpdater.Remove(remoteUpdater.Length - 1) : remoteUpdater))) { GeneralLogs.WriteLogInDB("GetWebText from " + remoteUpdater, TypeOfLog.Info); IRobotClient <string> client = new RobotClient <string>() { EndPoint = remoteUpdater }; var server = new UpdaterServer <string>(client, null); server.UpdateIsParting(); } else { GeneralLogs.WriteLogInDB("Can not GetWebText from " + remoteUpdater, TypeOfLog.Error); } #endregion }