Ejemplo n.º 1
0
        /// <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));
                }
            }
        }
Ejemplo n.º 2
0
        /// <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));
                }
            }
        }
Ejemplo n.º 3
0
 /// <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);
 }
Ejemplo n.º 4
0
 /// <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);
 }
Ejemplo n.º 5
0
 /// <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);
 }
Ejemplo n.º 6
0
 /// <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);
 }