/// <summary> /// get the update /// </summary> private void getUpdate() { bool _retVal = true; foreach (UpdateObject _appEntry in this.UpdatableObjects) { if (!_appEntry.performUpdate(this.OwnApplicationName)) { _retVal = false; } } Thread.Sleep(200); if (_retVal) { UpdateStateChanged.Invoke(this, new UpdateStateChangedEventArgs { stateMsg = "Download done", state = 0 }); } else { UpdateStateChanged.Invoke(this, new UpdateStateChangedEventArgs { stateMsg = "Download done with error", state = 2 }); } }
/// <summary> /// get the update /// </summary> private void getUpdate() { this.UpdatableObject.performUpdate(); UpdateStateChanged.Invoke(this, new UpdateStateChangedEventArgs { stateMsg = "Download done. Saved under: " + UpdatableObject.PathShortener(UpdatableObject.DownloadFileName), state = 0 }); }
internal static async Task <bool> CheckPrepareUpdate(Version version) { if (!await CheckUpdate(version)) { return(false); } if (String.IsNullOrEmpty(_patcherUri) || String.IsNullOrEmpty(_patcherSignUri)) { return(false); } try { if (IsUpdateBinaryExisted() || Directory.Exists(App.LocalUpdateStorePath)) { // files are already downloaded. return(true); } try { Directory.CreateDirectory(App.LocalUpdateStorePath); using (var http = new HttpClient()) { var patcher = await http.GetByteArrayAsync(_patcherUri); var patcherSign = await http.GetByteArrayAsync(_patcherSignUri); var pubkey = File.ReadAllText(App.PublicKeyFile); if (!VerifySignature(patcher, patcherSign, pubkey)) { throw new Exception("Updater signature is invalid."); } File.WriteAllBytes(ExecutablePath, patcher); } UpdateStateChanged?.Invoke(); return(true); } catch { try { Directory.Delete(App.LocalUpdateStorePath, true); } catch { // ignored } throw; } } catch (Exception ex) { BackstageModel.RegisterEvent(new OperationFailedEvent( SubsystemResources.FailedPrepareUpdate, ex)); return(false); } }
/// <summary> /// Function to get the update information for the current /// </summary> /// <returns></returns> private void getVersions() { UpdateStateChanged.Invoke(this, new UpdateStateChangedEventArgs { stateMsg = "Check for updates: " + this.UpdatableObject.ApplicationName, state = 1 }); this.UpdatableObject.compareFiles(); Thread.Sleep(200); UpdateStateChanged.Invoke(this, new UpdateStateChangedEventArgs { stateMsg = "Check for updates done", state = 0 }); }
/// <summary> /// Function to get the update information for the current /// </summary> /// <returns></returns> private void getVersions() { foreach (UpdateObject _appEntry in this.UpdatableObjects) { UpdateStateChanged.Invoke(this, new UpdateStateChangedEventArgs { stateMsg = "Check for updates: " + _appEntry.ApplicationName, state = 1 }); _appEntry.compareFiles(); } Thread.Sleep(200); UpdateStateChanged.Invoke(this, new UpdateStateChangedEventArgs { stateMsg = "Check for updates done", state = 0 }); }
private void OnUpdateStateChanged(UpdateState state, bool manualCheck) { UpdateStateChanged?.Invoke(this, new UpdateStateChangedEventArgs(state, manualCheck)); }
public void OnStateChanged(UpdateStateContract e) { Action action = () => UpdateStateChanged?.Invoke(this, e); Application.Current?.Dispatcher?.BeginInvoke(action, null); }
private void OnUpdateStateChanged(UpdateState state, bool manualCheck) { var eventArgs = new UpdateStateChangedEventArgs(state, manualCheck); UpdateStateChanged?.Invoke(this, eventArgs); }