Example #1
0
        public void OnLogfileClosed()
        {
            statusText.Text = "";
            statusProgress.Visible = false;

            logStatisticsToolStripMenuItem.Enabled = false;

            resolveSymbolsToolStripMenuItem.Enabled = false;
            resolveSymbolsToolStripMenuItem.Text = "Resolve Symbols";

            if (m_ReplayHost != null)
                m_ReplayHost.CloseReplay();

            m_ReplayHost = null;
            m_RemoteReplay = "";

            SetTitle();
        }
Example #2
0
        private void LoadLogAsync(string filename, bool temporary)
        {
            if (m_Core.LogLoading) return;

            string driver = "";
            bool support = StaticExports.SupportLocalReplay(filename, out driver);

            Thread thread = null;

            if (!m_Core.Config.ReplayHosts.ContainsKey(driver) && driver.Trim() != "")
                m_Core.Config.ReplayHosts.Add(driver, "");

            // if driver is "" something went wrong loading the log, let it be handled as usual
            // below. Otherwise prompt to replay remotely.
            if (driver != "" && (!support || m_Core.Config.ReplayHosts[driver] != ""))
            {
                string remoteMessage = String.Format("This log was captured with {0}", driver);

                if(!support)
                    remoteMessage += " and cannot be replayed locally.\n";
                else
                    remoteMessage += " and your settings say to replay this remotely.\n";

                if(m_Core.Config.ReplayHosts[driver] == "")
                    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] == "")
                    {
                        (new Dialogs.ReplayHostManager(m_Core, this)).ShowDialog();

                        if (m_Core.Config.ReplayHosts[driver] == "")
                            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<renderdocplugin.ReplayManagerPlugin>(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 = new Thread(new ThreadStart(() =>
                    {
                        string[] drivers = new string[0];
                        try
                        {
                            var dummy = StaticExports.CreateRemoteReplayConnection(m_RemoteReplay);
                            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("-");
                                    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 = "";
                            statusProgress.Visible = false;
                        }));
                    }));
                }
                else
                {
                    return;
                }
            }
            else
            {
                thread = new Thread(new ThreadStart(() => m_Core.LoadLogfile(filename, temporary)));
            }

            thread.Start();

            m_Core.Config.LastLogPath = Path.GetDirectoryName(filename);

            statusText.Text = "Loading " + filename + "...";
        }
Example #3
0
        public void OnLogfileClosed()
        {
            statusText.Text = "";
            statusIcon.Image = null;
            statusProgress.Visible = false;

            m_MessageTick.Dispose();
            m_MessageTick = null;

            resolveSymbolsToolStripMenuItem.Enabled = false;
            resolveSymbolsToolStripMenuItem.Text = "Resolve Symbols";

            if (m_ReplayHost != null)
                m_ReplayHost.CloseReplay();

            m_ReplayHost = null;
            m_RemoteReplay = "";

            SetTitle();
        }