ARCed.Editor.AttachProcess C# (CSharp) Method

AttachProcess() public static method

Starts a process and attaches it to the editor.
All child processes will be killed automatically when Editor exits
public static AttachProcess ( string filename, bool hidden = false ) : void
filename string The path to the process
hidden bool Flag to start hidden or not
return void
        public static void AttachProcess(string filename, bool hidden = false)
        {
            var info = new ProcessStartInfo(filename);

            Process found = ChildProcesses.Find(p => p.StartInfo.FileName == filename);
            if (found != null && !hidden)
            {
                NativeMethods.SetForegroundWindow(found.MainWindowHandle);
                return;
            }
            info.UseShellExecute = false;
            info.RedirectStandardOutput = true;
            if (hidden)
            {
                info.CreateNoWindow = true;
                info.WindowStyle = ProcessWindowStyle.Hidden;
            }
            Process proc = Process.Start(info);
            ChildProcesses.Add(proc);
        }