Added a comment option for the command (#27)

This commit is contained in:
That_One_Nerd 2023-03-29 10:19:34 -04:00
parent b5cfa6f0cc
commit f95e3a89ff

View File

@ -5,7 +5,7 @@ public static class CompressionModule
{
[Command("zip")]
public static void CompressZip(string source, string? destination = null,
CompressionLevel level = CompressionLevel.Optimal)
CompressionLevel level = CompressionLevel.Optimal, string comment = "")
{
destination ??= Path.Combine(Path.GetDirectoryName(Path.GetFullPath(source))!,
$"{Path.GetFileNameWithoutExtension(source)}.zip");
@ -20,7 +20,10 @@ public static class CompressionModule
Write(message);
Stream writer = new FileStream(destination, FileMode.CreateNew);
ZipArchive archive = new(writer, ZipArchiveMode.Create);
ZipArchive archive = new(writer, ZipArchiveMode.Create)
{
Comment = comment
};
archive.CreateEntryFromFile(absSource, Path.GetFileName(absSource), level);