コード例 #1
0
ファイル: RenderManager.cs プロジェクト: loosche/renderdoc
        ////////////////////////////////////////////
        // Internals

        private void CreateReplayRenderer(ref ReplayRenderer renderer, ref RemoteRenderer remote)
        {
            if (m_ProxyRenderer < 0)
            {
                renderer = StaticExports.CreateReplayRenderer(m_Logfile, ref LoadProgress);
                return;
            }

            remote = StaticExports.CreateRemoteReplayConnection(m_ReplayHost);

            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.CreateProxyRenderer(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;
            }
        }
コード例 #2
0
ファイル: ReplayHostManager.cs プロジェクト: UIKit0/renderdoc
        public ReplayHostManager(Core core, MainWindow main)
        {
            InitializeComponent();

            Icon = global::renderdocui.Properties.Resources.icon;

            m_Core = core;
            m_Main = main;

            string[] proxies = new string[0];
            try
            {
                var dummy = StaticExports.CreateRemoteReplayConnection("-");
                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 <string> hosts = new List <string>();

            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;

                hosts.Clear();

                if (kv.Value != "")
                {
                    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 <renderdocplugin.ReplayManagerPlugin>(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 != "")
                {
                    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();
        }