中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當前位置: 首頁 > news >正文

下載免費軟件哪個網(wǎng)站好百度提交入口的網(wǎng)址

下載免費軟件哪個網(wǎng)站好,百度提交入口的網(wǎng)址,網(wǎng)站建設公司賺錢,北京企業(yè)網(wǎng)站報價使用C#在Windows上調用7-zip壓縮文件 可以設置輸出文件的路徑也可以留空,留空則會在壓縮文件創(chuàng)建一個同名的.壓縮包 可以設置壓縮包的密碼 可以設置壓縮包的加密方式(ASE-256),可以使用LZMA但是加密碼會報錯 可以設置壓縮包的格式(zip),可以使用7z但是加…

使用C#在Windows上調用7-zip壓縮文件

可以設置輸出文件的路徑也可以留空,留空則會在壓縮文件創(chuàng)建一個同名的.壓縮包
可以設置壓縮包的密碼
可以設置壓縮包的加密方式(ASE-256),可以使用LZMA但是加密碼會報錯
可以設置壓縮包的格式(zip),可以使用7z但是加密碼會報錯
添加了密碼最大長度的限制(98個字符,7zip限制的)
在7-ZIP的圖形界面可以選擇7z格式壓縮可以輸入中文的密碼

 using System;
using System.Diagnostics;namespace 文件的壓縮
{internal class Program{private static void Main(string[] args){Console.WriteLine("你好,接下來開始壓縮文件");ZipsHelper.CompressedInformation compressedInformation = new ZipsHelper.CompressedInformation(@"E:\壓縮文件測試\壓縮文件_Orgion\V_1696602827.txt","","",ZipsHelper.CompressedFileType.Zip,ZipsHelper.CompressedPackageEncryptionMode.AES256);//壓縮  E:\壓縮文件測試\壓縮文件_Orgion\V1696602827.txt//到     E:\壓縮文件測試\壓縮文件_Orgion\V1696602827.zipZipsHelper.DoCompressedFile(compressedInformation);Console.ReadKey();}}/// <summary>/// zip文件壓縮/// </summary>public class ZipsHelper{/// <summary>/// 壓縮文件/// </summary>public static void DoCompressedFile(CompressedInformation compressedInformation){// 設置7-Zip可執(zhí)行文件的路徑,根據(jù)你的安裝路徑進行修改string sevenZipExePath = @"C:\Program Files\7-Zip\7z.exe";if (!System.IO.File.Exists(sevenZipExePath)){Console.WriteLine($"未能找到7z.exe ,請檢查路徑,當前路徑是:{sevenZipExePath}");return;}if (compressedInformation.Password.Length > 98){Console.WriteLine($"壓縮取消,密碼長度過長,最大長度是98,當前長度是:{compressedInformation.Password.Length}。");return;}string encryptionMethod;//壓縮包的加密方式if (compressedInformation.CompressedPackageEncryptionMode == CompressedPackageEncryptionMode.AES256){encryptionMethod = "-mem=AES256";}//else if (compressedInformation.CompressedPackageEncryptionMode == CompressedPackageEncryptionMode.LZMA)//{//encryptionMethod = "-mhe=on -m0=BCJ2 -m1=LZMA2 -m2=LZMA2 -m3=LZMA2 -mb0:1 -mb0s1:2 -mb0s2:3";//}else{encryptionMethod = "-mem=AES256";}string format;//設置壓縮包的格式if (compressedInformation.CompressedFileType == CompressedFileType.Zip){compressedInformation.CompressedFilePath += ".zip";//添加壓縮包的文件后綴format = "zip";}else{format = "7z";}string arguments;//壓縮的參數(shù)//構建7-Zip命令行參數(shù) if (compressedInformation.Password == "")//當選擇了壓縮的加密方式但是密碼為空的時候不能壓縮{arguments = $"a -t{format} \"{compressedInformation.CompressedFilePath}\" \"{compressedInformation.FilePathToCompress}\"";}else{arguments = $"a -t{format} \"{compressedInformation.CompressedFilePath}\" \"{compressedInformation.FilePathToCompress}\" {encryptionMethod} -p{compressedInformation.Password}";}Console.WriteLine(arguments);// 創(chuàng)建一個新的進程來運行7-ZipProcess process = new Process();process.StartInfo.FileName = sevenZipExePath;process.StartInfo.Arguments = arguments;process.StartInfo.UseShellExecute = false;process.StartInfo.RedirectStandardOutput = true;process.StartInfo.RedirectStandardError = true;process.StartInfo.CreateNoWindow = true;// 啟動7-Zip進程并等待其完成process.Start();process.WaitForExit();// 處理輸出結果string output = process.StandardOutput.ReadToEnd();string error = process.StandardError.ReadToEnd();if (string.IsNullOrEmpty(error)){Console.WriteLine("文件壓縮成功!");}else{Console.WriteLine("文件壓縮失敗,錯誤信息:" + error);}Console.WriteLine();Console.WriteLine();Console.WriteLine();Console.WriteLine();Console.WriteLine(output);}/// <summary>/// 壓縮包類型/// </summary>public enum CompressedFileType{Zip = 1,//  _7Z = 2}/// <summary>/// 壓縮包加密格式/// </summary>public enum CompressedPackageEncryptionMode{AES256,//  LZMA,}public class CompressedInformation{/// <summary>/// 壓縮文件路徑/// </summary>private string filePathToCompress;/// <summary>/// 輸出文件路徑/// </summary>private string compressedFilePath;/// <summary>/// 密碼/// </summary>private string password;/// <summary>/// 壓縮包類型/// </summary>private CompressedFileType compressedFileType;/// <summary>///  壓縮包加密格式/// </summary>private CompressedPackageEncryptionMode compressedPackageEncryptionMode;public string FilePathToCompress { get => filePathToCompress; set => filePathToCompress = value; }public string CompressedFilePath { get => compressedFilePath; set => compressedFilePath = value; }public string Password { get => password; set => password = value; }public CompressedFileType CompressedFileType { get => compressedFileType; set => compressedFileType = value; }public CompressedPackageEncryptionMode CompressedPackageEncryptionMode { get => compressedPackageEncryptionMode; set => compressedPackageEncryptionMode = value; }/// <summary>/// 壓縮命令參數(shù)/// </summary>/// <param name="filePathToCompress">壓縮文件路徑</param>/// <param name="compressedFilePath">壓縮包輸出路徑</param>/// <param name="password">密碼</param>/// <param name="compressedFileType">壓縮包格式</param>/// <param name="compressedPackageEncryptionMode">壓縮包加密方式</param>public CompressedInformation(string filePathToCompress,string compressedFilePath = "",string password = "",CompressedFileType compressedFileType = CompressedFileType.Zip,CompressedPackageEncryptionMode compressedPackageEncryptionMode = CompressedPackageEncryptionMode.AES256){this.FilePathToCompress = filePathToCompress;this.CompressedFilePath = compressedFilePath;this.Password = password;this.CompressedFileType = compressedFileType;this.CompressedPackageEncryptionMode = compressedPackageEncryptionMode;if (compressedFilePath == ""){GetFileNameAndExtension(filePathToCompress, out compressedFilePath);this.CompressedFilePath = compressedFilePath;}}public static void GetFileNameAndExtension(string filePath, out string pathWithoutExtension){pathWithoutExtension = System.IO.Path.ChangeExtension(filePath, null); // 去除文件后綴}}}}
http://www.risenshineclean.com/news/59029.html

相關文章:

  • 杭州網(wǎng)站建設案例網(wǎng)址查詢入口
  • 自制個人網(wǎng)站網(wǎng)站seo收錄工具
  • 獨立網(wǎng)站建設推廣有什么好方法
  • 學校建設網(wǎng)站的結論網(wǎng)站搜索優(yōu)化價格
  • 品牌網(wǎng)站建設磐石網(wǎng)絡優(yōu)等好搜搜索
  • 國內外公司網(wǎng)站差異安卓優(yōu)化大師hd
  • 網(wǎng)上購物有哪些網(wǎng)站?seo根據(jù)什么具體優(yōu)化
  • b2c電子商務網(wǎng)站源碼網(wǎng)絡推廣深圳有效渠道
  • 上海網(wǎng)站建設方法保定百度seo公司
  • 境外企業(yè)網(wǎng)站推廣網(wǎng)絡服務有限公司
  • 順德網(wǎng)站建設價格國家認可的教育培訓機構
  • 網(wǎng)頁策劃案什么是seo推廣
  • 簡單的j網(wǎng)站建設方案書磁力庫
  • 網(wǎng)站開發(fā)掙錢嗎百度學術官網(wǎng)入口
  • 網(wǎng)站制做正規(guī)的代運營公司
  • 重慶九龍坡營銷型網(wǎng)站建設公司推薦網(wǎng)絡營銷推廣8種方法
  • 網(wǎng)絡公司名字大全及寓意谷歌優(yōu)化方法
  • 二手車為什么做網(wǎng)站自助發(fā)外鏈網(wǎng)站
  • 電子商務網(wǎng)站建設分析和總結口碑營銷ppt
  • 怎么注銷網(wǎng)站枸櫞酸西地那非片功效效及作用
  • 南京市工程造價信息網(wǎng)搜索引擎優(yōu)化的簡稱是
  • 專業(yè)北京網(wǎng)站建設自己怎么做網(wǎng)站優(yōu)化
  • 一個人做網(wǎng)站必應搜索引擎國際版
  • 撫州招聘網(wǎng)站建設國際重大新聞事件10條
  • 網(wǎng)站吸引流量的方法seo推廣崗位職責
  • 怎么做郵箱網(wǎng)站平臺優(yōu)化
  • 西安專業(yè)網(wǎng)站建設網(wǎng)絡廣告投放方案
  • 微信公眾開放平臺寧波免費建站seo排名
  • 濟南建設主管部門網(wǎng)站企業(yè)網(wǎng)站推廣有哪些
  • java做教程網(wǎng)站太原seo推廣外包