我正在尝试找到一种方法来读取压缩文件的内容/文件名,解压缩文件,然后创建一个包含所有解压缩文件列表的文本文件。
其中大部分都不是问题,但事实证明读取和使用存档中的文件比应有的困难。
我目前的代码是...
var options = new Options();
ICommandLineParser parser = new CommandLineParser();
string strInput = "", strOutput = "", strExtract = "", strPassword = "";
Console.WriteLine("parsing..");
if (parser.ParseArguments(args, options))
{
Console.WriteLine("checking...");
if (string.IsNullOrEmpty(options.InputFile))
{
Console.WriteLine("input is empty");
Console.WriteLine(options.GetUsage());
}
strInput = options.InputFile;
strOutput = options.OutputFile;
strExtract = options.ExtractFormat;
strPassword = options.Password;
ProcessStartInfo p = new ProcessStartInfo();
p.FileName = "7za.exe";
Console.WriteLine("x " + "-" + strExtract + " -p" + strPassword + " " + strInput + " -o" + strOutput);
p.Arguments = "x " + "-" + strExtract + " -p" + strPassword + " " + strInput + " -o" + strOutput;
p.WindowStyle = ProcessWindowStyle.Hidden;
Process x = Process.Start(p);
x.WaitForExit();
我找到了一些可以提供帮助的资源,但到目前为止都没有。找到的资源:http: //pastebin.com/eTRE4TPP(我不明白他们如何使用未声明的变量“l”,但即使将其更改为“p”也不起作用 。http://www.dotnetperls.com/ 7-zip-examples(命令 l 看起来可以使用,但我不知道如何获取文件名并存储它们)
任何帮助将不胜感激。
谢谢