Unfortunate. #23

Merged
That-One-Nerd merged 2 commits from more-compression-options into main 2023-03-17 10:17:11 -04:00

View File

@ -3,6 +3,7 @@
[Module("compress")] [Module("compress")]
public static class CompressionModule public static class CompressionModule
{ {
[Command("zip")]
public static void CompressZip(string source, string? destination = null, public static void CompressZip(string source, string? destination = null,
CompressionLevel level = CompressionLevel.Optimal) CompressionLevel level = CompressionLevel.Optimal)
{ {
@ -75,19 +76,19 @@ public static class CompressionModule
{ {
action = delegate action = delegate
{ {
if (!File.Exists(absDest)) if (!File.Exists(destination))
{ {
Write("Looks like the job is already completed Boss.", ConsoleColor.DarkYellow); Write("Looks like the job is already completed Boss.", ConsoleColor.DarkYellow);
return; return;
} }
FileInfo info = new(absDest); FileInfo info = new(destination);
if ((info.LastWriteTime - stamp).TotalMilliseconds >= 10) if ((info.LastWriteTime - stamp).TotalMilliseconds >= 10)
throw new("The archive has been modified and probably shouldn't be undone."); throw new("The archive has been modified and probably shouldn't be undone.");
File.Delete(absDest); File.Delete(destination);
}, },
name = $"Compressed a file or folder into a {type} archive located at \"{destination}\"" name = $"Compressed a file or folder into a zip archive located at \"{destination}\""
}); });
} }
} }