private void NotifyCommandFinished() { if (UpdateFinished != null) { UpdateFinished.Invoke(this, new EventArgs()); } }
private void FinishUpdate() { if (!_updating) { return; } int i = 0; // Key: original file name // Value: temp destination of downloaded file foreach (var kvp in _downloadDestinations) { // If the file we want to move to the current directory already exists, rename it to a tmp name if (File.Exists(kvp.Key)) { File.Move(kvp.Key, $"temp{i}.mbtemp"); i++; } string directoryPath = Path.GetDirectoryName(kvp.Key); if (!string.IsNullOrEmpty(directoryPath)) { Directory.CreateDirectory(Path.GetDirectoryName(kvp.Key)); } File.Move(kvp.Value, kvp.Key); } UpdateFinished?.Invoke(); }
/// <summary> /// Raised when file is modifiled. /// </summary> private void OnFileChanged() { // notify listeners UpdateStarted?.Invoke(); // load file IDataContainer changed = (IDataContainer)XmlHelper.DeserializeFromFile(_container.FilePath, _container.GetType()); // update properties if (changed != null) { if (CanAddItems) { _container.Merge(changed); } if (CanRemoveItems) { _container.InplaceIntersect(changed); } _container.Refresh(changed); } // notify listeners UpdateFinished?.Invoke(); }
private void CheckFilesFinished(object sender, RunWorkerCompletedEventArgs e) { if (corruptFiles.Count > 0) { ReportDownloadStatus(); fileUpdateWorker = new BackgroundWorker(); fileUpdateWorker.DoWork += UpdateFiles; fileUpdateWorker.RunWorkerCompleted += UpdateFilesFinished; fileUpdateWorker.RunWorkerAsync(); } else { StatusUpdate?.Invoke(Localization.GetText("GameUpdater.Status.Finished")); UpdateFinished?.Invoke(this, EventArgs.Empty); } }
private void UpdateFilesFinished(object sender, RunWorkerCompletedEventArgs e) { if (File.Exists("content.xml")) { File.Delete("content.xml"); } if (File.Exists("content.version")) { File.Delete("content.version"); } if (File.Exists("content.changes")) { File.Delete("content.changes"); } StatusUpdate?.Invoke(Localization.GetText("GameUpdater.Status.Finished")); UpdateFinished?.Invoke(this, EventArgs.Empty); }
private void OnUpdateFinished() { UpdateFinished?.Invoke(); }
protected virtual void OnUpdateFinished() { UpdateFinished?.Invoke(this, EventArgs.Empty); }