/// <summary> /// Performs a directory creation. /// </summary> /// <param name="fileSystem">The file system.</param> /// <param name="sourceDirectory">The source directory.</param> /// <param name="targetDirectory">The target directory.</param> /// <param name="execute">if set to true, the operation gets executed.</param> private void PerformDirectoryCreationOperation(IFileSystem fileSystem, IDirectoryInfo sourceDirectory, IDirectoryInfo targetDirectory, bool execute) { var eventArgs = new DirectoryCreationEventArgs(sourceDirectory, targetDirectory); this.OnCreatingDirectory(eventArgs); if (execute) { try { fileSystem.CreateDirectory(sourceDirectory, targetDirectory); this.OnCreatedDirectory(eventArgs); } catch (AccessException) { this.excludedPaths.Add(NormalizePath(targetDirectory.FullName)); this.OnDirectoryCreationError(new DirectoryCreationEventArgs(sourceDirectory, targetDirectory)); } } }
/// <summary> /// Raises the <see cref="DirectoryCreationError"/> event. /// </summary> /// <param name="e">The <see cref="FlagSync.Core.DirectoryCreationEventArgs"/> instance containing the event data.</param> protected virtual void OnDirectoryCreationError(DirectoryCreationEventArgs e) { this.DirectoryCreationError.RaiseSafe(this, e); }
/// <summary> /// Raises the <see cref="CreatingDirectory"/> event. /// </summary> /// <param name="e">The <see cref="FlagSync.Core.DirectoryCreationEventArgs"/> instance containing the event data.</param> protected virtual void OnCreatingDirectory(DirectoryCreationEventArgs e) { this.CreatingDirectory.RaiseSafe(this, e); }
/// <summary> /// Handles the CreatedDirectory event of the currentJob control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="FlagSync.Core.DirectoryCreationEventArgs"/> instance containing the event data.</param> private void currentJob_CreatedDirectory(object sender, DirectoryCreationEventArgs e) { this.CreatedDirectory.RaiseSafe(this, e); }
/// <summary> /// Handles the DirectoryCreationError event of the currentJob control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="FlagSync.Core.DirectoryCreationEventArgs"/> instance containing the event data.</param> private void currentJob_DirectoryCreationError(object sender, DirectoryCreationEventArgs e) { this.DirectoryCreationError.RaiseSafe(this, e); }
/// <summary> /// Raises the <see cref="CreatedDirectory"/> event. /// </summary> /// <param name="e">The <see cref="FlagSync.Core.DirectoryCreationEventArgs"/> instance containing the event data.</param> protected virtual void OnCreatedDirectory(DirectoryCreationEventArgs e) { this.CreatedDirectory.RaiseSafe(this, e); }