public override void Undo() { if (DidCommandSucceed) { FileSystemCommandsStrategy.FileDelete(TargetZipfilename); } }
private bool targetFileExists() { if (FileSystemCommandsStrategy.FileExists(TargetZipfilename)) { SendReport($"Did not run {ExeLocation} because output file {TargetZipfilename} already exists", ReportType.DoneTaskWithFailure); DidCommandSucceed = false; return(true); } return(false); }
private bool allSourcesExist() { foreach (var source in SourcesToZip) { if (!FileSystemCommandsStrategy.FileExists(source) && !FileSystemCommandsStrategy.DirectoryExists(source)) { SendReport($"Did not run {ExeLocation} because source file/folder {source} does not exist", ReportType.DoneTaskWithFailure); DidCommandSucceed = false; return(false); } } return(true); }
public override bool PreFlightCheck() { if (!FileSystemCommandsStrategy.FileExists(ExeLocation)) { SendReport($"{ShortName} will FAIL because executable {ExeLocation} was not found", ReportType.DonePreFlightWithFailure); return(false); } if (FileSystemCommandsStrategy.FileExists(TargetZipfilename)) { SendReport($"{ShortName} will likely FAIL because target {TargetZipfilename} already exists", ReportType.DonePreFlightWithFailure); return(false); } foreach (var source in SourcesToZip) { if (!FileSystemCommandsStrategy.FileExists(source) && !FileSystemCommandsStrategy.DirectoryExists(source)) { SendReport($"{ShortName} is likely to FAIL because source {source} does not exist", ReportType.DonePreFlightWithFailure); return(false); } } return(DefaultPreFlightCheckSuccess()); }