Crap. I forgot to test :(
This commit is contained in:
parent
8d74174eb0
commit
fab5f2c816
@ -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}\""
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user