Пример #1
0
        public void SaveCapture()
        {
            if (_captureWorker != null)
            {
                MessageBox.Show("A capture is in progress.", "Error", MessageBoxButton.OK,
                                MessageBoxImage.Error);
                return;
            }

            var fileDialog = new System.Windows.Forms.SaveFileDialog {
                Filter = @"XML|*.xml"
            };

            var result = fileDialog.ShowDialog();

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                XmlCaptureOp.Save(PacketListView.Items, fileDialog.FileName, _wasCapturedMs, _version);
                MessageBox.Show($"Capture saved to {fileDialog.FileName}.", "FFXIVMon Reborn", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                _currentXmlFile = fileDialog.FileName;
                ChangeTitle(System.IO.Path.GetFileNameWithoutExtension(_currentXmlFile));
            }

            UpdateInfoLabel();
        }
Пример #2
0
        public void LoadCapture(string path)
        {
            PacketListView.Items.Clear();
            _currentXmlFile = path;
            ChangeTitle(System.IO.Path.GetFileNameWithoutExtension(_currentXmlFile));

            try
            {
                var capture = XmlCaptureOp.Load(path);

                _version = capture.Version;
                _db      = _mainWindow.VersioningProvider.GetDatabaseForVersion(_version);
                foreach (var packet in capture.Packets)
                {
                    // Add a packet to the view, but no update to the label
                    AddPacketToListView(packet, true);
                }

                // Backwards compatibility
                _wasCapturedMs = capture.UsingSystemTime != null && bool.Parse(capture.UsingSystemTime);

                UpdateInfoLabel();
            }
            catch (Exception exc)
            {
                new ExtendedErrorView($"Could not load capture at {path}.", exc.ToString(), "Error").ShowDialog();
                #if DEBUG
                throw;
                #endif
            }
        }
Пример #3
0
        private void Diff_BasedOnPacketData(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "XML|*.xml";
            openFileDialog.Title  = "Select a Capture to diff against";

            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var toDiff  = XmlCaptureOp.Load(openFileDialog.FileName).Packets;
                var baseCap = ((XivMonTab)MainTabControl.SelectedContent).PacketListView.Items.Cast <PacketListItem>().ToArray();

                new ExtendedErrorView($"Compared {baseCap.Length} packets to {toDiff.Length} packets.",
                                      CaptureDiff.GenerateDataBasedReport(baseCap, toDiff), "FFXIVMon Reborn").Show();
            }
        }
Пример #4
0
        public XivMonTab()
        {
            InitializeComponent();

            if (!string.IsNullOrEmpty(_currentXmlFile))
            {
                ChangeTitle(System.IO.Path.GetFileNameWithoutExtension(_currentXmlFile));
                var capture = XmlCaptureOp.Load(_currentXmlFile);
                foreach (PacketListItem packet in capture.Packets)
                {
                    AddPacketToListView(packet);
                }
                _wasCapturedMs = capture.UsingSystemTime;
            }

            UpdateInfoLabel();
        }
Пример #5
0
        public void LoadCapture(string path)
        {
            PacketListView.Items.Clear();
            _currentXmlFile = path;
            ChangeTitle(System.IO.Path.GetFileNameWithoutExtension(_currentXmlFile));

            var capture = XmlCaptureOp.Load(path);

            _version = capture.Version;
            _db      = _mainWindow.VersioningProvider.GetDatabaseForVersion(_version);
            foreach (PacketListItem packet in capture.Packets)
            {
                AddPacketToListView(packet);
            }
            _wasCapturedMs = capture.UsingSystemTime;

            UpdateInfoLabel();
        }
Пример #6
0
        public void SaveCapture()
        {
            if (_captureWorker != null)
            {
                MessageBox.Show("A capture is in progress.", "Error", MessageBoxButton.OK,
                                MessageBoxImage.Error);
                return;
            }

            var fileDialog = new System.Windows.Forms.SaveFileDialog {
                Filter = @"XML|*.xml"
            };

            var result = fileDialog.ShowDialog();

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                var capture = new Capture
                {
                    Packets         = PacketListView.Items.Cast <PacketEntry>().ToArray(),
                    UsingSystemTime = _wasCapturedMs.ToString().ToLower(),
                    Version         = _version
                };
                try
                {
                    XmlCaptureOp.Save(capture, fileDialog.FileName);
                    MessageBox.Show($"Capture saved to {fileDialog.FileName}.", "FFXIVMon Reborn", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                    _currentXmlFile = fileDialog.FileName;
                    ChangeTitle(System.IO.Path.GetFileNameWithoutExtension(_currentXmlFile));
                }
                catch (Exception ex)
                {
                    new ExtendedErrorView("Could not save capture.", ex.ToString(), "Error").ShowDialog();
                }
            }

            UpdateInfoLabel();
        }
Пример #7
0
        public XivMonTab()
        {
            InitializeComponent();

            try
            {
                if (!string.IsNullOrEmpty(_currentXmlFile))
                {
                    ChangeTitle(System.IO.Path.GetFileNameWithoutExtension(_currentXmlFile));
                    var capture = XmlCaptureOp.Load(_currentXmlFile);
                    foreach (var packet in capture.Packets)
                    {
                        AddPacketToListView(packet);
                    }
                    _wasCapturedMs = bool.Parse(capture.UsingSystemTime);
                }

                UpdateInfoLabel();
            }
            catch (Exception ex)
            {
                new ExtendedErrorView("Could not load XivMonTab.", ex.ToString(), "Error").ShowDialog();
            }
        }