Normal
Ok, have chopped out a lot....but you should get the idea. I need to call several EXE's in turn from a worker thread...but need to get each ones output.[code] strTemp = (string)FileNamesToBurn[i]; // If its an AVI then we need to convert to MPEG if (strTemp.EndsWith("avi") == true) { // Convert the AVI to MPG strTemp = strTemp.Substring(0, (strTemp.Length - 3)); strTemp = strTemp + "mpg"; ConvertProcess.StartInfo.FileName = BurnerFilesPath + "ffmpeg.exe"; ConvertProcess.StartInfo.Arguments = "-y -i \"" + FilePathsToBurn[i] + "\" -target pal-dvd \"" + strTempFolder + "\\" + strTemp + "\""; ConvertProcess.Start(); ConvertProcess.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(processOutputHandler); ConvertProcess.BeginOutputReadLine(); //while (ConvertProcess.HasExited == false) // ConvertProcess.BeginOutputReadLine(); //ConvertProcess.WaitForExit(); FileNamesToBurn[i] = strTemp; FilePathsToBurn[i] = strTempFolder + "\\" + strTemp; } if (strTemp.EndsWith("dvr-ms") == true) { // Then we need to convert the file to MPG //ConvertDvrMs() // To Do } // if (strTemp.EndsWith("mpg") == true) else { // Split the MPG into sepearate audio and video parts ConvertProcess.StartInfo.FileName = BurnerFilesPath + "mpgtx.exe"; ConvertProcess.StartInfo.Arguments = "-f -d \"" + FilePathsToBurn[i] + "\" -b \"" + strTempFolder + "\\" + FileNamesToBurn[i] + "\" "; ConvertProcess.Start(); ConvertProcess.WaitForExit(); // Merge them back together again but with "DVD" required bits ConvertProcess.StartInfo.FileName = BurnerFilesPath + "mplex.exe"; ConvertProcess.StartInfo.Arguments = "-f 8 -S 0 -M -V -o \"" + strTempFolder + "\\" + FileNamesToBurn[i] + "\" \"" + strTempFolder + "\\" + FileNamesToBurn[i] + "-0.m2v\" \"" + strTempFolder + "\\" + FileNamesToBurn[i] + "-0.mp2 \""; ConvertProcess.Start(); ConvertProcess.WaitForExit(); } // Make the DVD files using Config.xml ConvertProcess.StartInfo.FileName = BurnerFilesPath + "dvdauthor.exe"; ConvertProcess.StartInfo.Arguments = "-o " + strTempFolder + "\\DVD_Image -x " + strTempFolder + "\\Config.xml"; ConvertProcess.Start(); ConvertProcess.WaitForExit(); ConvertProcess.StartInfo.FileName = BurnerFilesPath + "dvdauthor.exe"; ConvertProcess.StartInfo.Arguments = "-o " + strTempFolder + "\\DVD_Image -T"; ConvertProcess.Start(); ConvertProcess.WaitForExit();[/code]
Ok, have chopped out a lot....but you should get the idea. I need to call several EXE's in turn from a worker thread...but need to get each ones output.
[code] strTemp = (string)FileNamesToBurn[i];
// If its an AVI then we need to convert to MPEG
if (strTemp.EndsWith("avi") == true)
{
// Convert the AVI to MPG
strTemp = strTemp.Substring(0, (strTemp.Length - 3));
strTemp = strTemp + "mpg";
ConvertProcess.StartInfo.FileName = BurnerFilesPath + "ffmpeg.exe";
ConvertProcess.StartInfo.Arguments = "-y -i \"" + FilePathsToBurn[i] + "\" -target pal-dvd \"" + strTempFolder + "\\" + strTemp + "\"";
ConvertProcess.Start();
ConvertProcess.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(processOutputHandler);
ConvertProcess.BeginOutputReadLine();
//while (ConvertProcess.HasExited == false)
// ConvertProcess.BeginOutputReadLine();
//ConvertProcess.WaitForExit();
FileNamesToBurn[i] = strTemp;
FilePathsToBurn[i] = strTempFolder + "\\" + strTemp;
}
if (strTemp.EndsWith("dvr-ms") == true)
// Then we need to convert the file to MPG
//ConvertDvrMs() // To Do
// if (strTemp.EndsWith("mpg") == true)
else
// Split the MPG into sepearate audio and video parts
ConvertProcess.StartInfo.FileName = BurnerFilesPath + "mpgtx.exe";
ConvertProcess.StartInfo.Arguments = "-f -d \"" + FilePathsToBurn[i] + "\" -b \"" + strTempFolder + "\\" + FileNamesToBurn[i] + "\" ";
ConvertProcess.WaitForExit();
// Merge them back together again but with "DVD" required bits
ConvertProcess.StartInfo.FileName = BurnerFilesPath + "mplex.exe";
ConvertProcess.StartInfo.Arguments = "-f 8 -S 0 -M -V -o \"" + strTempFolder + "\\" + FileNamesToBurn[i] + "\" \"" + strTempFolder + "\\" + FileNamesToBurn[i] + "-0.m2v\" \"" + strTempFolder + "\\" + FileNamesToBurn[i] + "-0.mp2 \"";
// Make the DVD files using Config.xml
ConvertProcess.StartInfo.FileName = BurnerFilesPath + "dvdauthor.exe";
ConvertProcess.StartInfo.Arguments = "-o " + strTempFolder + "\\DVD_Image -x " + strTempFolder + "\\Config.xml";
ConvertProcess.StartInfo.Arguments = "-o " + strTempFolder + "\\DVD_Image -T";
[/code]