public void Stop() { if (_stderr != null) { _stderr.Stop(); _stderr = null; } if (_stdout != null) { _stdout.Stop(); _stdout = null; } if (_repl_process != null) { try { _repl_process.Kill(); } catch (InvalidOperationException) { } _repl_process.Close(); _repl_process.Dispose(); _repl_process = null; } this.Running = false; view.WriteOutput("Disconnected."); }
void StartInteractiveSession(string platform="AnyCPU") { string exe_name; switch (platform.ToLower()) { case "anycpu": exe_name = "CSharpReplServer.exe"; break; case "x86": exe_name = "CSharpReplServer32.exe"; break; case "x64": exe_name = "CSharpReplServer64.exe"; break; default: view.WriteOutput(String.Format("Cannot start interactive session for platform {0}. Platform not supported.", platform)); return; } string bin_dir = Path.GetDirectoryName(Assembly.GetAssembly(typeof(ReplPad)).Location); string repl_exe = Path.Combine(bin_dir, exe_name); //string framework_exe = @"C:\Program Files (x86)\Mono-2.10.9\bin\mono.exe"; //var start_info = new ProcessStartInfo(framework_exe, repl_exe + " 33333"); var start_info = new ProcessStartInfo(repl_exe,"33333"); start_info.UseShellExecute = false; start_info.CreateNoWindow = true; start_info.RedirectStandardError = true; start_info.RedirectStandardOutput = true; _repl_process = Process.Start(start_info); _stdout = new StreamOutputter(_repl_process.StandardOutput, view); _stderr = new StreamOutputter(_repl_process.StandardError, view); _stdout.Start(); _stderr.Start(); Thread.Sleep(1000); // Give _repl_process time to start up before we let anybody do anything with it }
public ReplSession(ReplView view, int port, Process proc = null) { replView = view; process = proc; this.port = port; if (proc != null) { stderr = new StreamOutputter (proc.StandardError, replView); stdout = new StreamOutputter (proc.StandardOutput, replView); Stderr.Start (); Stdout.Start (); } var tmprepl = new CSharpReplServerProxy (String.Format ("tcp://127.0.0.1:{0}", port)); tmprepl.Start (); repl = tmprepl; }