/// <summary> /// Executes the task using the specified script execution environment. /// </summary> /// <remarks>This method implements the basic reporting and error handling for /// classes which inherit the <see cref="TaskBase"/> class.</remarks> /// <param name="environment">The script execution environment.</param> public void Execute(IScriptExecutionEnvironment environment) { if (environment == null) { throw new ArgumentNullException("environment"); } environment.LogTaskStarted(this.TaskDescription); // when in dry run do not execute the task (unless it itself indicates that it is safe) if (false == environment.DryRun || IsSafeToExecuteInDryRun) { DoExecute(environment); } environment.LogTaskFinished(); }