private void fctCheckUpdate(object x) { if (CmdCheckUpdate.CanExecute(x)) { AppUpdater.CheckForUpdates(false); } }
private bool InstallablePackageExists() { using (var updater = new AppUpdater()) { return(updater.InstallablePackageExists()); } }
private async void InitializeVersionService() { // Handle New version found AppUpdater.CheckVersionsCompleted += (sender, args) => { if (args.AskToDownloadHandled || args.TargetSubscriberType != null) { return; } if (args.HasNewVersionAvailable) { ViewManager.ShowWindow <UpdateMenuView>(); UpdateMenuString = "There's an update available!"; } args.AskToDownloadHandled = true; }; // Check for new versions try { await AppUpdater.CheckVersions(); } catch (WebException ex) { WindowLog.Error("SERVER_DOWN", "App"); } }
private void CheckForUpdate() { if (_appUpdate == null) { _appUpdate = new AppUpdater(); //_appUpdate.Load += _appUpdate.Update_Load; } else if (_appUpdate.IsGetUpdateInfoRunning) { return; } lblStatus.Text = Language.strUpdateCheckingLabel; lblStatus.ForeColor = SystemColors.WindowText; lblLatestVersionLabel.Visible = false; lblInstalledVersion.Visible = false; lblInstalledVersionLabel.Visible = false; lblLatestVersion.Visible = false; btnCheckForUpdate.Visible = false; pnlUpdate.Visible = false; _appUpdate.GetUpdateInfoCompletedEvent += GetUpdateInfoCompleted; _appUpdate.GetUpdateInfoAsync(); }
public void CheckForUpdate() { if (_appUpdate == null) { _appUpdate = new AppUpdater(); } else if (_appUpdate.IsGetUpdateInfoRunning) { return; } var nextUpdateCheck = Convert.ToDateTime(Settings.Default.CheckForUpdatesLastCheck.Add( TimeSpan .FromDays(Convert.ToDouble(Settings .Default .CheckForUpdatesFrequencyDays)))); if (!Settings.Default.UpdatePending && DateTime.UtcNow < nextUpdateCheck) { return; } _appUpdate.GetUpdateInfoCompletedEvent += GetUpdateInfoCompleted; _appUpdate.GetUpdateInfoAsync(); }
private void InitializeUpdatableStuff() { DataUpdater.Initialize(); DataUpdater.Instance.Updated += OnDataUpdated; if (AcRootDirectory.Instance.IsFirstRun) { AppUpdater.OnFirstRun(); } AppUpdater.Initialize(); AppUpdater.Instance.Updated += OnAppUpdated; if (LocaleHelper.JustUpdated) { Toast.Show(AppStrings.App_LocaleUpdated, string.Format(AppStrings.App_DataUpdated_Details, LocaleHelper.LoadedVersion)); } LocaleUpdater.Initialize(LocaleHelper.LoadedVersion); LocaleUpdater.Instance.Updated += OnLocaleUpdated; if (PatchHelper.OptionPatchSupport) { PatchUpdater.Initialize(); PatchUpdater.Instance.Updated += OnPatchUpdated; } }
private IPreparedUpdate PrepareUpdate(AppUpdater updater, IExtendedFileSystem fileSystem, IPackage package) { if (package == null) { throw new ArgumentNullException("package"); } if (package.Version < updater.CurrentVersion) { throw new BackwardUpdateException(updater.CurrentVersion, package.Version); } var prepDirectory = Path.Combine(fileSystem.AppDirectory, ".updates", package.Version.ToString()); var preparedFiles = new List <string>(); foreach (var packageFile in package.GetFiles("tools")) { var targetPath = Path.Combine(prepDirectory, Get(packageFile.Path, relativeTo: "app")); fileSystem.AddFile(targetPath, packageFile.GetStream()); preparedFiles.Add(targetPath); } return(new PreparedUpdate(package.Version, preparedFiles)); }
private async void CheckUpdates() { try { var httpApplicationInfoLoader = new HttpApplicationInfoLoader(); using (var appUpdater = new AppUpdater(httpApplicationInfoLoader)) { await appUpdater.InitializeAsync(); var appInfo = appUpdater.CheckIsUpdateAvailable(ProgramInfo.AssemblyGuid, Assembly.GetExecutingAssembly().Location, out bool isUpdateAvailable); IsUpdateAvailable = isUpdateAvailable; if (IsUpdateAvailable) { UpdateApplicationInfo = appInfo; var mainWindowViewModel = Current.MainWindow?.DataContext as MainWindowViewModel; mainWindowViewModel?.ShowUpdateView(); } } } catch (Exception e) { LogProvider.Log.Error(this, "Updates couldn't be checked.", e); } }
/// <summary> /// Action performed when CheckUpdates is called /// </summary> private async void CheckUpdatesAction() { CanCheckUpdates = false; try { //if (AppUpdater.IsUpdatePackageAvailable()) // AppUpdater.InstallLatestVersion(); //else if (AppUpdater.IsUpdateAvailable) // await AppUpdater.DownloadLatestVersion(); //else await AppUpdater.CheckVersions(typeof(UpdateMenuViewModel)); OnUpdateView?.Invoke(this); Changelog = AppUpdater.ToString(); } catch (WebException) { System.Windows.Forms.MessageBox.Show("Could not reach server! Please try again later", "Could not reach server", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } CanCheckUpdates = true; }
private async void OnStartUp() { this.StartLocalProxy(); loginButton.Enabled = false; await AppUpdater.RunUpdater(); Authenticate(); }
private static void MainInner(string[] args) { if (AppUpdater.OnStartup(args)) { return; } if (args.Length == 2 && args[0] == "--run") { Process.Start(args[1]); return; } var appGuid = ((GuidAttribute)Assembly.GetEntryAssembly().GetCustomAttributes(typeof(GuidAttribute), true).GetValue(0)).Value; var mutexId = $@"Global\{{{appGuid}}}"; if (Array.IndexOf(args, WindowsHelper.RestartArg) != -1) { for (var i = 0; i < 999; i++) { Thread.Sleep(200); using (var mutex = new Mutex(false, mutexId)) { if (mutex.WaitOne(0, false)) { break; } } } ProcessExtension.Start(MainExecutingFile.Location, args.Where(x => x != WindowsHelper.RestartArg)); return; } using (var mutex = new Mutex(false, mutexId)) { _secondInstanceMessage = User32.RegisterWindowMessage(mutexId); if (mutex.WaitOne(0, false)) { if (AppUpdater.OnUniqueStartup(args)) { return; } _initialized = true; App.CreateAndRun(false); /*if (args.Length == 0) { * TryToRunAppSafely(); * } else { * App.CreateAndRun(false); * }*/ } else { PassArgsToRunningInstance(args); } } }
public void DoCheckUpdates() { DoShow(); AppUpdater.UpdateCheck(new UpdaterState() { IsDialog = true }); }
void AndGivenAnAppUpdater() { var builder = new AppUpdaterBuilder(TestConstants.AppPackageId) .SetupWithTestValues(_installedVersion); _fileSystem = builder.GetMockFileSystem(); _appUpdater = builder.Build(); }
public async virtual void InitializeAsync() { var appLoader = new HttpApplicationInfoLoader(); try { if (IsAppRunning()) { await Task.Delay(5000); if (IsAppRunning()) { StatusMessage = Resources.Error_ManyApps; return; } } using (var appUpdater = new AppUpdater(appLoader)) { appUpdater.OperationChanged += OnOperationChanged; appUpdater.ProgressChanged += OnProgressChanged; appUpdater.UnzippingFileChanged += OnUnzippingFileChanged; appUpdater.CopyingFileChanged += OnCopyingFileChanged; await appUpdater.InitializeAsync(); if (!appUpdater.CheckIsUpdateAvailable(DriveHUDUpdaterPaths.MainApplicationGuid, DriveHUDUpdaterPaths.MainApplicationProccess)) { StatusMessage = Resources.Error_NoUpdate; return; } var unpackedDirectory = await appUpdater.UpdateApplicationAsync(DriveHUDUpdaterPaths.MainApplicationGuid, DriveHUDUpdaterPaths.MainApplicationProccess, true); StatusMessage = Resources.Message_Operation_Completed; var installerPath = Path.Combine(unpackedDirectory.FullName, DriveHUDUpdaterPaths.MainApplicationInstaller); RunApplication(installerPath); } } catch (UpdaterException ex) { HandleUpdaterError(ex); } catch (FileNotFoundException) { StatusMessage = Resources.Error_AssemblyNotFound; } catch { StatusMessage = Resources.Error_Unexpected; } }
/// <summary> /// Handles OnDownloadCompleted /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="AsyncCompletedEventArgs"/> instance containing the event data.</param> /// <exception cref="System.NotImplementedException"></exception> private void AppUpdaterOnDownloadCompleted(object sender, AsyncCompletedEventArgs e) { if (Properties.Settings.Default.UpdateMode == 1 && MessageBox.Show("An update has been downloaded", "Question", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { AppUpdater.InstallLatestVersion(); } else if (Properties.Settings.Default.UpdateMode == 2) { AppUpdater.InstallLatestVersion(); } }
private async void RunUpdater() { IsBusy = true; var appLoader = new HttpApplicationInfoLoader(); try { using (var appUpdater = new AppUpdater(appLoader)) { appUpdater.OperationChanged += OnOperationChanged; appUpdater.ProgressChanged += OnProgressChanged; appUpdater.UnzippingFileChanged += OnProcessingFileChanged; appUpdater.CopyingFileChanged += OnProcessingFileChanged; await appUpdater.InitializeAsync(); var applicationPath = Assembly.GetExecutingAssembly().Location; var guid = ProgramInfo.AssemblyGuid; if (!appUpdater.CheckIsUpdateAvailable(guid, applicationPath)) { StatusMessage = CommonResourceManager.Instance.GetResourceString("Error_NoUpdate"); return; } var unpackedDirectory = await appUpdater.UpdateApplicationAsync(guid, applicationPath, true); StatusMessage = CommonResourceManager.Instance.GetResourceString("Common_UpdateView_Completed"); var installerName = CommonResourceManager.Instance.GetResourceString("SystemSettings_Installer"); var installerPath = Path.Combine(unpackedDirectory.FullName, installerName); RunApplication(installerPath); } } catch (UpdaterException ex) { HandleUpdaterError(ex); } catch (FileNotFoundException) { StatusMessage = CommonResourceManager.Instance.GetResourceString("Error_AssemblyNotFound"); } catch (Exception e) { LogProvider.Log.Error(this, "Could not update app.", e); StatusMessage = CommonResourceManager.Instance.GetResourceString("Error_Unexpected"); } IsBusy = false; }
/// <summary> /// Конструктор без параметров. /// </summary> public MainFormVm() { // Получить расположение программы. appPath = Environment.CurrentDirectory.Replace(@"Updater", ""); // Получить расположение файла обновления. string updateFilePath = $@"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\Update.zip"; // Инициализировать объект установки. Updater = new AppUpdater(updateFilePath, appPath); // Запустить установку асинхронно. StartUpdateAsync(); }
public virtual ActionResult Start(string param) { var status = Mn.NewsCms.Common.Updater.BaseUpdater.UpdatersIsRun(); if (!status.HasFlag(UpdaterList.UpdaterClient)) { GeneralLogs.WriteLog("status != UpdaterList.UpdaterClient", TypeOfLog.Info); AppUpdater.RunServerWithClientUpdater(_appConfigBiz, _feedBusiness, _feedItemBusiness, _updaterDurationBusiness); } //AppUpdater.RunServerWithClientUpdater(); return(View()); }
public static void RegisterServices(IGUIToolkit guiToolkit, IMultimediaToolkit multimediaToolkit) { App.Current.DependencyRegistry.Register <ITimer, Timer> (1); App.Current.DependencyRegistry.Register <IStorageManager, CouchbaseManagerLongoMatch> (1); App.Current.DependencyRegistry.Register <IFileStorage, LMFileStorage> (1); App.Current.MultimediaToolkit = multimediaToolkit; App.Current.GUIToolkit = guiToolkit; App.Current.EventsBroker = new EventsBroker(); App.Current.EventsBroker.Subscribe <QuitApplicationEvent> (HandleQuitApplicationEvent); RegisterService(App.Current.LicenseLimitationsService); /* Start DB services */ dbManager = new DataBaseManager(); RegisterService(dbManager); ts = new TemplatesService(); RegisterService(ts); /* Start the rendering jobs manager */ jobsManagerVM = new JobsManagerVM { Model = new RangeObservableCollection <Job> () }; App.Current.JobsManager = jobsManagerVM; RenderingJobsController jobsController = new RenderingJobsController(jobsManagerVM); RegisterService(jobsController); /* State the tools manager */ toolsManager = new ToolsManager(); RegisterService(toolsManager); ProjectsImporter = toolsManager; /* Start the hotkeys manager */ hkManager = new HotKeysManager(); RegisterService(hkManager); App.Current.HotkeysService = new HotkeysService(); RegisterService(App.Current.HotkeysService); GeneralUIHotkeys.RegisterDefaultHotkeys(); PlaybackHotkeys.RegisterDefaultHotkeys(); DrawingToolHotkeys.RegisterDefaultHotkeys(); LMGeneralUIHotkeys.RegisterDefaultHotkeys(); #if DEVEL AppUpdater notifier = new AppUpdater("Fluendo", "http://sparkle.fluendo.lan:8080/longomatch.xml"); #else AppUpdater notifier = new AppUpdater("Fluendo", "https://s3.amazonaws.com/oneplay-files/longomatch.xml"); #endif RegisterService(notifier); }
//[OutputCache(Duration = 100)] public virtual ActionResult Start(string pass) { if (pass != "777") { ViewBag.UpdaterStatus = "Password incorrect!"; return(View()); } var subc = new TimeSpan(0, 10, 0); if (HttpContext.Application["LastStartDateTime"] == null || DateTime.Parse(HttpContext.Application["LastStartDateTime"].ToString()).AddMinutes(10) < DateTime.Now) { HttpContext.Application["LastStartDateTime"] = DateTime.Now; if (DateTime.Now.NowHour() > _appConfigBiz.GetConfig <int>("StartNightly") && DateTime.Now.NowHour() < _appConfigBiz.GetConfig <int>("EndNightly")) { //-----Nightly----- LuceneBase.TodayItemsCount = 0; ViewBag.UpdaterStatus = "Nightly"; } else { try { //-------Daily---- Mn.NewsCms.Common.EventsLog.GeneralLogs.WriteLog("-----Start Updater Ping----", TypeOfLog.Start); var status = Mn.NewsCms.Common.Updater.BaseUpdater.UpdatersIsRun(); if (!status.HasFlag(UpdaterList.UpdaterClient)) { Mn.NewsCms.Common.EventsLog.GeneralLogs.WriteLog("status != UpdaterList.UpdaterClient", TypeOfLog.Info); AppUpdater.RunServerWithClientUpdater(_appConfigBiz, _feedBusiness, _feedItemBusiness, _updaterDurationBusiness); ViewBag.UpdaterStatus = "Now Start"; } else { ViewBag.UpdaterStatus = "Is Running..."; } } catch (Exception ex) { GeneralLogs.WriteLogInDB("UpdaterController " + ex.Message, TypeOfLog.Error); } } } else { ViewBag.UpdaterStatus = "Is Running"; } return(View()); }
private void CheckForAnnouncement() { if (_appUpdate == null) { _appUpdate = new AppUpdater(); } else if (_appUpdate.IsGetAnnouncementInfoRunning) { return; } _appUpdate.GetAnnouncementInfoCompletedEvent += GetAnnouncementInfoCompleted; _appUpdate.GetAnnouncementInfoAsync(); }
/// <summary> /// Initializes this instance. /// </summary> private void Initialize() { if (AppUpdater.IsUpdatePackageAvailable()) { ActionButtonText = "Install update!"; } else if (AppUpdater.IsUpdateAvailable) { ActionButtonText = "Update!"; } else { ActionButtonText = "Check now!"; } }
/// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { this.InitializeComponent(); this.Suspending += OnSuspending; var resources = new ResourceLoader("config"); var baseUri = resources.GetString("BASE_URL"); var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; localSettings.Values["BASE_URI"] = baseUri; IAppUpdater updater = new AppUpdater(); this.MandatoryUpdate = updater.IsMandatoryUpdateAvailableFlagSet(); }
private void InitializeUpdatableStuff() { DataUpdater.Initialize(); DataUpdater.Instance.Updated += DataUpdater_Updated; AppUpdater.Initialize(); AppUpdater.Instance.Updated += AppUpdater_Updated; if (LocaleHelper.JustUpdated) { Toast.Show(AppStrings.App_LocaleUpdated, string.Format(AppStrings.App_DataUpdated_Details, LocaleHelper.LoadedVersion)); } LocaleUpdater.Initialize(LocaleHelper.LoadedVersion); LocaleUpdater.Instance.Updated += LocaleUpdater_Updated; }
private void init() { if (Options.CheckUpdateAtStartup) { AppUpdater.CheckForUpdates(true, dra => { bool is3DRunning = this.Is3DActive; if (is3DRunning) { this.Dispatcher.Invoke(() => { this.Is3DActive = false; this.isAboutOpened = true; }); } dra?.Invoke(); if (is3DRunning) { this.Dispatcher.Invoke(() => { this.isAboutOpened = false; if (App.Current != null) { this.Is3DActive = true; } }); } }); } if (!Options.HideAboutOnStartup) { AboutWindow.Instance.ShowDialog(); } this.keyboardHook = new GlobalKeyboardHook(); this.keyboardHook.KeyDown += KeyboardHook_KeyDown; this.cursorSbS = new CursorSbS(); this.backgroundWindow = new BackgroundWindow(); this.Is3DActive = true; this.threadUpdateWindows = new Thread(asyncUpdateWindows); this.threadUpdateWindows.IsBackground = true; this.threadUpdateWindows.Start(); }
/// <summary> /// Initializes a new instance of the <see cref="UpdateMenuViewModel"/> class. /// </summary> public UpdateMenuViewModel() { CanCheckUpdates = true; Changelog = AppUpdater.LatestVersion != null?AppUpdater.ToString() : ""; LastCheckDate = Properties.Settings.Default.LastVersionCheck; UpdateModeIndex = Properties.Settings.Default.UpdateMode; CheckPeriodIndex = Properties.Settings.Default.AutomaticCheckPeriod; // Initializes everything related to this VM Initialize(); // Initialize all commands InitializeCommands(); // Initialize update service InitializeUpdateService(); }
public void DownloadLatestVersion_WhenApkIsDownloaded_CallApkInstall() { _githubRelease.TagName = _newerTag; var updateSupportMock = new Mock <IUpdateSupport>(); var downloadManagerMock = new Mock <IDownloadManager>(); updateSupportMock.Setup(us => us.CheckIfApkIsDownloaded()).Returns(true); updateSupportMock.Setup(us => us.ApkInstall()).Verifiable(); downloadManagerMock.Setup(dm => dm.Start(It.IsAny <IDownloadFile>(), true)).Verifiable(); AppUpdater testAppUpdater = new AppUpdater(updateSupportMock.Object, downloadManagerMock.Object); testAppUpdater.UpdateApp(_githubRelease); updateSupportMock.Verify(us => us.ApkInstall()); downloadManagerMock.Verify(dm => dm.Start(It.IsAny <IDownloadFile>(), true), Times.Never); }
public static void MainInner(string[] args) { if (AppUpdater.OnStartup(args)) { return; } var appGuid = ((GuidAttribute)Assembly.GetEntryAssembly().GetCustomAttributes(typeof(GuidAttribute), true).GetValue(0)).Value; var mutexId = $@"Global\{{{appGuid}}}"; if (args.Contains(WindowsHelper.RestartArg)) { for (var i = 0; i < 999; i++) { Thread.Sleep(200); using (var mutex = new Mutex(false, mutexId)) { if (mutex.WaitOne(0, false)) { break; } } } ProcessExtension.Start(MainExecutingFile.Location, args.Where(x => x != WindowsHelper.RestartArg)); return; } using (var mutex = new Mutex(false, mutexId)) { SecondInstanceMessage = User32.RegisterWindowMessage(mutexId); if (mutex.WaitOne(0, false)) { _initialized = true; App.CreateAndRun(); } else { PassArgsToRunningInstance(args); } } }
private async void OnAppStartup(object sender, StartupEventArgs e) { LogManager logManager = new LogManager(); logManager.SetupLogger(); InstanceSettings.GetInstance().SetLogManager(logManager); Console.WriteLine("app/adapter started"); Console.WriteLine("for more about what has happened in this app, see logs/log.txt"); Log.Information("PS4KMA v{0} started", VersionUtil.GetVersionWithBuildDate()); // cause not having a cursor is a pain in the ass Utility.ShowCursor(true); ApplicationSettings.Load(); UserSettings.LoadPrevious(); AppUpdater appUpdater = new AppUpdater(); await appUpdater.UpdateIfAvailable(); }
private void btnTestProxy_Click(object sender, EventArgs e) { if (_appUpdate != null) { if (_appUpdate.IsGetUpdateInfoRunning) { return; } } _appUpdate = new AppUpdater(); //_appUpdate.Load += _appUpdate.Update_Load; _appUpdate.SetProxySettings(chkUseProxyForAutomaticUpdates.Checked, txtProxyAddress.Text, (int)numProxyPort.Value, chkUseProxyAuthentication.Checked, txtProxyUsername.Text, txtProxyPassword.Text); btnTestProxy.Enabled = false; btnTestProxy.Text = Language.strOptionsProxyTesting; _appUpdate.GetUpdateInfoCompletedEvent += GetUpdateInfoCompleted; _appUpdate.GetUpdateInfoAsync(); }
void AndGivenAnAppUpdater() { _appUpdater = _builder.Build(); }
void GivenAnAppUpdater() { _appUpdater = new AppUpdaterBuilder(TestConstants.AppPackageId) .SetupWithTestValues(new Version(1, 0)) .Build(); }
private void FrmUpdate_Load(object sender, System.EventArgs e) { string currentDirectory =Environment.CurrentDirectory ; if(!AppConst.GetConfig()) { MessageBox.Show("配置文件读取失败!请确定配置文件放在"+currentDirectory+"该目录下"); return; } panel2.Visible = false; btnFinish.Visible = false; string localXmlFile = currentDirectory + "\\UpdateList.xml"; string serverXmlFile = string.Empty; try { //从本地读取更新配置文件信息 updaterXmlFiles = new XmlFiles(localXmlFile ); } catch { MessageBox.Show("配置文件出错!","错误",MessageBoxButtons.OK,MessageBoxIcon.Error); this.Close(); return; } //获取服务器地址 updateUrl = updaterXmlFiles.GetNodeValue("//Url"); AppUpdater appUpdater = new AppUpdater(); appUpdater.UpdaterUrl = updateUrl + "/UpdateList.xml" + url_postfix; //与服务器连接,下载更新配置文件 try { //临时更新文件目录 tempUpdatePath = currentDirectory+"\\"+AppConst.TempFilePath; appUpdater.DownAutoUpdateFile(tempUpdatePath); } catch { MessageBox.Show("与服务器连接失败,操作超时!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information); this.Close(); return; } //获取更新文件列表 htUpdateFile = new Hashtable(); serverXmlFile = tempUpdatePath + "\\UpdateList.xml"; if(!File.Exists(serverXmlFile)) { return; } availableUpdate = appUpdater.CheckForUpdate(serverXmlFile,localXmlFile,out htUpdateFile); if (availableUpdate > 0) { for(int i=0;i<htUpdateFile.Count;i++) { string [] fileArray =(string []) htUpdateFile[i]; lvUpdateList.Items.Add(new ListViewItem(fileArray)); } } }
void WhenAnAppUpdaterIsCreated() { _appUpdater = _builder.Build(); }
void AndGivenAnAppUpdater() { _appUpdater = new AppUpdaterBuilder(TestConstants.AppPackageId) .SetupWithTestValues(_installedVersion) .Build(); }