diff --git a/renderdocui/Code/PersistantConfig.cs b/renderdocui/Code/PersistantConfig.cs index d6e2591d8..c48fb0994 100644 --- a/renderdocui/Code/PersistantConfig.cs +++ b/renderdocui/Code/PersistantConfig.cs @@ -36,6 +36,13 @@ using System.Windows.Forms; namespace renderdocui.Code { + [Serializable] + public class RemoteHost + { + public string Hostname = ""; + public string RunCommand = ""; + } + [Serializable] public class PersistantConfig { @@ -52,16 +59,10 @@ namespace renderdocui.Code public bool TextureViewer_PerTexSettings = true; public bool ShaderViewer_FriendlyNaming = true; - public List RecentHosts = new List(); + public List RemoteHosts = new List(); public int LocalProxy = 0; - [XmlIgnore] // not directly serializable - public Dictionary ReplayHosts = new Dictionary(); - public List> ReplayHostKeyValues = new List>(); - - public List> PreviouslyUsedHosts = new List>(); - [XmlIgnore] // not directly serializable public Dictionary ConfigSettings = new Dictionary(); private List> ConfigSettingsValues = new List>(); @@ -175,10 +176,6 @@ namespace renderdocui.Code try { - ReplayHostKeyValues.Clear(); - foreach (var kv in ReplayHosts) - ReplayHostKeyValues.Add(new SerializableKeyValuePair(kv.Key, kv.Value)); - ConfigSettingsValues.Clear(); foreach (var kv in ConfigSettings) ConfigSettingsValues.Add(new SerializableKeyValuePair(kv.Key, kv.Value)); @@ -203,15 +200,6 @@ namespace renderdocui.Code PersistantConfig c = (PersistantConfig)xs.Deserialize(reader); reader.Close(); - foreach (var kv in c.ReplayHostKeyValues) - { - if (kv.Key != null && kv.Key.Length > 0 && - kv.Value != null) - { - c.ReplayHosts.Add(kv.Key, kv.Value); - } - } - foreach (var kv in c.ConfigSettingsValues) { if (kv.Key != null && kv.Key.Length > 0 && diff --git a/renderdocui/Code/RenderManager.cs b/renderdocui/Code/RenderManager.cs index e2c140a75..68f5b3e42 100644 --- a/renderdocui/Code/RenderManager.cs +++ b/renderdocui/Code/RenderManager.cs @@ -161,42 +161,16 @@ namespace renderdocui.Code //////////////////////////////////////////// // Internals - private void CreateReplayRenderer(ref ReplayRenderer renderer, ref RemoteServer remote) + private void CreateReplayRenderer(ref ReplayRenderer renderer) { - if (m_ProxyRenderer < 0) - { - renderer = StaticExports.CreateReplayRenderer(m_Logfile, ref LoadProgress); - return; - } - - remote = StaticExports.CreateRemoteReplayConnection(m_ReplayHost, 0); - - if(remote == null) - { - var e = new System.ApplicationException("Failed to connect to remote replay host"); - e.Data.Add("status", ReplayCreateStatus.UnknownError); - throw e; - } - - renderer = remote.OpenCapture(m_ProxyRenderer, m_Logfile, ref LoadProgress); - - if(renderer == null) - { - remote.Shutdown(); - - var e = new System.ApplicationException("Failed to connect to remote replay host"); - e.Data.Add("status", ReplayCreateStatus.UnknownError); - throw e; - } + renderer = StaticExports.CreateReplayRenderer(m_Logfile, ref LoadProgress); } private void RunThread() { try { - ReplayRenderer renderer = null; - RemoteServer remote = null; - CreateReplayRenderer(ref renderer, ref remote); + ReplayRenderer renderer = StaticExports.CreateReplayRenderer(m_Logfile, ref LoadProgress); if(renderer != null) { System.Diagnostics.Debug.WriteLine("Renderer created"); @@ -250,7 +224,6 @@ namespace renderdocui.Code } renderer.Shutdown(); - if (remote != null) remote.Shutdown(); } } catch (ApplicationException ex) diff --git a/renderdocui/Windows/Dialogs/RemoteHostSelect.Designer.cs b/renderdocui/Windows/Dialogs/RemoteHostSelect.Designer.cs deleted file mode 100644 index a1ce19610..000000000 --- a/renderdocui/Windows/Dialogs/RemoteHostSelect.Designer.cs +++ /dev/null @@ -1,165 +0,0 @@ -namespace renderdocui.Windows.Dialogs -{ - partial class RemoteHostSelect - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; - TreelistView.TreeListColumn treeListColumn1 = new TreelistView.TreeListColumn("Hostname", "Hostname"); - TreelistView.TreeListColumn treeListColumn2 = new TreelistView.TreeListColumn("API", "API"); - TreelistView.TreeListColumn treeListColumn3 = new TreelistView.TreeListColumn("User", "Connected User"); - this.hosts = new TreelistView.TreeListView(); - this.connect = new System.Windows.Forms.Button(); - this.addhost = new System.Windows.Forms.Button(); - this.hostname = new System.Windows.Forms.TextBox(); - this.refresh = new System.Windows.Forms.Button(); - tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - tableLayoutPanel1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.hosts)).BeginInit(); - this.SuspendLayout(); - // - // tableLayoutPanel1 - // - tableLayoutPanel1.ColumnCount = 4; - tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - tableLayoutPanel1.Controls.Add(this.hosts, 0, 0); - tableLayoutPanel1.Controls.Add(this.connect, 3, 1); - tableLayoutPanel1.Controls.Add(this.addhost, 1, 1); - tableLayoutPanel1.Controls.Add(this.hostname, 0, 1); - tableLayoutPanel1.Controls.Add(this.refresh, 2, 1); - tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); - tableLayoutPanel1.Name = "tableLayoutPanel1"; - tableLayoutPanel1.RowCount = 2; - tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - tableLayoutPanel1.Size = new System.Drawing.Size(488, 297); - tableLayoutPanel1.TabIndex = 2; - // - // hosts - // - this.hosts.AlwaysDisplayVScroll = true; - treeListColumn1.AutoSize = true; - treeListColumn1.AutoSizeMinSize = 15; - treeListColumn1.Width = 48; - treeListColumn2.AutoSizeMinSize = 15; - treeListColumn2.Width = 80; - treeListColumn3.AutoSizeMinSize = 15; - treeListColumn3.Width = 125; - this.hosts.Columns.AddRange(new TreelistView.TreeListColumn[] { - treeListColumn1, - treeListColumn2, - treeListColumn3}); - tableLayoutPanel1.SetColumnSpan(this.hosts, 4); - this.hosts.Cursor = System.Windows.Forms.Cursors.Arrow; - this.hosts.Dock = System.Windows.Forms.DockStyle.Fill; - this.hosts.Location = new System.Drawing.Point(3, 3); - this.hosts.MultiSelect = false; - this.hosts.Name = "hosts"; - this.hosts.RowOptions.ShowHeader = false; - this.hosts.Size = new System.Drawing.Size(482, 262); - this.hosts.TabIndex = 1; - this.hosts.ViewOptions.HoverHandTreeColumn = false; - this.hosts.ViewOptions.Indent = 12; - this.hosts.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.hosts_AfterSelect); - this.hosts.NodeDoubleClicked += new TreelistView.TreeListView.NodeDoubleClickedHandler(this.hosts_NodeDoubleClicked); - this.hosts.KeyDown += new System.Windows.Forms.KeyEventHandler(this.hosts_KeyDown); - // - // connect - // - this.connect.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.connect.Enabled = false; - this.connect.Location = new System.Drawing.Point(410, 271); - this.connect.Margin = new System.Windows.Forms.Padding(32, 3, 3, 3); - this.connect.Name = "connect"; - this.connect.Size = new System.Drawing.Size(75, 23); - this.connect.TabIndex = 5; - this.connect.Text = "Connect"; - this.connect.UseVisualStyleBackColor = true; - this.connect.Click += new System.EventHandler(this.connect_Click); - // - // addhost - // - this.addhost.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.addhost.Location = new System.Drawing.Point(219, 271); - this.addhost.Name = "addhost"; - this.addhost.Size = new System.Drawing.Size(75, 23); - this.addhost.TabIndex = 3; - this.addhost.Text = "Add Host"; - this.addhost.UseVisualStyleBackColor = true; - this.addhost.Click += new System.EventHandler(this.addhost_Click); - // - // hostname - // - this.hostname.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.hostname.Location = new System.Drawing.Point(3, 271); - this.hostname.Name = "hostname"; - this.hostname.Size = new System.Drawing.Size(210, 20); - this.hostname.TabIndex = 2; - this.hostname.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.hostname_KeyPress); - // - // refresh - // - this.refresh.Location = new System.Drawing.Point(300, 271); - this.refresh.Name = "refresh"; - this.refresh.Size = new System.Drawing.Size(75, 23); - this.refresh.TabIndex = 4; - this.refresh.Text = "Refresh"; - this.refresh.UseVisualStyleBackColor = true; - this.refresh.Click += new System.EventHandler(this.refresh_Click); - // - // RemoteHostSelect - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(488, 297); - this.Controls.Add(tableLayoutPanel1); - this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.Name = "RemoteHostSelect"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Attach to running instance"; - tableLayoutPanel1.ResumeLayout(false); - tableLayoutPanel1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.hosts)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private TreelistView.TreeListView hosts; - private System.Windows.Forms.Button connect; - private System.Windows.Forms.Button addhost; - private System.Windows.Forms.TextBox hostname; - private System.Windows.Forms.Button refresh; - } -} \ No newline at end of file diff --git a/renderdocui/Windows/Dialogs/RemoteHostSelect.resx b/renderdocui/Windows/Dialogs/RemoteHostSelect.resx deleted file mode 100644 index 9acfc2241..000000000 --- a/renderdocui/Windows/Dialogs/RemoteHostSelect.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - False - - \ No newline at end of file diff --git a/renderdocui/Windows/Dialogs/RemoteManager.Designer.cs b/renderdocui/Windows/Dialogs/RemoteManager.Designer.cs new file mode 100644 index 000000000..0210bf9da --- /dev/null +++ b/renderdocui/Windows/Dialogs/RemoteManager.Designer.cs @@ -0,0 +1,326 @@ +namespace renderdocui.Windows.Dialogs +{ + partial class RemoteManager + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + TreelistView.TreeListColumn treeListColumn3 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("hostname", "Hostname"))); + TreelistView.TreeListColumn treeListColumn4 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("running", "Running"))); + System.Windows.Forms.GroupBox basicConfigBox; + System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; + System.Windows.Forms.Label label1; + System.Windows.Forms.Label label2; + System.Windows.Forms.Label label3; + System.Windows.Forms.Label label4; + this.hosts = new TreelistView.TreeListView(); + this.connect = new System.Windows.Forms.Button(); + this.addhost = new System.Windows.Forms.Button(); + this.hostname = new System.Windows.Forms.TextBox(); + this.refresh = new System.Windows.Forms.Button(); + this.configure = new System.Windows.Forms.Button(); + this.configHostname = new System.Windows.Forms.TextBox(); + this.configRunCommand = new System.Windows.Forms.TextBox(); + this.setHostname = new System.Windows.Forms.Button(); + this.setRunCommand = new System.Windows.Forms.Button(); + tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + basicConfigBox = new System.Windows.Forms.GroupBox(); + tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); + label1 = new System.Windows.Forms.Label(); + label2 = new System.Windows.Forms.Label(); + label3 = new System.Windows.Forms.Label(); + label4 = new System.Windows.Forms.Label(); + tableLayoutPanel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.hosts)).BeginInit(); + basicConfigBox.SuspendLayout(); + tableLayoutPanel2.SuspendLayout(); + this.SuspendLayout(); + // + // tableLayoutPanel1 + // + tableLayoutPanel1.ColumnCount = 6; + tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + tableLayoutPanel1.Controls.Add(this.hosts, 0, 0); + tableLayoutPanel1.Controls.Add(this.connect, 5, 1); + tableLayoutPanel1.Controls.Add(this.addhost, 1, 1); + tableLayoutPanel1.Controls.Add(this.hostname, 0, 1); + tableLayoutPanel1.Controls.Add(this.refresh, 2, 1); + tableLayoutPanel1.Controls.Add(this.configure, 4, 1); + tableLayoutPanel1.Controls.Add(basicConfigBox, 0, 2); + tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + tableLayoutPanel1.Name = "tableLayoutPanel1"; + tableLayoutPanel1.RowCount = 3; + tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + tableLayoutPanel1.Size = new System.Drawing.Size(632, 438); + tableLayoutPanel1.TabIndex = 2; + // + // hosts + // + this.hosts.AlwaysDisplayVScroll = true; + treeListColumn3.AutoSize = true; + treeListColumn3.AutoSizeMinSize = 15; + treeListColumn3.Width = 48; + treeListColumn4.AutoSizeMinSize = 0; + treeListColumn4.Width = 250; + this.hosts.Columns.AddRange(new TreelistView.TreeListColumn[] { + treeListColumn3, + treeListColumn4}); + tableLayoutPanel1.SetColumnSpan(this.hosts, 6); + this.hosts.Cursor = System.Windows.Forms.Cursors.Arrow; + this.hosts.Dock = System.Windows.Forms.DockStyle.Fill; + this.hosts.Location = new System.Drawing.Point(3, 3); + this.hosts.MultiSelect = false; + this.hosts.Name = "hosts"; + this.hosts.RowOptions.ShowHeader = false; + this.hosts.Size = new System.Drawing.Size(626, 259); + this.hosts.TabIndex = 1; + this.hosts.ViewOptions.HoverHandTreeColumn = false; + this.hosts.ViewOptions.Indent = 12; + this.hosts.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.hosts_AfterSelect); + this.hosts.NodeDoubleClicked += new TreelistView.TreeListView.NodeDoubleClickedHandler(this.hosts_NodeDoubleClicked); + this.hosts.KeyDown += new System.Windows.Forms.KeyEventHandler(this.hosts_KeyDown); + // + // connect + // + this.connect.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.connect.Enabled = false; + this.connect.Location = new System.Drawing.Point(554, 268); + this.connect.Name = "connect"; + this.connect.Size = new System.Drawing.Size(75, 23); + this.connect.TabIndex = 5; + this.connect.Text = "Connect"; + this.connect.UseVisualStyleBackColor = true; + this.connect.Click += new System.EventHandler(this.connect_Click); + // + // addhost + // + this.addhost.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.addhost.Location = new System.Drawing.Point(291, 268); + this.addhost.Name = "addhost"; + this.addhost.Size = new System.Drawing.Size(75, 23); + this.addhost.TabIndex = 3; + this.addhost.Text = "Add Host"; + this.addhost.UseVisualStyleBackColor = true; + this.addhost.Click += new System.EventHandler(this.addhost_Click); + // + // hostname + // + this.hostname.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.hostname.Location = new System.Drawing.Point(3, 268); + this.hostname.Name = "hostname"; + this.hostname.Size = new System.Drawing.Size(282, 20); + this.hostname.TabIndex = 2; + this.hostname.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textbox_KeyPress); + // + // refresh + // + this.refresh.Location = new System.Drawing.Point(372, 268); + this.refresh.Name = "refresh"; + this.refresh.Size = new System.Drawing.Size(75, 23); + this.refresh.TabIndex = 4; + this.refresh.Text = "Refresh"; + this.refresh.UseVisualStyleBackColor = true; + this.refresh.Click += new System.EventHandler(this.refresh_Click); + // + // configure + // + this.configure.Location = new System.Drawing.Point(473, 268); + this.configure.Name = "configure"; + this.configure.Size = new System.Drawing.Size(75, 23); + this.configure.TabIndex = 6; + this.configure.Text = "Configure"; + this.configure.UseVisualStyleBackColor = true; + // + // basicConfigBox + // + basicConfigBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + tableLayoutPanel1.SetColumnSpan(basicConfigBox, 6); + basicConfigBox.Controls.Add(tableLayoutPanel2); + basicConfigBox.Location = new System.Drawing.Point(3, 297); + basicConfigBox.Name = "basicConfigBox"; + basicConfigBox.Size = new System.Drawing.Size(626, 138); + basicConfigBox.TabIndex = 7; + basicConfigBox.TabStop = false; + basicConfigBox.Text = "Basic configuration"; + // + // tableLayoutPanel2 + // + tableLayoutPanel2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + tableLayoutPanel2.AutoSize = true; + tableLayoutPanel2.ColumnCount = 3; + tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); + tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 80F)); + tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + tableLayoutPanel2.Controls.Add(label1, 0, 1); + tableLayoutPanel2.Controls.Add(this.configHostname, 1, 1); + tableLayoutPanel2.Controls.Add(this.configRunCommand, 1, 3); + tableLayoutPanel2.Controls.Add(label2, 0, 3); + tableLayoutPanel2.Controls.Add(label3, 1, 2); + tableLayoutPanel2.Controls.Add(label4, 1, 0); + tableLayoutPanel2.Controls.Add(this.setHostname, 2, 1); + tableLayoutPanel2.Controls.Add(this.setRunCommand, 2, 3); + tableLayoutPanel2.Location = new System.Drawing.Point(6, 19); + tableLayoutPanel2.Name = "tableLayoutPanel2"; + tableLayoutPanel2.RowCount = 4; + tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); + tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); + tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + tableLayoutPanel2.Size = new System.Drawing.Size(614, 112); + tableLayoutPanel2.TabIndex = 0; + // + // label1 + // + label1.Anchor = System.Windows.Forms.AnchorStyles.Right; + label1.AutoSize = true; + label1.Location = new System.Drawing.Point(53, 34); + label1.Name = "label1"; + label1.Size = new System.Drawing.Size(58, 13); + label1.TabIndex = 0; + label1.Text = "Hostname:"; + // + // configHostname + // + this.configHostname.Dock = System.Windows.Forms.DockStyle.Fill; + this.configHostname.Location = new System.Drawing.Point(117, 29); + this.configHostname.Name = "configHostname"; + this.configHostname.Size = new System.Drawing.Size(453, 20); + this.configHostname.TabIndex = 1; + this.configHostname.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textbox_KeyPress); + // + // configRunCommand + // + this.configRunCommand.Dock = System.Windows.Forms.DockStyle.Fill; + this.configRunCommand.Location = new System.Drawing.Point(117, 85); + this.configRunCommand.Name = "configRunCommand"; + this.configRunCommand.Size = new System.Drawing.Size(453, 20); + this.configRunCommand.TabIndex = 4; + this.configRunCommand.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textbox_KeyPress); + // + // label2 + // + label2.Anchor = System.Windows.Forms.AnchorStyles.Right; + label2.AutoSize = true; + label2.Location = new System.Drawing.Point(3, 90); + label2.Name = "label2"; + label2.Size = new System.Drawing.Size(108, 13); + label2.TabIndex = 2; + label2.Text = "Server run command:"; + // + // label3 + // + label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + label3.AutoSize = true; + label3.Location = new System.Drawing.Point(117, 66); + label3.Margin = new System.Windows.Forms.Padding(3, 10, 3, 3); + label3.Name = "label3"; + label3.Size = new System.Drawing.Size(413, 13); + label3.TabIndex = 3; + label3.Text = "This lets you configure a command to run that launches the remote server on this " + + "host."; + // + // label4 + // + label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + label4.AutoSize = true; + label4.Location = new System.Drawing.Point(117, 10); + label4.Margin = new System.Windows.Forms.Padding(3, 10, 3, 3); + label4.Name = "label4"; + label4.Size = new System.Drawing.Size(261, 13); + label4.TabIndex = 5; + label4.Text = "Configure the network hostname for this remote server"; + // + // setHostname + // + this.setHostname.Location = new System.Drawing.Point(576, 29); + this.setHostname.Name = "setHostname"; + this.setHostname.Size = new System.Drawing.Size(34, 23); + this.setHostname.TabIndex = 6; + this.setHostname.Text = "Set"; + this.setHostname.UseVisualStyleBackColor = true; + this.setHostname.Click += new System.EventHandler(this.setConfig_Click); + // + // setRunCommand + // + this.setRunCommand.Location = new System.Drawing.Point(576, 85); + this.setRunCommand.Name = "setRunCommand"; + this.setRunCommand.Size = new System.Drawing.Size(34, 23); + this.setRunCommand.TabIndex = 7; + this.setRunCommand.Text = "Set"; + this.setRunCommand.UseVisualStyleBackColor = true; + this.setRunCommand.Click += new System.EventHandler(this.setConfig_Click); + // + // RemoteManager + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(632, 438); + this.Controls.Add(tableLayoutPanel1); + this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "RemoteManager"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Remote manager"; + tableLayoutPanel1.ResumeLayout(false); + tableLayoutPanel1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.hosts)).EndInit(); + basicConfigBox.ResumeLayout(false); + basicConfigBox.PerformLayout(); + tableLayoutPanel2.ResumeLayout(false); + tableLayoutPanel2.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private TreelistView.TreeListView hosts; + private System.Windows.Forms.Button connect; + private System.Windows.Forms.Button addhost; + private System.Windows.Forms.TextBox hostname; + private System.Windows.Forms.Button refresh; + private System.Windows.Forms.Button configure; + private System.Windows.Forms.TextBox configHostname; + private System.Windows.Forms.TextBox configRunCommand; + private System.Windows.Forms.Button setHostname; + private System.Windows.Forms.Button setRunCommand; + } +} \ No newline at end of file diff --git a/renderdocui/Windows/Dialogs/RemoteHostSelect.cs b/renderdocui/Windows/Dialogs/RemoteManager.cs similarity index 50% rename from renderdocui/Windows/Dialogs/RemoteHostSelect.cs rename to renderdocui/Windows/Dialogs/RemoteManager.cs index 789084eef..fb4fc05cb 100644 --- a/renderdocui/Windows/Dialogs/RemoteHostSelect.cs +++ b/renderdocui/Windows/Dialogs/RemoteManager.cs @@ -29,6 +29,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; +using System.Diagnostics; using System.Linq; using System.Threading; using System.Text; @@ -40,7 +41,7 @@ namespace renderdocui.Windows.Dialogs { // this window lists the remote hosts the user has configured, and queries for any open connections // on any of them that indicate an application with renderdoc hooks that's running. - public partial class RemoteHostSelect : Form + public partial class RemoteManager : Form { MainWindow m_Main; Core m_Core; @@ -52,7 +53,30 @@ namespace renderdocui.Windows.Dialogs public UInt32 ident; }; - public RemoteHostSelect(Core core, MainWindow main) + private static string RemoteServerLiveText + { + get { return "Remote server running"; } + } + + private static string RemoteServerDeadText + { + get { return "No remote server"; } + } + + private static void SetRemoteServerLive(TreelistView.Node node, bool live) + { + node["running"] = live ? RemoteServerLiveText : RemoteServerDeadText; + node.Image = live + ? global::renderdocui.Properties.Resources.connect + : global::renderdocui.Properties.Resources.disconnect; + } + + private static bool IsRemoteServerLive(TreelistView.Node node) + { + return node["running"].ToString() == RemoteServerLiveText; + } + + public RemoteManager(Core core, MainWindow main) { InitializeComponent(); @@ -68,25 +92,39 @@ namespace renderdocui.Windows.Dialogs hosts.BeginInit(); // localhost should always be available - if (!m_Core.Config.RecentHosts.Contains("localhost")) - m_Core.Config.RecentHosts.Add("localhost"); + bool foundLocalhost = false; - foreach (var h in m_Core.Config.RecentHosts) + for (int i = 0; i < m_Core.Config.RemoteHosts.Count; i++) { - AddHost(h); + if (m_Core.Config.RemoteHosts[i].Hostname == "localhost") + { + foundLocalhost = true; + break; + } } + if (!foundLocalhost) + { + RemoteHost host = new RemoteHost(); + host.Hostname = "localhost"; + m_Core.Config.RemoteHosts.Add(host); + } + + foreach (var h in m_Core.Config.RemoteHosts) + AddHost(h); + hosts.EndInit(); } // we kick off a thread per host to query for any open connections. The // interfaces on the C++ side should be thread-safe to cope with this - private void AddHost(String host) + private void AddHost(RemoteHost host) { - TreelistView.Node node = new TreelistView.Node(new object[] { host, "" }); + TreelistView.Node node = new TreelistView.Node(new object[] { host.Hostname, "..." }); node.Italic = true; node.Image = global::renderdocui.Properties.Resources.hourglass; + node.Tag = host; hosts.Nodes.Add(node); @@ -99,6 +137,34 @@ namespace renderdocui.Windows.Dialogs private static int lookupsInProgress = 0; private static Mutex lookupMutex = new Mutex(); + private static void RunRemoteServer(object o) + { + TreelistView.Node node = o as TreelistView.Node; + RemoteHost host = node.Tag as RemoteHost; + + try + { + ProcessStartInfo startInfo = new ProcessStartInfo("cmd.exe"); + startInfo.CreateNoWindow = true; + startInfo.UseShellExecute = false; + startInfo.WindowStyle = ProcessWindowStyle.Hidden; + startInfo.Arguments = "/C " + host.RunCommand; + Process cmd = Process.Start(startInfo); + + // wait up to 2s for the command to exit + cmd.WaitForExit(2000); + + // now refresh this host + Thread th = Helpers.NewThread(new ParameterizedThreadStart(LookupHostConnections)); + th.Start(node); + } + catch (Exception) + { + MessageBox.Show(String.Format("Error running command to launch remote server:\n{0}", host.RunCommand), + "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + // this function looks up the remote connections and for each one open // queries it for the API, target (usually executable name) and if any user is already connected private static void LookupHostConnections(object o) @@ -115,12 +181,23 @@ namespace renderdocui.Windows.Dialogs while (p.Parent != null) p = p.Parent; - RemoteHostSelect rhs = p as RemoteHostSelect; + RemoteManager rhs = p as RemoteManager; - string hostname = node["Hostname"] as string; + string hostname = node["hostname"] as string; string username = System.Security.Principal.WindowsIdentity.GetCurrent().Name; + try + { + RemoteServer server = StaticExports.CreateRemoteServer(hostname, 0); + SetRemoteServerLive(node, true); + server.ShutdownConnection(); + } + catch (ApplicationException) + { + SetRemoteServerLive(node, false); + } + StaticExports.EnumerateRemoteTargets(hostname, (UInt32 i) => { try { @@ -132,10 +209,17 @@ namespace renderdocui.Windows.Dialogs string api = conn.API; string busy = conn.BusyClient; + string running; + + if (busy != "") + running = String.Format("Running {0}, {1} is connected", api, busy); + else + running = String.Format("Running {0}", api); + node.OwnerView.BeginInvoke((MethodInvoker)delegate { node.OwnerView.BeginUpdate(); - node.Nodes.Add(new TreelistView.Node(new object[] { target, api, busy })).Tag = new RemoteConnect(hostname, i); + node.Nodes.Add(new TreelistView.Node(new object[] { target, running })).Tag = new RemoteConnect(hostname, i); node.OwnerView.EndUpdate(); node.Expand(); }); @@ -154,7 +238,6 @@ namespace renderdocui.Windows.Dialogs { node.OwnerView.BeginUpdate(); node.Italic = false; - node.Image = null; node.OwnerView.EndUpdate(); }); } @@ -173,6 +256,9 @@ namespace renderdocui.Windows.Dialogs // (to stop flooding) private void LookupComplete() { + if(hosts.SelectedNode != null) + hosts_AfterSelect(hosts, new TreeViewEventArgs(null)); + if (lookupsInProgress == 0) { refresh.Enabled = true; @@ -181,10 +267,35 @@ namespace renderdocui.Windows.Dialogs private void hosts_AfterSelect(object sender, TreeViewEventArgs e) { + configHostname.Enabled = configRunCommand.Enabled = false; + configHostname.Text = configRunCommand.Text = ""; + if (hosts.SelectedNode != null && hosts.SelectedNode.Tag != null) { connect.Enabled = true; + connect.Text = "Connect"; + + RemoteHost host = hosts.SelectedNode.Tag as RemoteHost; + + if (host != null) + { + configHostname.Enabled = configRunCommand.Enabled = true; + configHostname.Text = host.Hostname; + configRunCommand.Text = host.RunCommand; + + if(IsRemoteServerLive(hosts.SelectedNode)) + { + connect.Text = "Shutdown"; + } + else + { + connect.Text = "Run Server"; + + if(host.RunCommand == "") + connect.Enabled = false; + } + } } else { @@ -206,26 +317,88 @@ namespace renderdocui.Windows.Dialogs private void AddNewHost() { - if (hostname.Text.Trim().Length > 0 && !m_Core.Config.RecentHosts.Contains(hostname.Text, StringComparer.OrdinalIgnoreCase)) + string host = hostname.Text.Trim(); + if (host.Length > 0) { - m_Core.Config.RecentHosts.Add(hostname.Text); - m_Core.Config.Serialize(Core.ConfigFilename); + bool found = false; - hosts.BeginUpdate(); - AddHost(hostname.Text); - hosts.EndUpdate(); + StringComparer comp = StringComparer.Create(System.Globalization.CultureInfo.CurrentCulture, true); + + for (int i = 0; i < m_Core.Config.RemoteHosts.Count; i++) + { + if (comp.Compare(m_Core.Config.RemoteHosts[i].Hostname, host.Trim()) == 0) + { + found = true; + break; + } + } + + if (!found) + { + RemoteHost h = new RemoteHost(); + h.Hostname = host; + + m_Core.Config.RemoteHosts.Add(h); + m_Core.Config.Serialize(Core.ConfigFilename); + + hosts.BeginUpdate(); + AddHost(h); + hosts.EndUpdate(); + } } hostname.Text = ""; } private void connect_Click(object sender, EventArgs e) { - ConnectToHost(hosts.SelectedNode); + TreelistView.Node node = hosts.SelectedNode; + if (node.Tag is RemoteConnect) + { + ConnectToHost(node); + } + else if (node.Tag is RemoteHost) + { + RemoteHost host = node.Tag as RemoteHost; + + if (IsRemoteServerLive(node)) + { + DialogResult res = MessageBox.Show(String.Format("Are you sure you wish to shut down running remote server on {0}?", host.Hostname), + "Remote server shutdown", MessageBoxButtons.YesNoCancel); + + if (res == DialogResult.Cancel || res == DialogResult.No) + return; + + // shut down + try + { + RemoteServer server = StaticExports.CreateRemoteServer(host.Hostname, 0); + server.ShutdownServerAndConnection(); + hosts.BeginUpdate(); + SetRemoteServerLive(node, false); + hosts.EndUpdate(); + } + catch (Exception) + { + MessageBox.Show("Error shutting down remote server", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + hosts_AfterSelect(hosts, new TreeViewEventArgs(null)); + } + else + { + // try to run + refresh.Enabled = false; + + Thread th = Helpers.NewThread(new ParameterizedThreadStart(RunRemoteServer)); + th.Start(node); + } + } } private void hosts_NodeDoubleClicked(TreelistView.Node node) { - ConnectToHost(node); + if(node.Tag is RemoteConnect) + ConnectToHost(node); } private void addhost_Click(object sender, EventArgs e) @@ -233,12 +406,6 @@ namespace renderdocui.Windows.Dialogs AddNewHost(); } - private void hostname_KeyPress(object sender, KeyPressEventArgs e) - { - if (e.KeyChar == '\n' || e.KeyChar == '\r') - AddNewHost(); - } - private void refresh_Click(object sender, EventArgs e) { if (lookupsInProgress > 0) @@ -265,11 +432,13 @@ namespace renderdocui.Windows.Dialogs if (e.KeyData == Keys.Return || e.KeyData == Keys.Enter) { if (connect.Enabled) - ConnectToHost(hosts.SelectedNode); + { + connect_Click(sender, new EventArgs()); + } } if (e.KeyData == Keys.Delete && hosts.SelectedNode != null && hosts.SelectedNode.Parent == null) { - string hostname = hosts.SelectedNode["Hostname"] as string; + string hostname = hosts.SelectedNode["hostname"] as string; if(hostname == "localhost") return; @@ -282,7 +451,7 @@ namespace renderdocui.Windows.Dialogs if (res == DialogResult.Yes) { - m_Core.Config.RecentHosts.Remove(hosts.SelectedNode["Hostname"] as String); + m_Core.Config.RemoteHosts.Remove(hosts.SelectedNode.Tag as RemoteHost); m_Core.Config.Serialize(Core.ConfigFilename); hosts.BeginUpdate(); hosts.Nodes.Remove(hosts.SelectedNode); @@ -290,5 +459,37 @@ namespace renderdocui.Windows.Dialogs } } } + + private void textbox_KeyPress(object sender, KeyPressEventArgs e) + { + if (e.KeyChar == '\n' || e.KeyChar == '\r') + { + if(sender == hostname) + addhost_Click(sender, new EventArgs()); + if(sender == configHostname) + setConfig_Click(setHostname, new EventArgs()); + if(sender == configRunCommand) + setConfig_Click(setRunCommand, new EventArgs()); + } + } + + private void setConfig_Click(object sender, EventArgs e) + { + int idx = m_Core.Config.RemoteHosts.IndexOf(hosts.SelectedNode.Tag as RemoteHost); + + if(idx >= 0) + { + if (sender == setHostname) + m_Core.Config.RemoteHosts[idx].Hostname = configHostname.Text.Trim(); + if (sender == setRunCommand) + m_Core.Config.RemoteHosts[idx].RunCommand = configRunCommand.Text.Trim(); + + m_Core.Config.Serialize(Core.ConfigFilename); + hosts.BeginUpdate(); + hosts.SelectedNode["hostname"] = m_Core.Config.RemoteHosts[idx].Hostname; + hosts.SelectedNode.Tag = m_Core.Config.RemoteHosts[idx]; + hosts.EndUpdate(); + } + } } } diff --git a/renderdocui/Windows/Dialogs/ReplayHostManager.resx b/renderdocui/Windows/Dialogs/RemoteManager.resx similarity index 89% rename from renderdocui/Windows/Dialogs/ReplayHostManager.resx rename to renderdocui/Windows/Dialogs/RemoteManager.resx index 340fa10b5..f4545399e 100644 --- a/renderdocui/Windows/Dialogs/ReplayHostManager.resx +++ b/renderdocui/Windows/Dialogs/RemoteManager.resx @@ -120,10 +120,22 @@ False + + False + + + False + False False + + False + + + False + \ No newline at end of file diff --git a/renderdocui/Windows/Dialogs/ReplayHostManager.Designer.cs b/renderdocui/Windows/Dialogs/ReplayHostManager.Designer.cs deleted file mode 100644 index bf1003c7f..000000000 --- a/renderdocui/Windows/Dialogs/ReplayHostManager.Designer.cs +++ /dev/null @@ -1,150 +0,0 @@ -namespace renderdocui.Windows.Dialogs -{ - partial class ReplayHostManager - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; - System.Windows.Forms.Label label1; - System.Windows.Forms.Label label2; - this.OK = new System.Windows.Forms.Button(); - this.driversBox = new System.Windows.Forms.GroupBox(); - this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); - this.localProxy = new System.Windows.Forms.ComboBox(); - tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - label1 = new System.Windows.Forms.Label(); - label2 = new System.Windows.Forms.Label(); - tableLayoutPanel1.SuspendLayout(); - this.flowLayoutPanel1.SuspendLayout(); - this.SuspendLayout(); - // - // tableLayoutPanel1 - // - tableLayoutPanel1.ColumnCount = 1; - tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - tableLayoutPanel1.Controls.Add(this.OK, 0, 3); - tableLayoutPanel1.Controls.Add(this.driversBox, 0, 2); - tableLayoutPanel1.Controls.Add(label1, 0, 0); - tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 1); - tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); - tableLayoutPanel1.Name = "tableLayoutPanel1"; - tableLayoutPanel1.RowCount = 4; - tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - tableLayoutPanel1.Size = new System.Drawing.Size(420, 400); - tableLayoutPanel1.TabIndex = 0; - // - // OK - // - this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.OK.DialogResult = System.Windows.Forms.DialogResult.OK; - this.OK.Location = new System.Drawing.Point(342, 374); - this.OK.Name = "OK"; - this.OK.Size = new System.Drawing.Size(75, 23); - this.OK.TabIndex = 0; - this.OK.Text = "OK"; - this.OK.UseVisualStyleBackColor = true; - // - // driversBox - // - this.driversBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.driversBox.Location = new System.Drawing.Point(3, 75); - this.driversBox.Name = "driversBox"; - this.driversBox.Size = new System.Drawing.Size(414, 293); - this.driversBox.TabIndex = 2; - this.driversBox.TabStop = false; - this.driversBox.Text = "Remote Replay Hosts"; - // - // label1 - // - label1.AutoSize = true; - label1.Location = new System.Drawing.Point(3, 0); - label1.Name = "label1"; - label1.Size = new System.Drawing.Size(301, 39); - label1.TabIndex = 1; - label1.Text = "Select Replay Host for each known driver.\r\n\r\nLeave blank to indicate local replay" + - " should be used if possible."; - // - // flowLayoutPanel1 - // - this.flowLayoutPanel1.AutoSize = true; - this.flowLayoutPanel1.Controls.Add(label2); - this.flowLayoutPanel1.Controls.Add(this.localProxy); - this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 42); - this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(278, 27); - this.flowLayoutPanel1.TabIndex = 3; - // - // label2 - // - label2.Anchor = System.Windows.Forms.AnchorStyles.Right; - label2.AutoSize = true; - label2.Location = new System.Drawing.Point(3, 7); - label2.Name = "label2"; - label2.Size = new System.Drawing.Size(145, 13); - label2.TabIndex = 0; - label2.Text = "Choose local API for proxying"; - // - // localProxy - // - this.localProxy.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.localProxy.FormattingEnabled = true; - this.localProxy.Location = new System.Drawing.Point(154, 3); - this.localProxy.Name = "localProxy"; - this.localProxy.Size = new System.Drawing.Size(121, 21); - this.localProxy.TabIndex = 1; - this.localProxy.SelectedIndexChanged += new System.EventHandler(this.localProxy_SelectedIndexChanged); - // - // ReplayHostManager - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(420, 400); - this.Controls.Add(tableLayoutPanel1); - this.Name = "ReplayHostManager"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "ReplayHostManager"; - this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ReplayHostManager_FormClosed); - tableLayoutPanel1.ResumeLayout(false); - tableLayoutPanel1.PerformLayout(); - this.flowLayoutPanel1.ResumeLayout(false); - this.flowLayoutPanel1.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Button OK; - private System.Windows.Forms.GroupBox driversBox; - private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; - private System.Windows.Forms.ComboBox localProxy; - } -} \ No newline at end of file diff --git a/renderdocui/Windows/Dialogs/ReplayHostManager.cs b/renderdocui/Windows/Dialogs/ReplayHostManager.cs deleted file mode 100644 index 8d28509dd..000000000 --- a/renderdocui/Windows/Dialogs/ReplayHostManager.cs +++ /dev/null @@ -1,213 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2016 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - ******************************************************************************/ - - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Windows.Forms; -using renderdocui.Code; -using renderdoc; - -namespace renderdocui.Windows.Dialogs -{ - // currently not used until the implementation is completed, but this allows the user - // to choose which host they'll use by default to replay on when they try and load a log - // that uses an API not implemented in their build of renderdoc. - // - // It can also be used force remote replay even for an API that is locally supported - - // this can be used if e.g. you want to run on a remote machine that has a different IHV's - // GPU in it to check for bugs or access different hardware profiling counters - public partial class ReplayHostManager : Form - { - Core m_Core; - List m_Hosts = new List(); - - public ReplayHostManager(Core core, MainWindow main) - { - InitializeComponent(); - - localProxy.Font = core.Config.PreferredFont; - - Icon = global::renderdocui.Properties.Resources.icon; - - m_Core = core; - - string[] proxies = new string[0]; - try - { - var dummy = StaticExports.CreateRemoteReplayConnection("-", 0); - proxies = dummy.LocalProxies(); - dummy.Shutdown(); - } - catch (ApplicationException ex) - { - string errmsg = "Unknown error message"; - if (ex.Data.Contains("status")) - errmsg = ((ReplayCreateStatus)ex.Data["status"]).Str(); - - MessageBox.Show(String.Format("Failed to fetch local proxy drivers: {0}.\n\nCheck diagnostic log in Help menu for more details.", errmsg), - "Error getting driver list", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - - localProxy.Items.AddRange(proxies); - - m_Core.Config.LocalProxy = Helpers.Clamp(m_Core.Config.LocalProxy, 0, proxies.Length - 1); - - localProxy.SelectedIndex = m_Core.Config.LocalProxy; - - var driversTable = new TableLayoutPanel(); - - driversTable.SuspendLayout(); - - driversBox.Controls.Clear(); - driversBox.Controls.Add(driversTable); - - driversTable.ColumnCount = 2; - driversTable.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 30F)); - driversTable.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 70F)); - - driversTable.Dock = System.Windows.Forms.DockStyle.Fill; - driversTable.RowCount = m_Core.Config.ReplayHosts.Count + 1; - - int row = 0; - - List hosts = new List(); - - foreach (var kv in m_Core.Config.ReplayHosts) - { - var driver = kv.Key; - - var lab = new Label(); - lab.Anchor = AnchorStyles.Right; - lab.AutoSize = true; - lab.Text = driver; - - var host = new ComboBox(); - host.Dock = DockStyle.Fill; - host.FormattingEnabled = true; - host.TabIndex = row + 1; - - host.Font = m_Core.Config.PreferredFont; - - hosts.Clear(); - - if (kv.Value.Length > 0) - hosts.Add(kv.Value); - - var plugins = renderdocplugin.PluginHelpers.GetPlugins(); - - // search plugins for to find other targets for this driver - foreach (var plugin in plugins) - { - var replayman = renderdocplugin.PluginHelpers.GetPluginInterface(plugin); - - if (replayman != null && replayman.GetTargetType() == driver) - { - var targets = replayman.GetOnlineTargets(); - - foreach (var t in targets) - { - if (!hosts.Contains(t)) - hosts.Add(t); - } - } - } - - // fill the combo box with previously used hosts - foreach (var prev in m_Core.Config.PreviouslyUsedHosts) - { - if (prev.Key == driver && !hosts.Contains(prev.Value)) - hosts.Add(prev.Value); - } - - driversTable.Controls.Add(lab, 0, row); - driversTable.Controls.Add(host, 1, row); - driversTable.RowStyles.Add(new RowStyle()); - - hosts.Remove(""); - - host.Items.AddRange(hosts.ToArray()); - if (kv.Value.Length > 0) - host.SelectedIndex = 0; - - host.Tag = driver; - host.SelectedValueChanged += new EventHandler(host_SelectedValueChanged); - host.KeyUp += new KeyEventHandler(host_KeyUp); - - m_Hosts.Add(host); - - row++; - } - - driversTable.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); - - driversTable.ResumeLayout(false); - driversTable.PerformLayout(); - } - - void host_KeyUp(object sender, KeyEventArgs e) - { - host_SelectedValueChanged(sender, null); - } - - void host_SelectedValueChanged(object sender, EventArgs e) - { - var host = sender as ComboBox; - string driver = host.Tag as string; - - if (driver.Length > 0 && m_Core.Config.ReplayHosts.ContainsKey(driver)) - m_Core.Config.ReplayHosts[driver] = host.Text; - } - - private void localProxy_SelectedIndexChanged(object sender, EventArgs e) - { - m_Core.Config.LocalProxy = localProxy.SelectedIndex; - } - - private void ReplayHostManager_FormClosed(object sender, FormClosedEventArgs e) - { - foreach (var host in m_Hosts) - { - string driver = host.Tag as string; - - if (host.Text.Length == 0) - continue; - - bool found = false; - foreach (var prev in m_Core.Config.PreviouslyUsedHosts) - if (prev.Key == driver && prev.Value == host.Text) - found = true; - - if (!found) - m_Core.Config.PreviouslyUsedHosts.Add(new SerializableKeyValuePair(driver, host.Text)); - } - } - } -} diff --git a/renderdocui/Windows/MainWindow.Designer.cs b/renderdocui/Windows/MainWindow.Designer.cs index 119f85a5d..10907a02c 100644 --- a/renderdocui/Windows/MainWindow.Designer.cs +++ b/renderdocui/Windows/MainWindow.Designer.cs @@ -94,7 +94,7 @@ this.resolveSymbolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator(); this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.manageReplayDevicesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.manageRemote = new System.Windows.Forms.ToolStripMenuItem(); this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.viewDocsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.viewLogFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -116,6 +116,9 @@ this.statusProgress = new System.Windows.Forms.ToolStripProgressBar(); this.dockPanel = new WeifenLuo.WinFormsUI.Docking.DockPanel(); this.saveDialog = new System.Windows.Forms.SaveFileDialog(); + this.contextChooser = new System.Windows.Forms.ToolStripDropDownButton(); + this.foohostToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.barhostToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.toolStripContainer1.BottomToolStripPanel.SuspendLayout(); this.toolStripContainer1.ContentPanel.SuspendLayout(); @@ -154,41 +157,41 @@ this.toolStripSeparator5, this.exitToolStripMenuItem}); this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Size = new System.Drawing.Size(35, 20); this.fileToolStripMenuItem.Text = "&File"; // // captureLogToolStripMenuItem // this.captureLogToolStripMenuItem.Name = "captureLogToolStripMenuItem"; this.captureLogToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N))); - this.captureLogToolStripMenuItem.Size = new System.Drawing.Size(218, 22); + this.captureLogToolStripMenuItem.Size = new System.Drawing.Size(206, 22); this.captureLogToolStripMenuItem.Text = "&Capture Log"; this.captureLogToolStripMenuItem.Click += new System.EventHandler(this.captureLogToolStripMenuItem_Click); // // attachToInstanceToolStripMenuItem // this.attachToInstanceToolStripMenuItem.Name = "attachToInstanceToolStripMenuItem"; - this.attachToInstanceToolStripMenuItem.Size = new System.Drawing.Size(218, 22); + this.attachToInstanceToolStripMenuItem.Size = new System.Drawing.Size(206, 22); this.attachToInstanceToolStripMenuItem.Text = "&Attach to Running Instance"; this.attachToInstanceToolStripMenuItem.Click += new System.EventHandler(this.attachToInstanceToolStripMenuItem_Click); // // injectIntoProcessToolStripMenuItem // this.injectIntoProcessToolStripMenuItem.Name = "injectIntoProcessToolStripMenuItem"; - this.injectIntoProcessToolStripMenuItem.Size = new System.Drawing.Size(218, 22); + this.injectIntoProcessToolStripMenuItem.Size = new System.Drawing.Size(206, 22); this.injectIntoProcessToolStripMenuItem.Text = "&Inject into Process"; this.injectIntoProcessToolStripMenuItem.Click += new System.EventHandler(this.injectIntoProcessToolStripMenuItem_Click); // // toolStripSeparator10 // this.toolStripSeparator10.Name = "toolStripSeparator10"; - this.toolStripSeparator10.Size = new System.Drawing.Size(215, 6); + this.toolStripSeparator10.Size = new System.Drawing.Size(203, 6); // // openLogToolStripMenuItem // this.openLogToolStripMenuItem.Name = "openLogToolStripMenuItem"; this.openLogToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); - this.openLogToolStripMenuItem.Size = new System.Drawing.Size(218, 22); + this.openLogToolStripMenuItem.Size = new System.Drawing.Size(206, 22); this.openLogToolStripMenuItem.Text = "&Open Log"; this.openLogToolStripMenuItem.Click += new System.EventHandler(this.openLogToolStripMenuItem_Click); // @@ -197,7 +200,7 @@ this.saveLogToolStripMenuItem.Enabled = false; this.saveLogToolStripMenuItem.Name = "saveLogToolStripMenuItem"; this.saveLogToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); - this.saveLogToolStripMenuItem.Size = new System.Drawing.Size(218, 22); + this.saveLogToolStripMenuItem.Size = new System.Drawing.Size(206, 22); this.saveLogToolStripMenuItem.Text = "&Save Log"; this.saveLogToolStripMenuItem.Click += new System.EventHandler(this.saveLogToolStripMenuItem_Click); // @@ -205,14 +208,14 @@ // this.closeLogToolStripMenuItem.Name = "closeLogToolStripMenuItem"; this.closeLogToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.W))); - this.closeLogToolStripMenuItem.Size = new System.Drawing.Size(218, 22); + this.closeLogToolStripMenuItem.Size = new System.Drawing.Size(206, 22); this.closeLogToolStripMenuItem.Text = "C&lose Log"; this.closeLogToolStripMenuItem.Click += new System.EventHandler(this.closeLogToolStripMenuItem_Click); // // toolStripSeparator4 // this.toolStripSeparator4.Name = "toolStripSeparator4"; - this.toolStripSeparator4.Size = new System.Drawing.Size(215, 6); + this.toolStripSeparator4.Size = new System.Drawing.Size(203, 6); // // recentFilesToolStripMenuItem // @@ -220,18 +223,18 @@ this.toolStripSeparator6, this.clearHistoryToolStripMenuItem}); this.recentFilesToolStripMenuItem.Name = "recentFilesToolStripMenuItem"; - this.recentFilesToolStripMenuItem.Size = new System.Drawing.Size(218, 22); + this.recentFilesToolStripMenuItem.Size = new System.Drawing.Size(206, 22); this.recentFilesToolStripMenuItem.Text = "&Recent Logs"; // // toolStripSeparator6 // this.toolStripSeparator6.Name = "toolStripSeparator6"; - this.toolStripSeparator6.Size = new System.Drawing.Size(139, 6); + this.toolStripSeparator6.Size = new System.Drawing.Size(133, 6); // // clearHistoryToolStripMenuItem // this.clearHistoryToolStripMenuItem.Name = "clearHistoryToolStripMenuItem"; - this.clearHistoryToolStripMenuItem.Size = new System.Drawing.Size(142, 22); + this.clearHistoryToolStripMenuItem.Size = new System.Drawing.Size(136, 22); this.clearHistoryToolStripMenuItem.Text = "&Clear History"; this.clearHistoryToolStripMenuItem.Click += new System.EventHandler(this.clearHistoryToolStripMenuItem_Click); // @@ -241,31 +244,31 @@ this.toolStripSeparator7, this.clearHistoryToolStripMenuItem1}); this.recentCapturesToolStripMenuItem.Name = "recentCapturesToolStripMenuItem"; - this.recentCapturesToolStripMenuItem.Size = new System.Drawing.Size(218, 22); + this.recentCapturesToolStripMenuItem.Size = new System.Drawing.Size(206, 22); this.recentCapturesToolStripMenuItem.Text = "R&ecent Capture Settings"; // // toolStripSeparator7 // this.toolStripSeparator7.Name = "toolStripSeparator7"; - this.toolStripSeparator7.Size = new System.Drawing.Size(139, 6); + this.toolStripSeparator7.Size = new System.Drawing.Size(133, 6); // // clearHistoryToolStripMenuItem1 // this.clearHistoryToolStripMenuItem1.Name = "clearHistoryToolStripMenuItem1"; - this.clearHistoryToolStripMenuItem1.Size = new System.Drawing.Size(142, 22); + this.clearHistoryToolStripMenuItem1.Size = new System.Drawing.Size(136, 22); this.clearHistoryToolStripMenuItem1.Text = "&Clear History"; this.clearHistoryToolStripMenuItem1.Click += new System.EventHandler(this.clearHistoryToolStripMenuItem1_Click); // // toolStripSeparator5 // this.toolStripSeparator5.Name = "toolStripSeparator5"; - this.toolStripSeparator5.Size = new System.Drawing.Size(215, 6); + this.toolStripSeparator5.Size = new System.Drawing.Size(203, 6); // // exitToolStripMenuItem // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.exitToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4))); - this.exitToolStripMenuItem.Size = new System.Drawing.Size(218, 22); + this.exitToolStripMenuItem.Size = new System.Drawing.Size(206, 22); this.exitToolStripMenuItem.Text = "E&xit"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); // @@ -285,7 +288,7 @@ this.timelineToolStripMenuItem, this.statisticsViewerToolStripMenuItem}); this.windowToolStripMenuItem.Name = "windowToolStripMenuItem"; - this.windowToolStripMenuItem.Size = new System.Drawing.Size(63, 20); + this.windowToolStripMenuItem.Size = new System.Drawing.Size(57, 20); this.windowToolStripMenuItem.Text = "&Window"; // // toolStripMenuItem1 @@ -300,13 +303,13 @@ this.layoutSave5, this.layoutSave6}); this.toolStripMenuItem1.Name = "toolStripMenuItem1"; - this.toolStripMenuItem1.Size = new System.Drawing.Size(203, 22); + this.toolStripMenuItem1.Size = new System.Drawing.Size(192, 22); this.toolStripMenuItem1.Text = "&Save Layout"; // // layoutSaveDefault // this.layoutSaveDefault.Name = "layoutSaveDefault"; - this.layoutSaveDefault.Size = new System.Drawing.Size(151, 22); + this.layoutSaveDefault.Size = new System.Drawing.Size(145, 22); this.layoutSaveDefault.Tag = "0"; this.layoutSaveDefault.Text = "&Default Layout"; this.layoutSaveDefault.Click += new System.EventHandler(this.saveLayout_Click); @@ -314,12 +317,12 @@ // toolStripSeparator3 // this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(148, 6); + this.toolStripSeparator3.Size = new System.Drawing.Size(142, 6); // // layoutSave1 // this.layoutSave1.Name = "layoutSave1"; - this.layoutSave1.Size = new System.Drawing.Size(151, 22); + this.layoutSave1.Size = new System.Drawing.Size(145, 22); this.layoutSave1.Tag = "1"; this.layoutSave1.Text = "Layout &1"; this.layoutSave1.Click += new System.EventHandler(this.saveLayout_Click); @@ -327,7 +330,7 @@ // layoutSave2 // this.layoutSave2.Name = "layoutSave2"; - this.layoutSave2.Size = new System.Drawing.Size(151, 22); + this.layoutSave2.Size = new System.Drawing.Size(145, 22); this.layoutSave2.Tag = "2"; this.layoutSave2.Text = "Layout &2"; this.layoutSave2.Click += new System.EventHandler(this.saveLayout_Click); @@ -335,7 +338,7 @@ // layoutSave3 // this.layoutSave3.Name = "layoutSave3"; - this.layoutSave3.Size = new System.Drawing.Size(151, 22); + this.layoutSave3.Size = new System.Drawing.Size(145, 22); this.layoutSave3.Tag = "3"; this.layoutSave3.Text = "Layout &3"; this.layoutSave3.Click += new System.EventHandler(this.saveLayout_Click); @@ -343,7 +346,7 @@ // layoutSave4 // this.layoutSave4.Name = "layoutSave4"; - this.layoutSave4.Size = new System.Drawing.Size(151, 22); + this.layoutSave4.Size = new System.Drawing.Size(145, 22); this.layoutSave4.Tag = "4"; this.layoutSave4.Text = "Layout &4"; this.layoutSave4.Click += new System.EventHandler(this.saveLayout_Click); @@ -351,7 +354,7 @@ // layoutSave5 // this.layoutSave5.Name = "layoutSave5"; - this.layoutSave5.Size = new System.Drawing.Size(151, 22); + this.layoutSave5.Size = new System.Drawing.Size(145, 22); this.layoutSave5.Tag = "5"; this.layoutSave5.Text = "Layout &5"; this.layoutSave5.Click += new System.EventHandler(this.saveLayout_Click); @@ -359,7 +362,7 @@ // layoutSave6 // this.layoutSave6.Name = "layoutSave6"; - this.layoutSave6.Size = new System.Drawing.Size(151, 22); + this.layoutSave6.Size = new System.Drawing.Size(145, 22); this.layoutSave6.Tag = "6"; this.layoutSave6.Text = "Layout &6"; this.layoutSave6.Click += new System.EventHandler(this.saveLayout_Click); @@ -376,13 +379,13 @@ this.layoutLoad5, this.layoutLoad6}); this.saveLayoutToolStripMenuItem.Name = "saveLayoutToolStripMenuItem"; - this.saveLayoutToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.saveLayoutToolStripMenuItem.Size = new System.Drawing.Size(192, 22); this.saveLayoutToolStripMenuItem.Text = "&Load Layout"; // // layoutLoadDefault // this.layoutLoadDefault.Name = "layoutLoadDefault"; - this.layoutLoadDefault.Size = new System.Drawing.Size(151, 22); + this.layoutLoadDefault.Size = new System.Drawing.Size(145, 22); this.layoutLoadDefault.Tag = "0"; this.layoutLoadDefault.Text = "&Default Layout"; this.layoutLoadDefault.Click += new System.EventHandler(this.loadLayout_Click); @@ -390,12 +393,12 @@ // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(148, 6); + this.toolStripSeparator2.Size = new System.Drawing.Size(142, 6); // // layoutLoad1 // this.layoutLoad1.Name = "layoutLoad1"; - this.layoutLoad1.Size = new System.Drawing.Size(151, 22); + this.layoutLoad1.Size = new System.Drawing.Size(145, 22); this.layoutLoad1.Tag = "1"; this.layoutLoad1.Text = "Layout &1"; this.layoutLoad1.Click += new System.EventHandler(this.loadLayout_Click); @@ -403,7 +406,7 @@ // layoutLoad2 // this.layoutLoad2.Name = "layoutLoad2"; - this.layoutLoad2.Size = new System.Drawing.Size(151, 22); + this.layoutLoad2.Size = new System.Drawing.Size(145, 22); this.layoutLoad2.Tag = "2"; this.layoutLoad2.Text = "Layout &2"; this.layoutLoad2.Click += new System.EventHandler(this.loadLayout_Click); @@ -411,7 +414,7 @@ // layoutLoad3 // this.layoutLoad3.Name = "layoutLoad3"; - this.layoutLoad3.Size = new System.Drawing.Size(151, 22); + this.layoutLoad3.Size = new System.Drawing.Size(145, 22); this.layoutLoad3.Tag = "3"; this.layoutLoad3.Text = "Layout &3"; this.layoutLoad3.Click += new System.EventHandler(this.loadLayout_Click); @@ -419,7 +422,7 @@ // layoutLoad4 // this.layoutLoad4.Name = "layoutLoad4"; - this.layoutLoad4.Size = new System.Drawing.Size(151, 22); + this.layoutLoad4.Size = new System.Drawing.Size(145, 22); this.layoutLoad4.Tag = "4"; this.layoutLoad4.Text = "Layout &4"; this.layoutLoad4.Click += new System.EventHandler(this.loadLayout_Click); @@ -427,7 +430,7 @@ // layoutLoad5 // this.layoutLoad5.Name = "layoutLoad5"; - this.layoutLoad5.Size = new System.Drawing.Size(151, 22); + this.layoutLoad5.Size = new System.Drawing.Size(145, 22); this.layoutLoad5.Tag = "5"; this.layoutLoad5.Text = "Layout &5"; this.layoutLoad5.Click += new System.EventHandler(this.loadLayout_Click); @@ -435,7 +438,7 @@ // layoutLoad6 // this.layoutLoad6.Name = "layoutLoad6"; - this.layoutLoad6.Size = new System.Drawing.Size(151, 22); + this.layoutLoad6.Size = new System.Drawing.Size(145, 22); this.layoutLoad6.Tag = "6"; this.layoutLoad6.Text = "Layout &6"; this.layoutLoad6.Click += new System.EventHandler(this.loadLayout_Click); @@ -443,68 +446,68 @@ // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(200, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(189, 6); // // pythonShellToolStripMenuItem // this.pythonShellToolStripMenuItem.Name = "pythonShellToolStripMenuItem"; - this.pythonShellToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.pythonShellToolStripMenuItem.Size = new System.Drawing.Size(192, 22); this.pythonShellToolStripMenuItem.Text = "P&ython Shell"; this.pythonShellToolStripMenuItem.Click += new System.EventHandler(this.pythonShellToolStripMenuItem_Click); // // eventViewerToolStripMenuItem // this.eventViewerToolStripMenuItem.Name = "eventViewerToolStripMenuItem"; - this.eventViewerToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.eventViewerToolStripMenuItem.Size = new System.Drawing.Size(192, 22); this.eventViewerToolStripMenuItem.Text = "&Event Viewer"; this.eventViewerToolStripMenuItem.Click += new System.EventHandler(this.eventViewerToolStripMenuItem_Click); // // textureToolStripMenuItem // this.textureToolStripMenuItem.Name = "textureToolStripMenuItem"; - this.textureToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.textureToolStripMenuItem.Size = new System.Drawing.Size(192, 22); this.textureToolStripMenuItem.Text = "&Texture Viewer"; this.textureToolStripMenuItem.Click += new System.EventHandler(this.textureToolStripMenuItem_Click); // // D3D11PipelineStateToolStripMenuItem // this.D3D11PipelineStateToolStripMenuItem.Name = "D3D11PipelineStateToolStripMenuItem"; - this.D3D11PipelineStateToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.D3D11PipelineStateToolStripMenuItem.Size = new System.Drawing.Size(192, 22); this.D3D11PipelineStateToolStripMenuItem.Text = "&Pipeline State"; this.D3D11PipelineStateToolStripMenuItem.Click += new System.EventHandler(this.PipelineStateToolStripMenuItem_Click); // // aPIInspectorToolStripMenuItem // this.aPIInspectorToolStripMenuItem.Name = "aPIInspectorToolStripMenuItem"; - this.aPIInspectorToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.aPIInspectorToolStripMenuItem.Size = new System.Drawing.Size(192, 22); this.aPIInspectorToolStripMenuItem.Text = "&API Inspector"; this.aPIInspectorToolStripMenuItem.Click += new System.EventHandler(this.APIInspectorToolStripMenuItem_Click); // // meshOutputToolStripMenuItem // this.meshOutputToolStripMenuItem.Name = "meshOutputToolStripMenuItem"; - this.meshOutputToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.meshOutputToolStripMenuItem.Size = new System.Drawing.Size(192, 22); this.meshOutputToolStripMenuItem.Text = "&Mesh Output"; this.meshOutputToolStripMenuItem.Click += new System.EventHandler(this.meshOutputToolStripMenuItem_Click); // // debugMessagesToolStripMenuItem // this.debugMessagesToolStripMenuItem.Name = "debugMessagesToolStripMenuItem"; - this.debugMessagesToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.debugMessagesToolStripMenuItem.Size = new System.Drawing.Size(192, 22); this.debugMessagesToolStripMenuItem.Text = "Log Errors and &Warnings"; this.debugMessagesToolStripMenuItem.Click += new System.EventHandler(this.debugMessagesToolStripMenuItem_Click); // // timelineToolStripMenuItem // this.timelineToolStripMenuItem.Name = "timelineToolStripMenuItem"; - this.timelineToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.timelineToolStripMenuItem.Size = new System.Drawing.Size(192, 22); this.timelineToolStripMenuItem.Text = "T&imeline"; this.timelineToolStripMenuItem.Click += new System.EventHandler(this.timelineToolStripMenuItem_Click); // // statisticsViewerToolStripMenuItem // this.statisticsViewerToolStripMenuItem.Name = "statisticsViewerToolStripMenuItem"; - this.statisticsViewerToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.statisticsViewerToolStripMenuItem.Size = new System.Drawing.Size(192, 22); this.statisticsViewerToolStripMenuItem.Text = "Statisti&cs Viewer"; this.statisticsViewerToolStripMenuItem.Click += new System.EventHandler(this.statisticsViewerToolStripMenuItem_Click); // @@ -514,36 +517,36 @@ this.resolveSymbolsToolStripMenuItem, this.toolStripSeparator11, this.optionsToolStripMenuItem, - this.manageReplayDevicesToolStripMenuItem}); + this.manageRemote}); this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem"; - this.toolsToolStripMenuItem.Size = new System.Drawing.Size(48, 20); + this.toolsToolStripMenuItem.Size = new System.Drawing.Size(44, 20); this.toolsToolStripMenuItem.Text = "&Tools"; // // resolveSymbolsToolStripMenuItem // this.resolveSymbolsToolStripMenuItem.Name = "resolveSymbolsToolStripMenuItem"; - this.resolveSymbolsToolStripMenuItem.Size = new System.Drawing.Size(198, 22); + this.resolveSymbolsToolStripMenuItem.Size = new System.Drawing.Size(188, 22); this.resolveSymbolsToolStripMenuItem.Text = "&Resolve Symbols"; this.resolveSymbolsToolStripMenuItem.Click += new System.EventHandler(this.resolveSymbolsToolStripMenuItem_Click); // // toolStripSeparator11 // this.toolStripSeparator11.Name = "toolStripSeparator11"; - this.toolStripSeparator11.Size = new System.Drawing.Size(195, 6); + this.toolStripSeparator11.Size = new System.Drawing.Size(185, 6); // // optionsToolStripMenuItem // this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; - this.optionsToolStripMenuItem.Size = new System.Drawing.Size(198, 22); + this.optionsToolStripMenuItem.Size = new System.Drawing.Size(188, 22); this.optionsToolStripMenuItem.Text = "&Options"; this.optionsToolStripMenuItem.Click += new System.EventHandler(this.optionsToolStripMenuItem_Click); // // manageReplayDevicesToolStripMenuItem // - this.manageReplayDevicesToolStripMenuItem.Name = "manageReplayDevicesToolStripMenuItem"; - this.manageReplayDevicesToolStripMenuItem.Size = new System.Drawing.Size(198, 22); - this.manageReplayDevicesToolStripMenuItem.Text = "&Manage Replay Devices"; - this.manageReplayDevicesToolStripMenuItem.Click += new System.EventHandler(this.manageReplayDevicesToolStripMenuItem_Click); + this.manageRemote.Name = "manageRemote"; + this.manageRemote.Size = new System.Drawing.Size(188, 22); + this.manageRemote.Text = "&Manage Remote Servers"; + this.manageRemote.Click += new System.EventHandler(this.manageRemote_Click); // // helpToolStripMenuItem // @@ -581,6 +584,18 @@ this.viewLogFileToolStripMenuItem.Text = "View Diagnostic &Log File"; this.viewLogFileToolStripMenuItem.Click += new System.EventHandler(this.viewLogFileToolStripMenuItem_Click); // + // showTipsToolStripMenuItem + // + this.showTipsToolStripMenuItem.Name = "showTipsToolStripMenuItem"; + this.showTipsToolStripMenuItem.Size = new System.Drawing.Size(192, 22); + this.showTipsToolStripMenuItem.Text = "Show &Tips"; + this.showTipsToolStripMenuItem.Click += new System.EventHandler(this.showTipsToolStripMenuItem_Click); + // + // toolStripSeparator12 + // + this.toolStripSeparator12.Name = "toolStripSeparator12"; + this.toolStripSeparator12.Size = new System.Drawing.Size(189, 6); + // // sendErrorReportToolStripMenuItem // this.sendErrorReportToolStripMenuItem.Name = "sendErrorReportToolStripMenuItem"; @@ -640,8 +655,8 @@ // openDialog // this.openDialog.DefaultExt = "rdc"; - this.openDialog.Filter = "Capture Files (*.rdc, *.cap)|*.rdc;*.cap|Image Files|*.dds;*.hdr;*.exr;*.bmp;*.jpg;*.jpeg;*.png;*." + - "tga;*.gif;*.psd|All Files (*.*)|*.*"; + this.openDialog.Filter = "Capture Files (*.rdc, *.cap)|*.rdc;*.cap|Image Files|*.dds;*.hdr;*.exr;*.bmp;*.jp" + + "g;*.jpeg;*.png;*.tga;*.gif;*.psd|All Files (*.*)|*.*"; this.openDialog.Title = "Select file to open"; // // toolStripContainer1 @@ -674,7 +689,8 @@ this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.statusIcon, this.statusText, - this.statusProgress}); + this.statusProgress, + this.contextChooser}); this.statusStrip.Location = new System.Drawing.Point(0, 0); this.statusStrip.Name = "statusStrip"; this.statusStrip.Size = new System.Drawing.Size(1272, 22); @@ -693,7 +709,7 @@ // this.statusText.DoubleClickEnabled = true; this.statusText.Name = "statusText"; - this.statusText.Size = new System.Drawing.Size(64, 17); + this.statusText.Size = new System.Drawing.Size(63, 17); this.statusText.Text = "Status Text"; this.statusText.DoubleClick += new System.EventHandler(this.status_DoubleClick); // @@ -770,17 +786,30 @@ this.saveDialog.Filter = "Log Files (*.rdc)|*.rdc"; this.saveDialog.Title = "Save Log As"; // - // toolStripSeparator12 + // contextChooser // - this.toolStripSeparator12.Name = "toolStripSeparator12"; - this.toolStripSeparator12.Size = new System.Drawing.Size(189, 6); + this.contextChooser.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.barhostToolStripMenuItem, + this.foohostToolStripMenuItem}); + this.contextChooser.Image = global::renderdocui.Properties.Resources.disconnect; + this.contextChooser.ImageTransparentColor = System.Drawing.Color.Magenta; + this.contextChooser.Name = "contextChooser"; + this.contextChooser.Size = new System.Drawing.Size(142, 20); + this.contextChooser.Text = "Replay Context: Local"; // - // showTipsToolStripMenuItem + // foohostToolStripMenuItem // - this.showTipsToolStripMenuItem.Name = "showTipsToolStripMenuItem"; - this.showTipsToolStripMenuItem.Size = new System.Drawing.Size(192, 22); - this.showTipsToolStripMenuItem.Text = "Show &Tips"; - this.showTipsToolStripMenuItem.Click += new System.EventHandler(this.showTipsToolStripMenuItem_Click); + this.foohostToolStripMenuItem.Image = global::renderdocui.Properties.Resources.cross; + this.foohostToolStripMenuItem.Name = "foohostToolStripMenuItem"; + this.foohostToolStripMenuItem.Size = new System.Drawing.Size(154, 22); + this.foohostToolStripMenuItem.Text = "foohost (Offline)"; + // + // barhostToolStripMenuItem + // + this.barhostToolStripMenuItem.Image = global::renderdocui.Properties.Resources.tick; + this.barhostToolStripMenuItem.Name = "barhostToolStripMenuItem"; + this.barhostToolStripMenuItem.Size = new System.Drawing.Size(154, 22); + this.barhostToolStripMenuItem.Text = "barhost (Online)"; // // MainWindow // @@ -884,10 +913,13 @@ private System.Windows.Forms.ToolStripMenuItem sourceOnGithubToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem pythonShellToolStripMenuItem; private System.Windows.Forms.ToolStripStatusLabel statusIcon; - private System.Windows.Forms.ToolStripMenuItem manageReplayDevicesToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem manageRemote; private System.Windows.Forms.ToolStripMenuItem checkForUpdatesToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem showTipsToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator12; private System.Windows.Forms.ToolStripMenuItem statisticsViewerToolStripMenuItem; + private System.Windows.Forms.ToolStripDropDownButton contextChooser; + private System.Windows.Forms.ToolStripMenuItem barhostToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem foohostToolStripMenuItem; } } \ No newline at end of file diff --git a/renderdocui/Windows/MainWindow.cs b/renderdocui/Windows/MainWindow.cs index e2ffaee03..02d02efd1 100644 --- a/renderdocui/Windows/MainWindow.cs +++ b/renderdocui/Windows/MainWindow.cs @@ -74,9 +74,6 @@ namespace renderdocui.Windows private List m_LiveCaptures = new List(); - private renderdocplugin.ReplayManagerPlugin m_ReplayHost = null; - private string m_RemoteReplay = ""; - private string InformationalVersion { get @@ -268,12 +265,6 @@ namespace renderdocui.Windows resolveSymbolsToolStripMenuItem.Enabled = false; resolveSymbolsToolStripMenuItem.Text = "Resolve Symbols"; - if (m_ReplayHost != null) - m_ReplayHost.CloseReplay(); - - m_ReplayHost = null; - m_RemoteReplay = ""; - SetTitle(); } @@ -588,8 +579,6 @@ namespace renderdocui.Windows prefix = Path.GetFileName(filename); if (m_Core.APIProps.degraded) prefix += " !DEGRADED PERFORMANCE!"; - if (m_RemoteReplay.Length > 0) - prefix += String.Format(" (Remote replay on {0})", m_RemoteReplay); prefix += " - "; } @@ -623,144 +612,16 @@ namespace renderdocui.Windows Thread thread = null; - if (!m_Core.Config.ReplayHosts.ContainsKey(driver) && driver.Trim().Length > 0) - m_Core.Config.ReplayHosts.Add(driver, ""); - // if driver is empty something went wrong loading the log, let it be handled as usual - // below. Otherwise prompt to replay remotely. - if (driver.Length > 0 && (!support || m_Core.Config.ReplayHosts[driver].Length > 0)) + // below. Otherwise indicate that support is missing. + if (driver.Length > 0 && !support) { - string remoteMessage = String.Format("This log was captured with {0}", driver); + string remoteMessage = String.Format("This log was captured with {0} and cannot be replayed locally.\n\n", driver); - if(!support) - remoteMessage += " and cannot be replayed locally.\n"; - else - remoteMessage += " and your settings say to replay this remotely.\n"; + remoteMessage += "Try selecting a remote context in the status bar."; - if (m_Core.Config.ReplayHosts[driver].Length == 0) - remoteMessage += "Do you wish to select a remote host to replay on?\n\n" + - "You can set up a default host for this driver on the next screen."; - else - remoteMessage += String.Format("Would you like to launch replay on remote host {0}?\n\n" + - "You can change this default via Tools -> Manage Replay Devices.", m_Core.Config.ReplayHosts[driver]); - - DialogResult res = MessageBox.Show(remoteMessage, "Launch remote replay?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation); - - if (res == DialogResult.Yes) - { - if (m_Core.Config.ReplayHosts[driver].Length == 0) - { - (new Dialogs.ReplayHostManager(m_Core, this)).ShowDialog(); - - if (m_Core.Config.ReplayHosts[driver].Length == 0) - return; - } - - m_RemoteReplay = m_Core.Config.ReplayHosts[driver]; - - var plugins = renderdocplugin.PluginHelpers.GetPlugins(); - - // search plugins for to find manager for this driver and launch replay - foreach (var plugin in plugins) - { - var replayman = renderdocplugin.PluginHelpers.GetPluginInterface(plugin); - - if (replayman != null && replayman.GetTargetType() == driver) - { - var targets = replayman.GetOnlineTargets(); - - if (targets.Contains(m_RemoteReplay)) - { - replayman.RunReplay(m_RemoteReplay); - - // save replay connection so we can close replay - m_ReplayHost = replayman; - break; - } - } - } - - thread = Helpers.NewThread(new ThreadStart(() => - { - string[] drivers = new string[0]; - try - { - var dummy = StaticExports.CreateRemoteReplayConnection(m_RemoteReplay, 0); - drivers = dummy.RemoteSupportedReplays(); - dummy.Shutdown(); - } - catch (ApplicationException ex) - { - string errmsg = "Unknown error message"; - if (ex.Data.Contains("status")) - errmsg = ((ReplayCreateStatus)ex.Data["status"]).Str(); - - MessageBox.Show(String.Format("Failed to fetch supported drivers on host {0}: {1}.\n\nCheck diagnostic log in Help menu for more details.", m_RemoteReplay, errmsg), - "Error getting driver list", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - - // no drivers means we didn't connect - if (drivers.Length == 0) - { - } - else - { - bool found = false; - foreach (var d in drivers) - if (d == driver) - found = true; - - if (!found) - { - MessageBox.Show(String.Format("Remote host {0} doesn't support {1}.", m_RemoteReplay, driver), - "Unsupported remote replay", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - else - { - string[] proxies = new string[0]; - try - { - var dummy = StaticExports.CreateRemoteReplayConnection("-", 0); - proxies = dummy.LocalProxies(); - dummy.Shutdown(); - } - catch (ApplicationException ex) - { - string errmsg = "Unknown error message"; - if (ex.Data.Contains("status")) - errmsg = ((ReplayCreateStatus)ex.Data["status"]).Str(); - - MessageBox.Show(String.Format("Failed to fetch local proxy drivers: {0}.\n\nCheck diagnostic log in Help menu for more details.", errmsg), - "Error getting driver list", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - if (proxies.Length > 0) - { - m_Core.Config.LocalProxy = Helpers.Clamp(m_Core.Config.LocalProxy, 0, proxies.Length - 1); - - m_Core.LoadLogfile(m_Core.Config.LocalProxy, m_RemoteReplay, filename, temporary); - if (m_Core.LogLoaded) - return; - } - } - } - - // clean up. - if (m_ReplayHost != null) - m_ReplayHost.CloseReplay(); - m_RemoteReplay = ""; - - BeginInvoke(new Action(() => - { - statusText.Text = ""; - statusIcon.Image = null; - statusProgress.Visible = false; - })); - })); - } - else - { - return; - } + MessageBox.Show(remoteMessage, "Unsupported logfile type", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + return; } else { @@ -969,7 +830,7 @@ namespace renderdocui.Windows private void attachToInstanceToolStripMenuItem_Click(object sender, EventArgs e) { - (new Dialogs.RemoteHostSelect(m_Core, this)).ShowDialog(); + (new Dialogs.RemoteManager(m_Core, this)).ShowDialog(); } private void injectIntoProcessToolStripMenuItem_Click(object sender, EventArgs e) @@ -1499,26 +1360,9 @@ namespace renderdocui.Windows StaticExports.TriggerExceptionHandler(IntPtr.Zero, false); } - private void manageReplayDevicesToolStripMenuItem_Click(object sender, EventArgs e) + private void manageRemote_Click(object sender, EventArgs e) { - (new Dialogs.ReplayHostManager(m_Core, this)).ShowDialog(); - } - - private void launchReplayHostToolStripMenuItem_Click(object sender, EventArgs e) - { - bool killReplay = false; - - Thread thread = Helpers.NewThread(new ThreadStart(() => - { - StaticExports.BecomeRemoteServer("", 0, ref killReplay); - })); - - thread.Start(); - - MessageBox.Show("Remote Replay is now running. Click OK to close.", "Remote replay", - MessageBoxButtons.OK, MessageBoxIcon.Information); - - killReplay = true; + (new Dialogs.RemoteManager(m_Core, this)).ShowDialog(); } private void viewDocsToolStripMenuItem_Click(object sender, EventArgs e) diff --git a/renderdocui/renderdocui.csproj b/renderdocui/renderdocui.csproj index d97da04de..1d5437654 100644 --- a/renderdocui/renderdocui.csproj +++ b/renderdocui/renderdocui.csproj @@ -235,11 +235,11 @@ PythonShell.cs - + Form - - RemoteHostSelect.cs + + RemoteManager.cs Form @@ -247,12 +247,6 @@ OrderedListEditor.cs - - Form - - - ReplayHostManager.cs - Form @@ -409,11 +403,8 @@ OrderedListEditor.cs - - RemoteHostSelect.cs - - - ReplayHostManager.cs + + RemoteManager.cs SettingsDialog.cs