I'm trying to find a way to read the contents/ file names of a zipped file, unzip the files and then create a text file with a list of all the files unzipped.
Most of that isn't a problem but reading and using the files in an archive is proving to be harder than it should be.
My current code is ...
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();
I have found a few resources to help but none have worked so far. Resources found: http://pastebin.com/eTRE4TPP (I dont understand how they are using an undeclared variable, "l", but even changing that to "p" it doesnt work. http://www.dotnetperls.com/7-zip-examples (Command l looks like it could be used but I dont see how I can take the file names and store them)
Any help would be greatly appreciated.
Thanks