/// <summary> /// Performs a file deletion. /// </summary> /// <param name="fileSystem">The file system.</param> /// <param name="file">The file to delete.</param> /// <param name="execute">if set to true, the operation gets executed.</param> private void PerformFileDeletionOperation(IFileSystem fileSystem, IFileInfo file, bool execute) { var eventArgs = new FileDeletionEventArgs(file.FullName, file.Length); this.OnDeletingFile(eventArgs); if (execute) { try { fileSystem.DeleteFile(file); this.OnDeletedFile(eventArgs); } catch (AccessException) { this.OnFileDeletionError(new FileDeletionErrorEventArgs(file)); } } }
/// <summary> /// Performs a file deletion. /// </summary> /// <param name="fileSystem">The file system.</param> /// <param name="file">The file to delete.</param> /// <param name="execute">if set to true, the operation gets executed.</param> private void PerformFileDeletionOperation(IFileSystem fileSystem, IFileInfo file, bool execute) { var eventArgs = new FileDeletionEventArgs(file.FullName, file.Length); this.OnDeletingFile(eventArgs); if (execute) { try { fileSystem.DeleteFile(file); this.OnDeletedFile(eventArgs); } catch (AccessException) { this.OnFileDeletionError(new FileDeletionErrorEventArgs(file)); } } }
/// <summary> /// Raises the <see cref="DeletingFile"/> event. /// </summary> /// <param name="e">The <see cref="FlagSync.Core.FileDeletionEventArgs"/> instance containing the event data.</param> protected virtual void OnDeletingFile(FileDeletionEventArgs e) { this.DeletingFile.RaiseSafe(this, e); }
/// <summary> /// Handles the DeletedFile event of the currentJob control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="FlagSync.Core.FileDeletionEventArgs"/> instance containing the event data.</param> private void currentJob_DeletedFile(object sender, FileDeletionEventArgs e) { this.DeletedFile.RaiseSafe(this, e); }
/// <summary> /// Handles the DeletedFile event of the currentJob control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="FlagSync.Core.FileDeletionEventArgs"/> instance containing the event data.</param> private void currentJob_DeletedFile(object sender, FileDeletionEventArgs e) { this.DeletedFile.RaiseSafe(this, e); }
/// <summary> /// Raises the <see cref="DeletedFile"/> event. /// </summary> /// <param name="e">The <see cref="FlagSync.Core.FileDeletionEventArgs"/> instance containing the event data.</param> protected virtual void OnDeletedFile(FileDeletionEventArgs e) { this.DeletedFile.RaiseSafe(this, e); }