Esempio n. 1
0
        private void ConnectionClosed()
        {
            if (m_IgnoreThreadClosed)
            {
                return;
            }

            if (captures.Items.Count <= 1)
            {
                if (captures.Items.Count == 1)
                {
                    var log = captures.Items[0].Tag as CaptureLog;

                    // only auto-open a non-local log if we are successfully connected
                    // to this machine as a remote context
                    if (!log.local)
                    {
                        if (m_Core.Renderer.Remote == null ||
                            m_Host != m_Core.Renderer.Remote.Hostname ||
                            !m_Core.Renderer.Remote.Connected)
                        {
                            return;
                        }
                    }

                    if (log.opened)
                    {
                        return;
                    }

                    OpenCapture(log);
                    if (!log.saved)
                    {
                        log.saved = true;
                        m_Main.OwnTemporaryLog = true;
                    }
                }

                // auto-close and load log if we got a capture. If we
                // don't haveany captures but DO have child processes,
                // then don't close just yet.
                if (captures.Items.Count == 1 || m_Children.Count == 0)
                {
                    Close();
                }

                // if we have no captures and only one child, close and
                // open up a connection to it (similar to behaviour with
                // only one capture
                if (captures.Items.Count == 0 && m_Children.Count == 1)
                {
                    uint ident = m_Children[0].ident;
                    var  live  = new LiveCapture(m_Core, m_Host, ident, m_Main);
                    m_Main.ShowLiveCapture(live);
                    Close();
                }
            }
        }
Esempio n. 2
0
 private void childProcesses_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (childProcesses.SelectedItems.Count == 1 && childProcesses.SelectedItems[0].Tag is uint)
     {
         uint ident = (uint)childProcesses.SelectedItems[0].Tag;
         var  live  = new LiveCapture(m_Core, m_Host, ident, m_Main);
         m_Main.ShowLiveCapture(live);
     }
 }
Esempio n. 3
0
 public void ShowLiveCapture(LiveCapture live)
 {
     m_LiveCaptures.Add(live);
     live.Show(dockPanel);
 }
Esempio n. 4
0
        private LiveCapture OnInjectTrigger(UInt32 PID, string name, CaptureOptions opts)
        {
            if (!PromptCloseLog())
                return null;

            string logfile = m_Core.TempLogFilename(name);

            UInt32 ret = StaticExports.InjectIntoProcess(PID, logfile, opts);

            if (ret == 0)
            {
                MessageBox.Show(string.Format("Error injecting into process {0} for capture.\n\nCheck diagnostic log in Help menu for more details.", PID),
                                   "Error kicking capture", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return null;
            }

            var live = new LiveCapture(m_Core, "", ret, this);
            ShowLiveCapture(live);
            return live;
        }
Esempio n. 5
0
 public void LiveCaptureClosed(LiveCapture live)
 {
     m_LiveCaptures.Remove(live);
 }
Esempio n. 6
0
        private void MainWindow_Load(object sender, EventArgs e)
        {
            bool loaded = LoadLayout(0);

            CheckUpdates();

            Thread remoteStatusThread = Helpers.NewThread(new ThreadStart(() =>
            {
                m_Core.Config.AddAndroidHosts();
                for (int i = 0; i < m_Core.Config.RemoteHosts.Count; i++)
                    m_Core.Config.RemoteHosts[i].CheckStatus();
            }));
            remoteStatusThread.Start();

            sendErrorReportToolStripMenuItem.Enabled = OfficialVersion || BetaVersion;

            // create default layout if layout failed to load
            if (!loaded)
            {
                m_Core.GetAPIInspector().Show(dockPanel);
                m_Core.GetEventBrowser().Show(m_Core.GetAPIInspector().Pane, DockAlignment.Top, 0.5);

                m_Core.GetPipelineStateViewer().Show(dockPanel);

                var bv = m_Core.GetMeshViewer();
                bv.InitFromPersistString("");
                bv.Show(dockPanel);

                var tv = m_Core.GetTextureViewer();
                tv.InitFromPersistString("");
                tv.Show(dockPanel);

                m_Core.GetTimelineBar().Show(dockPanel);

                if (m_Core.CaptureDialog == null)
                    m_Core.CaptureDialog = new Dialogs.CaptureDialog(m_Core, OnCaptureTrigger, OnInjectTrigger);

                m_Core.CaptureDialog.InjectMode = false;
                m_Core.CaptureDialog.Show(dockPanel);
            }

            PopulateRecentFiles();
            PopulateRecentCaptures();

            if (m_InitRemoteIdent != 0)
            {
                var live = new LiveCapture(m_Core, m_InitRemoteHost, m_InitRemoteIdent, this);
                ShowLiveCapture(live);
            }

            if (m_InitFilename.Length > 0)
            {
                LoadFromFilename(m_InitFilename);

                m_InitFilename = "";
            }
        }
Esempio n. 7
0
        private LiveCapture OnCaptureTrigger(string exe, string workingDir, string cmdLine, CaptureOptions opts)
        {
            if (!PromptCloseLog())
                return null;

            string logfile = m_Core.TempLogFilename(Path.GetFileNameWithoutExtension(exe));

            UInt32 ret = StaticExports.ExecuteAndInject(exe, workingDir, cmdLine, logfile, opts);

            if (ret == 0)
            {
                MessageBox.Show(string.Format("Error launching {0} for capture.\n\nCheck diagnostic log in Help menu for more details.", exe),
                                   "Error kicking capture", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return null;
            }

            var live = new LiveCapture(m_Core, "", ret, this);
            ShowLiveCapture(live);
            return live;
        }
Esempio n. 8
0
        private void MainWindow_Load(object sender, EventArgs e)
        {
            bool loaded = LoadLayout(0);

            CheckUpdates();

            sendErrorReportToolStripMenuItem.Enabled = OfficialVersion || BetaVersion;

            // create default layout if layout failed to load
            if (!loaded)
            {
                m_Core.GetAPIInspector().Show(dockPanel);
                m_Core.GetEventBrowser().Show(m_Core.GetAPIInspector().Pane, DockAlignment.Top, 0.5);

                m_Core.GetPipelineStateViewer().Show(dockPanel);

                var bv = new BufferViewer(m_Core, true);
                bv.InitFromPersistString("");
                bv.Show(dockPanel);

                var tv = m_Core.GetTextureViewer();
                tv.InitFromPersistString("");
                tv.Show(dockPanel);

                m_Core.GetTimelineBar().Show(dockPanel);

                if (m_Core.CaptureDialog == null)
                    m_Core.CaptureDialog = new Dialogs.CaptureDialog(m_Core, OnCaptureTrigger, OnInjectTrigger);

                m_Core.CaptureDialog.InjectMode = false;
                m_Core.CaptureDialog.Show(dockPanel);
            }

            PopulateRecentFiles();
            PopulateRecentCaptures();

            if (m_InitRemoteIdent != 0)
            {
                var live = new LiveCapture(m_Core, m_InitRemoteHost, m_InitRemoteIdent, this);
                ShowLiveCapture(live);
            }

            if (m_InitFilename.Length > 0)
            {
                if (Path.GetExtension(m_InitFilename) == ".rdc")
                {
                    LoadLogAsync(m_InitFilename, false);
                }
                else if (Path.GetExtension(m_InitFilename) == ".cap")
                {
                    if (m_Core.CaptureDialog == null)
                        m_Core.CaptureDialog = new Dialogs.CaptureDialog(m_Core, OnCaptureTrigger, OnInjectTrigger);

                    m_Core.CaptureDialog.LoadSettings(m_InitFilename);
                    m_Core.CaptureDialog.Show(dockPanel);

                    // workaround for Show() not doing this
                    if (m_Core.CaptureDialog.DockState == DockState.DockBottomAutoHide ||
                        m_Core.CaptureDialog.DockState == DockState.DockLeftAutoHide ||
                        m_Core.CaptureDialog.DockState == DockState.DockRightAutoHide ||
                        m_Core.CaptureDialog.DockState == DockState.DockTopAutoHide)
                    {
                        dockPanel.ActiveAutoHideContent = m_Core.CaptureDialog;
                    }
                }
                else
                {
                    // not a recognised filetype, see if we can load it anyway
                    LoadLogAsync(m_InitFilename, false);
                }

                m_InitFilename = "";
            }
        }
Esempio n. 9
0
        private void ConnectionClosed()
        {
            if (m_IgnoreThreadClosed) return;

            if (captures.Items.Count <= 1)
            {
                if (captures.Items.Count == 1)
                {
                    var log = captures.Items[0].Tag as CaptureLog;

                    // only auto-open a non-local log if we are successfully connected
                    // to this machine as a remote context
                    if (!log.local)
                    {
                        if (m_Core.Renderer.Remote == null ||
                           m_Host != m_Core.Renderer.Remote.Hostname ||
                           !m_Core.Renderer.Remote.Connected)
                            return;
                    }

                    if (log.opened)
                        return;

                    OpenCapture(log);
                    if (!log.saved)
                    {
                        log.saved = true;
                        m_Main.OwnTemporaryLog = true;
                    }
                }

                // auto-close and load log if we got a capture. If we
                // don't haveany captures but DO have child processes,
                // then don't close just yet.
                if(captures.Items.Count == 1 || m_Children.Count == 0)
                    Close();

                // if we have no captures and only one child, close and
                // open up a connection to it (similar to behaviour with
                // only one capture
                if (captures.Items.Count == 0 && m_Children.Count == 1)
                {
                    uint ident = m_Children[0].ident;
                    var live = new LiveCapture(m_Core, m_Host, ident, m_Main);
                    m_Main.ShowLiveCapture(live);
                    Close();
                }
            }
        }
Esempio n. 10
0
 private void childProcesses_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (childProcesses.SelectedItems.Count == 1 && childProcesses.SelectedItems[0].Tag is uint)
     {
         uint ident = (uint)childProcesses.SelectedItems[0].Tag;
         var live = new LiveCapture(m_Core, m_Host, ident, m_Main);
         m_Main.ShowLiveCapture(live);
     }
 }
Esempio n. 11
0
        private LiveCapture OnCaptureTrigger(string exe, string workingDir, string cmdLine, EnvironmentModification[] env, CaptureOptions opts)
        {
            if (!PromptCloseLog())
                return null;

            string logfile = m_Core.TempLogFilename(Path.GetFileNameWithoutExtension(exe));

            StaticExports.SetConfigSetting("MaxConnectTimeout", m_Core.Config.MaxConnectTimeout.ToString());

            UInt32 ret = m_Core.Renderer.ExecuteAndInject(exe, workingDir, cmdLine, env, logfile, opts);

            if (ret == 0)
            {
                MessageBox.Show(string.Format("Error launching {0} for capture.\n\nCheck diagnostic log in Help menu for more details.", exe),
                                   "Error kicking capture", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return null;
            }

            var live = new LiveCapture(m_Core, m_Core.Renderer.Remote == null ? "" : m_Core.Renderer.Remote.Hostname, ret, this);
            ShowLiveCapture(live);
            return live;
        }
Esempio n. 12
0
        private void MainWindow_Load(object sender, EventArgs e)
        {
            bool loaded = LoadLayout(0);

            if (Win32PInvoke.GetModuleHandle("rdocself.dll") != IntPtr.Zero)
            {
                ToolStripMenuItem beginSelfCap = new ToolStripMenuItem();
                beginSelfCap.Text = "Start Self-hosted Capture";
                beginSelfCap.Click += new EventHandler((object o, EventArgs a) => { StaticExports.StartSelfHostCapture("rdocself.dll"); });

                ToolStripMenuItem endSelfCap = new ToolStripMenuItem();
                endSelfCap.Text = "End Self-hosted Capture";
                endSelfCap.Click += new EventHandler((object o, EventArgs a) => { StaticExports.EndSelfHostCapture("rdocself.dll"); });

                toolsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] {
                    new System.Windows.Forms.ToolStripSeparator(),
                    beginSelfCap,
                    endSelfCap,
                });
            }

            CheckUpdates();

            Thread remoteStatusThread = Helpers.NewThread(new ThreadStart(() =>
            {
                m_Core.Config.AddAndroidHosts();
                for (int i = 0; i < m_Core.Config.RemoteHosts.Count; i++)
                    m_Core.Config.RemoteHosts[i].CheckStatus();
            }));
            remoteStatusThread.Start();

            sendErrorReportToolStripMenuItem.Enabled = OfficialVersion || BetaVersion;

            // create default layout if layout failed to load
            if (!loaded)
            {
                m_Core.GetAPIInspector().Show(dockPanel);
                m_Core.GetEventBrowser().Show(m_Core.GetAPIInspector().Pane, DockAlignment.Top, 0.5);

                m_Core.GetPipelineStateViewer().Show(dockPanel);

                var bv = m_Core.GetMeshViewer();
                bv.InitFromPersistString("");
                bv.Show(dockPanel);

                var tv = m_Core.GetTextureViewer();
                tv.InitFromPersistString("");
                tv.Show(dockPanel);

                m_Core.GetTimelineBar().Show(dockPanel);

                if (m_Core.CaptureDialog == null)
                    m_Core.CaptureDialog = new Dialogs.CaptureDialog(m_Core, OnCaptureTrigger, OnInjectTrigger);

                m_Core.CaptureDialog.InjectMode = false;
                m_Core.CaptureDialog.Show(dockPanel);
            }

            PopulateRecentFiles();
            PopulateRecentCaptures();

            if (m_InitRemoteIdent != 0)
            {
                var live = new LiveCapture(m_Core, m_InitRemoteHost, m_InitRemoteIdent, this);
                ShowLiveCapture(live);
            }

            if (m_InitFilename.Length > 0)
            {
                LoadFromFilename(m_InitFilename);

                m_InitFilename = "";
            }
        }