我如何使用Sevenzipsharp这段代码?
iv尝试了许多不同的方法来使这个工作,我得到它基本工作,但我不能得到WaitForExit();像他们在这里一样工作......所以我如何将其转换为使用sevenzip?因为我无法让它工作,而且我的SFX是密码使得除了使用程序之外无法访问它们以及添加7z.DLL我无法添加它因为我收到错误:
无法添加对7za.dll的引用。请确保该文件是可访问的,并且它是有效的程序集或COM组件。
string tempFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
System.Diagnostics.Process defrag1 = System.Diagnostics.Process.Start(@"AusLogics_Defrag.exe", string.Format(" -o{0} -y -Pthisisthepass", tempFolder));
defrag1.WaitForExit();
string executableDirectoryName = Path.GetDirectoryName(Application.ExecutablePath);
System.Diagnostics.Process defrag2 = System.Diagnostics.Process.Start(tempFolder + "\" + "AusLogics_Defrag" + "\" + "DiskDefrag.exe", "");
defrag2.WaitForExit();
System.IO.Directory.Delete(tempFolder + "\" + "AusLogics_Defrag", true);
新:好吧这是我到目前为止,但我得到的错误“无法加载7-zip库或内部COM错误!消息:无法加载库”
SevenZipExtractor.SetLibraryPath("7z.dll"); //no idea of this is needed or not
SevenZipCompressor.SetLibraryPath("7z.dll"); //no idea of this is needed or not
string tempFolder = Environment.GerFolderPath(Environment.SpecialFolder.ApplicationData);
SevenZipExtractor defrag = new SevenZipExtractor(@"ProgramsOptimizeAuslogics_Defrag.7z");
defrag.ExtracArchive(string.Format("-o{0} -y -PThisisthepass", tempFolder));
没有找到相关结果
已邀请:
3 个回复
谷靛
孝铜差
的引用,而不是常规
或
。 由于您需要提供7zip dll,因此需要使用代码打包它们 - 这并不意味着您需要引用它们。 您可以向应用程序添加解决方案/项目文件夹,并在那里添加所需的dll。确保将“复制到构建目录”属性设置为“如果更新则复制”。
广躺椽