mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 10:00:40 +00:00
Add context chooser to main window for choosing between remote servers
This commit is contained in:
@@ -41,6 +41,30 @@ namespace renderdocui.Code
|
||||
{
|
||||
public string Hostname = "";
|
||||
public string RunCommand = "";
|
||||
|
||||
[XmlIgnore]
|
||||
public bool ServerRunning = false;
|
||||
|
||||
public void Launch()
|
||||
{
|
||||
try
|
||||
{
|
||||
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo("cmd.exe");
|
||||
startInfo.CreateNoWindow = true;
|
||||
startInfo.UseShellExecute = false;
|
||||
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
|
||||
startInfo.Arguments = "/C " + RunCommand;
|
||||
System.Diagnostics.Process cmd = System.Diagnostics.Process.Start(startInfo);
|
||||
|
||||
// wait up to 2s for the command to exit
|
||||
cmd.WaitForExit(2000);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
MessageBox.Show(String.Format("Error running command to launch remote server:\n{0}", RunCommand),
|
||||
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
@@ -209,6 +233,25 @@ namespace renderdocui.Code
|
||||
}
|
||||
}
|
||||
|
||||
// localhost should always be available
|
||||
bool foundLocalhost = false;
|
||||
|
||||
for (int i = 0; i < c.RemoteHosts.Count; i++)
|
||||
{
|
||||
if (c.RemoteHosts[i].Hostname == "localhost")
|
||||
{
|
||||
foundLocalhost = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundLocalhost)
|
||||
{
|
||||
RemoteHost host = new RemoteHost();
|
||||
host.Hostname = "localhost";
|
||||
c.RemoteHosts.Add(host);
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user