Skip to content

Commit 928bea3

Browse files
committed
Update PacketViewModel.cs
1 parent 781d1bb commit 928bea3

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/WPF/GeneralUpdate.Packet/ViewModels/PacketViewModel.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using System.Text;
1111
using System.Windows;
1212
using Microsoft.WindowsAPICodePack.Dialogs;
13+
using GeneralUpdate.Zip;
1314

1415
namespace GeneralUpdate.Packet.ViewModels
1516
{
@@ -197,9 +198,15 @@ private async Task BuildPacketCallback()
197198

198199
try
199200
{
201+
// Copy all folders containing drivers in the root directory.
200202
CopyDirectory(DriverDir, TargetPath);
203+
204+
// Build patch package
201205
await DifferentialCore.Instance.Clean(SourcePath, TargetPath, PatchPath, (sender, args) => { },
202206
String2OperationType(CurrentFormat), String2Encoding(CurrentEncoding), PacketName);
207+
208+
await CreateZip();
209+
203210
if (IsPublish)
204211
{
205212
var packetPath = Path.Combine(TargetPath, $"{PacketName}{CurrentFormat}");
@@ -352,6 +359,16 @@ private void CopyDirectory(string sourceDir, string targetDir)
352359
}
353360
}
354361

362+
private async Task CreateZip()
363+
{
364+
new GeneralZipFactory()
365+
.CreateOperate(OperationType.GZip, packetName, sourcePath, targetPath)
366+
.CreateZip();
367+
368+
var path = Path.Combine(targetPath, packetName);
369+
await ShowMessage("Compression operation", File.Exists(path) ? $"{path} Created successfully." : $"{path} Creation failure!");
370+
}
371+
355372
#endregion Private Methods
356373
}
357374
}

0 commit comments

Comments
 (0)