Hej, I was having the very same problem today. So here to all those searching for an answer and hitting this site (I suppose as you posted the question in 2014 you'll have no use for this information any more) here is how I got around the problem:
The core to this is that 7-Zip uses different streams to write to the output and C# only gets one of them. But you can force 7-Zip to use only one stream by using the command-line arguments
-bsp1 -bse1 -bso1
in addition to what else you need. Then just capture the percentage part like this:
private static void CreateZip(string path, string zipFilename, Action<int> onProgress) {
Regex REX_SevenZipStatus = new Regex(@"(?<p>[0-9]+)%");
Process p = new Process();
p.StartInfo.FileName = "7za.exe";
p.StartInfo.Arguments = string.Format("a -y -r -bsp1 -bse1 -bso1 {0} {1}",
zipFilename, path);
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.OutputDataReceived += (sender, e) => {
if (onProgress != null) {
Match m = REX_SevenZipStatus.Match(e.Data ?? "");
if (m != null && m.Success) {
int procent = int.Parse(m.Groups["p"].Value);
onProgress(procent);
}
}
};
p.Start();
p.BeginOutputReadLine();
p.WaitForExit();
}
This method compresses a folder into a 7-Zip file. You can use the onProgress parameter (called in another thread) to process the status - it will contain the percentage of the status.