I have a "Main app" that runs an external process like this:
sortProcess = new Process();
sortProcess.StartInfo.FileName = "app.exe";
sortProcess.StartInfo.UseShellExecute = false;
sortProcess.StartInfo.RedirectStandardOutput = true;
sortProcess.StartInfo.RedirectStandardError = true;
sortProcess.OutputDataReceived += new DataReceivedEventHandler(SortOutputHandler);
sortProcess.ErrorDataReceived += new DataReceivedEventHandler(sortProcess_ErrorDataReceived);
sortProcess.Start();
sortProcess.BeginOutputReadLine();
sortProcess.BeginErrorReadLine();
sortProcess.WaitForExit();
sortProcess.Close();
The external process needs to be very simple to communicate to main app and multilingual, something console like, like this:
Console.WriteLine(@"started");
//do stuff
Console.WriteLine(@"something done");
//try to do more stuff
throw new System.InvalidOperationException("Logfile cannot be read-only");
//could do
Console.WriteLine(@"done without errors");
The app.exe has the Output type
as Windows Application
, how can I on the app.exe block the execution of the exe from any other place unless it's ran by my main app