public void Dispose() { if (FileContent != null) { var fileName = FileContent is FileStream ? ((FileStream)FileContent).Name : ""; try { FileContent.Dispose(); FileContent = null; } catch { } if (!string.IsNullOrWhiteSpace(fileName) && File.Exists(fileName)) { try { File.Delete(fileName); DeleteSuccess?.Invoke(this, fileName); } catch (Exception e) { DeleteFailed?.Invoke(this, fileName, e); } } else { DeleteSkipped?.Invoke(this, fileName); } } }
internal void OnDeleteFailed(object sender, DeletionArgs args) { RemoveActiveDeletion(args.FilePath); ErrorMessages.Add(string.Format("Deleting {0} failed: {1}", args.FilePath, args.Exception.Message)); if (DeleteFailed != null) { DeleteFailed.Invoke(sender, args); } //if (Monitor != null) // Monitor.DeleteFailed(this, args); }
/// <summary> /// Called when [delete failed]. /// </summary> protected void OnDeleteFailed() { DeleteFailed?.Invoke(this, EventArgs.Empty); }
internal void OnDeleteFailed() { Log.Warning($"Server {this.ID:00} Delete Failed."); DeleteFailed.Invoke(this, null); }