public void BuildMod()
{
var startIngo = new ProcessStartInfo();
startIngo.WorkingDirectory = ModBuilderLoc;
startIngo.FileName = "ModPack Builder.exe";
startIngo.Arguments = "\"" +
LoadedMod.Directory.Substring(Folders.MyDocuments.Length + 28)
+ "\"" + " " + "true";
startIngo.WindowStyle = ProcessWindowStyle.Normal; //TODO: Set to hidden
//startIngo.UseShellExecute = false;
//startIngo.RedirectStandardOutput = true;
try
{
Process proc = new Process();
proc.StartInfo = startIngo;
proc.Start();
//proc.StandardOutput.ReadLine();
proc.WaitForExit();
MessageBox.Show("Build successful", "Build Info");
}
catch (Win32Exception)
{
MessageBox.Show("Could not find \"ModPack Builder.exe\" in \""
+ ModBuilderLoc +"\", change from menu bar");
}
}
这非常合适,除非我取消注释注释,这使得程序读取到程序控制台的第一行。
当注释被取消注释时,会捕获一个Win32异常,我 想要发生这种情况。