Merge pull request #23 from That-One-Nerd/more-compression-options

Unfortunate.
This commit is contained in:
That_One_Nerd 2023-03-17 10:17:11 -04:00 committed by GitHub
commit b89a076a14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@
[Module("compress")]
public static class CompressionModule
{
[Command("zip")]
public static void CompressZip(string source, string? destination = null,
CompressionLevel level = CompressionLevel.Optimal)
{
@ -75,19 +76,19 @@ public static class CompressionModule
{
action = delegate
{
if (!File.Exists(absDest))
if (!File.Exists(destination))
{
Write("Looks like the job is already completed Boss.", ConsoleColor.DarkYellow);
return;
}
FileInfo info = new(absDest);
FileInfo info = new(destination);
if ((info.LastWriteTime - stamp).TotalMilliseconds >= 10)
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}\""
});
}
}