diff --git a/PublishSite/PublishForm.cs b/PublishSite/PublishForm.cs index e18b0318..4193c831 100644 --- a/PublishSite/PublishForm.cs +++ b/PublishSite/PublishForm.cs @@ -25,6 +25,8 @@ using SharpCompress.Common; using System.IO.Compression; using MaterialSkin2DotNet.Controls; using MaterialSkin2DotNet; +using Renci.SshNet.Compression; +using SharpCompress.Archives; namespace PublishSite { @@ -1025,13 +1027,51 @@ namespace PublishSite try { - await Task.Run( () => - { + //await Task.Run( () => + //{ //将文件夹里的内容打包成压缩包 - ZipFile.CreateFromDirectory(localSourceFolder, filePath,CompressionLevel.Fastest,true); - - }); + //ZipFile.CreateFromDirectory(localSourceFolder, filePath,CompressionLevel.Fastest,true); + //Compress - Archive - Path "C:\Users\username\Documents\myfolder" - DestinationPath "C:\Users\username\Documents\myfolder.zip" - Force + + //var processStartInfo = new ProcessStartInfo + //{ + // FileName = "cmd.exe", + // RedirectStandardInput = true, + // UseShellExecute = false, + // CreateNoWindow = true + //}; + + //using (var process = new Process { StartInfo = processStartInfo }) + //{ + // process.Start(); + + // using (var writer = process.StandardInput) + // { + // if (writer.BaseStream.CanWrite) + // { + // // 执行命令:Compress-Archive -Path -DestinationPath -Force + + // var cmdCompress = $"Compress-Archive -Path \"{localSourceFolder}\" -DestinationPath \"{filePath}\" -Force"; + // writer.WriteLine(cmdCompress); + + // WinformLog(cmdCompress); + // writer.Close(); + // } + // } + + // process.WaitForExit(); + + // if (process.ExitCode != 0) + // { + // // 处理错误 + // } + //} + + + //}); + + WinformLog($"打包结束"); } catch (Exception ex) {