private void fclsServerManager_Load(object sender, EventArgs e) { try { foreach (Process p in Process.GetProcessesByName("rdfServer")) { ProcessStartInfo info = p.StartInfo; ExternalProcessServerHarness server = new ExternalProcessServerHarness(info, p); this._servers.Add(server); } } catch { //Ignore exceptions here - just means we failed to enumerate relevant processes successfully } }
private void btnCreateAdvanced_Click(object sender, EventArgs e) { String path = Path.Combine(Environment.CurrentDirectory, "rdfServer.exe"); if (!File.Exists(path)) { MessageBox.Show("Unable to start an rdfServer instance as could not find rdfServer.exe"); } else { try { ProcessStartInfo info = new ProcessStartInfo(); info.FileName = path; info.Arguments = this.txtCreateAdvanced.Text; info.CreateNoWindow = true; info.RedirectStandardOutput = true; info.RedirectStandardError = true; info.UseShellExecute = false; IServerHarness harness = new ExternalProcessServerHarness(info); if (this.chkStartAutoAdvanced.Checked) { try { harness.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error Starting Server", MessageBoxButtons.OK, MessageBoxIcon.Error); } } this._servers.Add(harness); } catch (Exception ex) { MessageBox.Show("Unable to create an External Process Server due to the following error:\n" + ex.Message, "Error Creating Server", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }