Esempio n. 1
0
        private void CaptureAdded(uint ID, string executable, string api, byte[] thumbnail, DateTime timestamp)
        {
            if (thumbnail == null || thumbnail.Length == 0)
            {
                using (Image t = MakeThumb(thumbs.ImageSize, null))
                {
                    thumbs.Images.Add(t);
                }
            }
            else
            {
                using (var ms = new MemoryStream(thumbnail))
                    using (Image t = MakeThumb(thumbs.ImageSize, ms))
                    {
                        thumbs.Images.Add(t);
                    }
            }

            CaptureLog log = new CaptureLog();

            log.remoteID  = ID;
            log.exe       = executable;
            log.api       = api;
            log.timestamp = timestamp;
            log.copying   = true;
            log.saved     = false;

            var item = new ListViewItem(new string[] { log.exe + " (Copying)", log.api, log.timestamp.ToString() }, thumbs.Images.Count - 1);

            item.Tag = log;
            item.SubItems[0].Font = new Font(item.SubItems[0].Font, FontStyle.Italic);

            captures.Items.Add(item);
        }
Esempio n. 2
0
        private bool SaveCapture(CaptureLog log)
        {
            if (log.copying)
            {
                return(false);
            }

            string path = m_Main.GetSavePath();

            // we copy the temp log to the desired path, but the log item remains referring to the temp path.
            // This ensures that if the user deletes the saved path we can still open or re-save it.
            if (path.Length > 0)
            {
                try
                {
                    File.Copy(log.localpath, path, true);
                    log.saved = true;
                    m_Core.Config.AddRecentFile(m_Core.Config.RecentLogFiles, path, 10);
                    m_Main.PopulateRecentFiles();
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show("Couldn't save to " + path + Environment.NewLine + ex.ToString(), "Cannot save",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                return(true);
            }

            return(false);
        }
Esempio n. 3
0
 public void CaptureWrongOrder() => Assert.Throws <InvalidOperationException>(() =>
 {
     using (var captureLog = new CaptureLog(_capturePath, _filePath, false))
     {
         captureLog.StopCapture();
     }
 });
Esempio n. 4
0
 public void CaptureWrongOrderEntirePath()
 {
     using (var captureLog = new CaptureLog(_capturePath, _filePath, true))
     {
         captureLog.StopCapture();
     }
 }
Esempio n. 5
0
        public void ExitCodeFromPreviousRunIsIgnored()
        {
            var previousLog =
                "Nov 18 04:31:44 dci-mac-build-053 CloudKeychainProxy[67121]: objc[67121]: Class MockAKSRefKeyObject is implemented in both /Applications/Xcode115.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Security.framework/Security (0x10350b738) and /Applications/Xcode115.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Security.framework/CloudKeychainProxy.bundle/CloudKeychainProxy (0x103259970). One of the two will be used. Which one is undefined." + Environment.NewLine +
                "Nov 18 04:31:44 dci-mac-build-053 CloudKeychainProxy[67121]: objc[67121]: Class MockAKSOptionalParameters is implemented in both /Applications/Xcode115.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Security.framework/Security (0x10350b788) and /Applications/Xcode115.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Security.framework/CloudKeychainProxy.bundle/CloudKeychainProxy (0x1032599c0). One of the two will be used. Which one is undefined." + Environment.NewLine +
                "Nov 18 04:31:44 dci-mac-build-053 CloudKeychainProxy[67121]: objc[67121]: Class SecXPCHelper is implemented in both /Applications/Xcode115.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Security.framework/Security (0x10350b918) and /Applications/Xcode115.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Security.framework/CloudKeychainProxy.bundle/CloudKeychainProxy (0x103259a60). One of the two will be used. Which one is undefined." + Environment.NewLine +
                "Nov 18 04:31:44 dci-mac-build-053 ML-MacVM com.apple.CoreSimulator.SimDevice.2E1EE736-5672-4220-89B5-B7C77DB6AF18[55655] (UIKitApplication:net.dot.HelloiOS[9a0b][rb-legacy][57331]): Some other error message" + Environment.NewLine +
                "Nov 18 04:31:44 dci-mac-build-053 ML-MacVM com.apple.CoreSimulator.SimDevice.2E1EE736-5672-4220-89B5-B7C77DB6AF18[55655] (UIKitApplication:net.dot.HelloiOS[9a0b][rb-legacy][57331]): Service exited with abnormal code: 55" + Environment.NewLine +
                "Nov 18 04:31:44 dci-mac-build-053 com.apple.CoreSimulator.SimDevice.F67392D9-A327-4217-B924-5DA0918415E5[811] (com.apple.security.cloudkeychainproxy3): Service only ran for 0 seconds. Pushing respawn out by 10 seconds." + Environment.NewLine;

            var currentRunLog =
                "Nov 18 04:31:44 dci-mac-build-053 CloudKeychainProxy[67121]: objc[67121]: Class MockAKSRefKeyObject is implemented in both /Applications/Xcode115.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Security.framework/Security (0x10350b738) and /Applications/Xcode115.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Security.framework/CloudKeychainProxy.bundle/CloudKeychainProxy (0x103259970). One of the two will be used. Which one is undefined." + Environment.NewLine +
                "Nov 18 04:31:44 dci-mac-build-053 CloudKeychainProxy[67121]: objc[67121]: Class MockAKSOptionalParameters is implemented in both /Applications/Xcode115.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Security.framework/Security (0x10350b788) and /Applications/Xcode115.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Security.framework/CloudKeychainProxy.bundle/CloudKeychainProxy (0x1032599c0). One of the two will be used. Which one is undefined." + Environment.NewLine +
                "Nov 18 04:31:44 dci-mac-build-053 CloudKeychainProxy[67121]: objc[67121]: Class SecXPCHelper is implemented in both /Applications/Xcode115.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Security.framework/Security (0x10350b918) and /Applications/Xcode115.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Security.framework/CloudKeychainProxy.bundle/CloudKeychainProxy (0x103259a60). One of the two will be used. Which one is undefined." + Environment.NewLine +
                "Nov 18 04:31:44 dci-mac-build-053 ML-MacVM com.apple.CoreSimulator.SimDevice.2E1EE736-5672-4220-89B5-B7C77DB6AF18[55655] (UIKitApplication:net.dot.HelloiOS[9a0b][rb-legacy][57331]): Some other error message" + Environment.NewLine +
                "Nov 18 04:31:44 dci-mac-build-053 ML-MacVM com.apple.CoreSimulator.SimDevice.2E1EE736-5672-4220-89B5-B7C77DB6AF18[55655] (UIKitApplication:net.dot.HelloiOS[9a0b][rb-legacy][57331]): Service exited with abnormal code: 72" + Environment.NewLine +
                "Nov 18 04:31:44 dci-mac-build-053 com.apple.CoreSimulator.SimDevice.F67392D9-A327-4217-B924-5DA0918415E5[811] (com.apple.security.cloudkeychainproxy3): Service only ran for 0 seconds. Pushing respawn out by 10 seconds." + Environment.NewLine;

            var tempFilename = Path.GetTempFileName();

            File.WriteAllText(tempFilename, previousLog);

            var capturedFilename = Path.GetTempFileName();

            using var captureLog = new CaptureLog(capturedFilename, tempFilename, false);
            captureLog.StartCapture();
            File.AppendAllText(tempFilename, currentRunLog);
            captureLog.StopCapture();

            var appBundleInformation = new AppBundleInformation("net.dot.HelloiOS", "net.dot.HelloiOS", "some/path", "some/path", false, null);
            var exitCode             = new iOSExitCodeDetector().DetectExitCode(appBundleInformation, captureLog);

            Assert.Equal(72, exitCode);
        }
Esempio n. 6
0
 public void ConstructorNullFilePath()
 {
     Assert.Throws <ArgumentNullException>(() =>
     {
         var captureLog = new CaptureLog(null, _filePath, false);
     });
 }
Esempio n. 7
0
    public void CapturePieceByPiece()
    {
        var ignoredLine = "This line should not be captured";
        var logLines    = new[] { "first line", "second line", "third line" };

        File.WriteAllLines(_sourcePath, new[] { ignoredLine });

        using var captureLog = new CaptureLog(_destinationPath, _sourcePath, false);
        captureLog.StartCapture();

        File.AppendAllLines(_destinationPath, logLines.Take(1));
        captureLog.Flush();
        Assert.Contains(logLines.First(), File.ReadAllText(_destinationPath));

        File.AppendAllLines(_destinationPath, logLines.Skip(1));

        captureLog.StopCapture();

        // Get the stream and assert we do have the correct lines
        using var captureStream = captureLog.GetReader();
        string logLine;

        while ((logLine = captureStream.ReadLine()) != null)
        {
            Assert.NotEqual(ignoredLine, logLine);

            if (!string.IsNullOrEmpty(logLine))
            {
                Assert.Contains(logLine, logLines);
            }
        }
    }
Esempio n. 8
0
        public void CaptureRightOrder()
        {
            var ignoredLine = "This lines should not be captured";
            var logLines    = new[] { "first line", "second line", "thrid line" };

            File.WriteAllLines(_filePath, new[] { ignoredLine });

            using var captureLog = new CaptureLog(_capturePath, _filePath, false);

            captureLog.StartCapture();
            File.WriteAllLines(_filePath, logLines);
            captureLog.StopCapture();

            // get the stream and assert we do have the correct lines
            using var captureStream = captureLog.GetReader();
            string logLine;

            while ((logLine = captureStream.ReadLine()) != null)
            {
                if (!string.IsNullOrEmpty(logLine))
                {
                    Assert.Contains(logLine, logLines);
                }
            }
        }
Esempio n. 9
0
        public void CaptureRightOrder()
        {
            var ignoredLine = "This lines should not be captured";
            var logLines    = new[] { "first line", "second line", "thrid line" };

            using (var stream = File.Create(_filePath))
                using (var writer = new StreamWriter(stream))
                {
                    writer.WriteLine(ignoredLine);
                }
            using (var captureLog = new CaptureLog(_capturePath, _filePath, false))
            {
                captureLog.StartCapture();
                using (var writer = new StreamWriter(_filePath))
                {
                    foreach (var line in logLines)
                    {
                        writer.WriteLine(line);
                    }
                }
                captureLog.StopCapture();
                // get the stream and assert we do have the correct lines
                using (var captureStream = captureLog.GetReader())
                {
                    string line;
                    while ((line = captureStream.ReadLine()) != null)
                    {
                        Assert.Contains(line, logLines);
                    }
                }
            }
        }
Esempio n. 10
0
 public void CaptureWrongOrder()
 {
     Assert.Throws <InvalidOperationException>(() =>
     {
         using var captureLog = new CaptureLog(_destinationPath, _sourcePath, false);
         captureLog.StopCapture();
     });
 }
Esempio n. 11
0
 public void CaptureWrongOrderEntirePath()
 {
     Assert.DoesNotThrow(() => {
         using (var captureLog = new CaptureLog(capturePath, filePath, true)) {
             captureLog.StopCapture();
         }
     });
 }
Esempio n. 12
0
 private void OpenCapture(CaptureLog log)
 {
     if (!log.copying)
     {
         m_Main.LoadLogfile(log.localpath, !log.saved);
         log.opened = true;
     }
 }
Esempio n. 13
0
        private void CaptureAdded(uint ID, string executable, string api, byte[] thumbnail, DateTime timestamp, string path, bool local)
        {
            if (thumbnail == null || thumbnail.Length == 0)
            {
                using (Image t = MakeThumb(thumbs.ImageSize, null))
                {
                    thumbs.Images.Add(t);
                }
            }
            else
            {
                using (var ms = new MemoryStream(thumbnail))
                    using (Image t = MakeThumb(thumbs.ImageSize, ms))
                    {
                        thumbs.Images.Add(t);
                    }
            }

            CaptureLog log = new CaptureLog();

            log.remoteID  = ID;
            log.exe       = executable;
            log.api       = api;
            log.timestamp = timestamp;
            log.thumb     = null;
            try
            {
                if (thumbnail != null && thumbnail.Length != 0)
                {
                    using (var ms = new MemoryStream(thumbnail))
                        log.thumb = Image.FromStream(ms);
                }
            }
            catch (ArgumentException)
            {
            }
            log.saved = false;
            log.path  = path;
            log.local = local;

            string title = log.exe;

            if (!local)
            {
                title += " (Remote)";
            }

            var item = new ListViewItem(new string[] { title, log.api, log.timestamp.ToString() }, thumbs.Images.Count - 1);

            item.Tag = log;
            if (!local)
            {
                item.SubItems[0].Font = new Font(item.SubItems[0].Font, FontStyle.Italic);
            }

            captures.Items.Add(item);
        }
Esempio n. 14
0
        public void insertCaptureLog()
        {
            CaptureLog captureLog = new CaptureLog();

            captureLog.AdapterName = Globals.DeviceInfo.Name;
            captureLog.StartTime   = Globals.StartTime;
            captureLog.EndTime     = DateTime.Now;
            captureLog.Packets     = captNum;
            captureLog.Bytes       = captLen;
            serviceStackDBHelper.InsertCaptureLog(captureLog);
        }
Esempio n. 15
0
        private bool SaveCapture(CaptureLog log)
        {
            string path = m_Main.GetSavePath();

            // we copy the temp log to the desired path, but the log item remains referring to the temp path.
            // This ensures that if the user deletes the saved path we can still open or re-save it.
            if (path.Length > 0)
            {
                try
                {
                    if (log.local)
                    {
                        File.Copy(log.path, path, true);
                    }
                    else if (m_Connection.Connected)
                    {
                        // if we have a current live connection, prefer using it
                        m_CopyLogLocalPath = path;
                        m_CopyLogID        = log.remoteID;
                    }
                    else
                    {
                        if (m_Core.Renderer.Remote == null ||
                            m_Core.Renderer.Remote.Hostname != m_Host ||
                            !m_Core.Renderer.Remote.Connected)
                        {
                            MessageBox.Show(
                                String.Format("This capture is on remote host {0} and there is no active replay context on that host.\n" +
                                              "Without an active replay context the capture cannot be saved, try switching to a replay context on {0}.\n\n", m_Host),
                                "No active replay context", MessageBoxButtons.OK);
                            return(false);
                        }

                        m_Core.Renderer.CopyCaptureFromRemote(log.path, path, this);
                        m_Core.Renderer.DeleteCapture(log.path, false);
                    }

                    log.saved = true;
                    log.path  = path;
                    m_Core.Config.AddRecentFile(m_Core.Config.RecentLogFiles, path, 10);
                    m_Main.PopulateRecentFiles();
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show("Couldn't save to " + path + Environment.NewLine + ex.ToString(), "Cannot save",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                return(true);
            }

            return(false);
        }
Esempio n. 16
0
 public void CaptureMissingFileTest()
 {
     using (var captureLog = new CaptureLog(capturePath, filePath, false)) {
         Assert.AreEqual(capturePath, captureLog.FullPath, "capture path");
         captureLog.StartCapture();
         captureLog.StopCapture();
     }
     // read the data that was added to the capture path and  ensure that we do have the name of the missing file
     using (var reader = new StreamReader(capturePath)) {
         var line = reader.ReadLine();
         StringAssert.Contains(filePath, line, "file path missing");
     }
 }
Esempio n. 17
0
    public void CaptureMissingFileTest()
    {
        using (var captureLog = new CaptureLog(_destinationPath, _sourcePath, false))
        {
            Assert.Equal(_destinationPath, captureLog.FullPath);
            captureLog.StartCapture();
            captureLog.StopCapture();
        }

        // Read the data that was added to the capture path and  ensure that we do have the name of the missing file
        using (var reader = new StreamReader(_destinationPath))
        {
            var line = reader.ReadLine();
            Assert.Contains(_sourcePath, line);
        }
    }
Esempio n. 18
0
 public bool InsertCaptureLog(CaptureLog captureLog)
 {
     using (db = dbFactory.Open())
     {
         try
         {
             var flag = db.Insert <CaptureLog>(captureLog);
             if (flag >= 0)
             {
                 return(true);
             }
         }
         catch (Exception)
         {
         }
         return(false);
     }
 }
Esempio n. 19
0
        private void OpenCapture(CaptureLog log)
        {
            log.opened = true;

            if (!log.local &&
                (m_Core.Renderer.Remote == null ||
                 m_Core.Renderer.Remote.Hostname != m_Host ||
                 !m_Core.Renderer.Remote.Connected)
                )
            {
                MessageBox.Show(
                    String.Format("This capture is on remote host {0} and there is no active replay context on that host.\n" +
                                  "You can either save the log locally, or switch to a replay context on {0}.\n\n", m_Host),
                    "No active replay context", MessageBoxButtons.OK);
                return;
            }

            m_Main.LoadLogfile(log.path, !log.saved, log.local);
        }
Esempio n. 20
0
        private bool SaveCapture(CaptureLog log)
        {
            if (log.copying)
            {
                return(false);
            }

            string path = m_Main.GetSavePath();

            if (path.Length > 0)
            {
                File.Copy(log.localpath, path, true);
                File.Delete(log.localpath);

                log.localpath = path;
                log.saved     = true;
                return(true);
            }

            return(false);
        }
Esempio n. 21
0
    public void CaptureEverythingAtOnce()
    {
        var logLines = new[] { "first line", "second line", "third line" };

        File.WriteAllText(_sourcePath, string.Empty);

        using var captureLog = new CaptureLog(_destinationPath, _sourcePath, false);

        captureLog.StartCapture();
        File.AppendAllLines(_sourcePath, logLines);
        captureLog.StopCapture();

        // get the stream and assert we do have the correct lines
        using var captureStream = captureLog.GetReader();
        string logLine;

        while ((logLine = captureStream.ReadLine()) != null)
        {
            if (!string.IsNullOrEmpty(logLine))
            {
                Assert.Contains(logLine, logLines);
            }
        }
    }
Esempio n. 22
0
        private void captures_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            deleteMenu.Enabled   = (captures.SelectedItems.Count > 0);
            saveMenu.Enabled     = saveThisCaptureToolStripMenuItem.Enabled =
                openMenu.Enabled = openThisCaptureToolStripMenuItem.Enabled =
                    (captures.SelectedItems.Count == 1);

            if (captures.SelectedItems.Count == 1)
            {
                CaptureLog cap = captures.SelectedItems[0].Tag as CaptureLog;

                newInstanceToolStripMenuItem.Enabled = cap.local;

                if (cap.thumb != null)
                {
                    preview.Image = cap.thumb;
                }
                else
                {
                    preview.Image = null;
                    preview.Size  = new Size(16, 16);
                }
            }
        }
Esempio n. 23
0
        private bool SaveCapture(CaptureLog log)
        {
            if (log.copying) return false;

            string path = m_Main.GetSavePath();

            // we copy the temp log to the desired path, but the log item remains referring to the temp path.
            // This ensures that if the user deletes the saved path we can still open or re-save it.
            if (path.Length > 0)
            {
                File.Copy(log.localpath, path, true);
                return true;
            }

            return false;
        }
Esempio n. 24
0
        private bool SaveCapture(CaptureLog log)
        {
            if (log.copying) return false;

            string path = m_Main.GetSavePath();

            // we copy the temp log to the desired path, but the log item remains referring to the temp path.
            // This ensures that if the user deletes the saved path we can still open or re-save it.
            if (path.Length > 0)
            {
                try
                {
                    File.Copy(log.localpath, path, true);
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show("Couldn't save to " + path + Environment.NewLine + ex.ToString(), "Cannot save",
                                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                return true;
            }

            return false;
        }
Esempio n. 25
0
        private bool SaveCapture(CaptureLog log)
        {
            if (log.copying) return false;

            string path = m_Main.GetSavePath();

            if (path != "")
            {
                File.Copy(log.localpath, path, true);
                File.Delete(log.localpath);

                log.localpath = path;
                log.saved = true;
                return true;
            }

            return false;
        }
Esempio n. 26
0
        private void CaptureAdded(uint ID, string executable, string api, byte[] thumbnail, DateTime timestamp)
        {
            if (thumbnail == null || thumbnail.Length == 0)
            {
                using (Image t = MakeThumb(thumbs.ImageSize, null))
                {
                    thumbs.Images.Add(t);
                }
            }
            else
            {
                using (var ms = new MemoryStream(thumbnail))
                using (Image t = MakeThumb(thumbs.ImageSize, ms))
                {
                    thumbs.Images.Add(t);
                }
            }

            CaptureLog log = new CaptureLog();
            log.remoteID = ID;
            log.exe = executable;
            log.api = api;
            log.timestamp = timestamp;
            log.copying = true;
            log.saved = false;

            var item = new ListViewItem(new string[] { log.exe + " (Copying)", log.api, log.timestamp.ToString() }, thumbs.Images.Count - 1);
            item.Tag = log;
            item.SubItems[0].Font = new Font(item.SubItems[0].Font, FontStyle.Italic);

            captures.Items.Add(item);
        }
Esempio n. 27
0
        private bool SaveCapture(CaptureLog log)
        {
            string path = m_Main.GetSavePath();

            // we copy the temp log to the desired path, but the log item remains referring to the temp path.
            // This ensures that if the user deletes the saved path we can still open or re-save it.
            if (path.Length > 0)
            {
                try
                {
                    if (log.local)
                    {
                        File.Copy(log.path, path, true);
                    }
                    else if (m_Connection.Connected)
                    {
                        // if we have a current live connection, prefer using it
                        m_CopyLogLocalPath = path;
                        m_CopyLogID = log.remoteID;
                    }
                    else
                    {
                        if (m_Core.Renderer.Remote == null ||
                            m_Core.Renderer.Remote.Hostname != m_Host ||
                            !m_Core.Renderer.Remote.Connected)
                        {
                            MessageBox.Show(
                                String.Format("This capture is on remote host {0} and there is no active replay context on that host.\n" +
                                "Without an active replay context the capture cannot be saved, try switching to a replay context on {0}.\n\n", m_Host),
                                "No active replay context", MessageBoxButtons.OK);
                            return false;
                        }

                        m_Core.Renderer.CopyCaptureFromRemote(log.path, path, this);
                        m_Core.Renderer.DeleteCapture(log.path, false);
                    }

                    log.saved = true;
                    log.path = path;
                    m_Core.Config.AddRecentFile(m_Core.Config.RecentLogFiles, path, 10);
                    m_Main.PopulateRecentFiles();
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show("Couldn't save to " + path + Environment.NewLine + ex.ToString(), "Cannot save",
                                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                return true;
            }

            return false;
        }
Esempio n. 28
0
        private void OpenCapture(CaptureLog log)
        {
            log.opened = true;

            if (!log.local &&
               (m_Core.Renderer.Remote == null ||
                m_Core.Renderer.Remote.Hostname != m_Host ||
                !m_Core.Renderer.Remote.Connected)
              )
            {
                MessageBox.Show(
                    String.Format("This capture is on remote host {0} and there is no active replay context on that host.\n" +
                        "You can either save the log locally, or switch to a replay context on {0}.\n\n", m_Host),
                    "No active replay context", MessageBoxButtons.OK);
                return;
            }

            m_Main.LoadLogfile(log.path, !log.saved, log.local);
        }
Esempio n. 29
0
        private void CaptureAdded(uint ID, string executable, string api, byte[] thumbnail, DateTime timestamp, string path, bool local)
        {
            if (thumbnail == null || thumbnail.Length == 0)
            {
                using (Image t = MakeThumb(thumbs.ImageSize, null))
                {
                    thumbs.Images.Add(t);
                }
            }
            else
            {
                using (var ms = new MemoryStream(thumbnail))
                using (Image t = MakeThumb(thumbs.ImageSize, ms))
                {
                    thumbs.Images.Add(t);
                }
            }

            CaptureLog log = new CaptureLog();
            log.remoteID = ID;
            log.exe = executable;
            log.api = api;
            log.timestamp = timestamp;
            log.thumb = null;
            try
            {
                if (thumbnail != null && thumbnail.Length != 0)
                {
                    using (var ms = new MemoryStream(thumbnail))
                        log.thumb = Image.FromStream(ms);
                }
            }
            catch (ArgumentException)
            {
            }
            log.saved = false;
            log.path = path;
            log.local = local;

            string title = log.exe;
            if (!local)
                title += " (Remote)";

            var item = new ListViewItem(new string[] { title, log.api, log.timestamp.ToString() }, thumbs.Images.Count - 1);
            item.Tag = log;
            if(!local)
                item.SubItems[0].Font = new Font(item.SubItems[0].Font, FontStyle.Italic);

            captures.Items.Add(item);
        }
Esempio n. 30
0
 private void OpenCapture(CaptureLog log)
 {
     if (!log.copying)
     {
         m_Main.LoadLogfile(log.localpath, !log.saved);
         log.opened = true;
     }
 }
Esempio n. 31
0
 private void OpenCapture(CaptureLog log)
 {
     m_Main.LoadLogfile(log.path, !log.saved, log.local);
     log.opened = true;
 }