コード例 #1
0
ファイル: XivMonTab.xaml.cs プロジェクト: dio85/ffxivmon
        public void LoadCapture(string path)
        {
            PacketListView.Items.Clear();
            _currentXmlFile = path;
            ChangeTitle(System.IO.Path.GetFileNameWithoutExtension(_currentXmlFile));

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

                _commitSha = null;
                _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
            }
        }
コード例 #2
0
ファイル: XivMonTab.xaml.cs プロジェクト: dio85/ffxivmon
        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
                {
                    capture.LastSavedAppCommit = Util.GetGitHash();
                    XmlCaptureImporter.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();
        }
コード例 #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";

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

                    new ExtendedErrorView($"Compared {baseCap.Length} packets to {toDiff.Length} packets.",
                                          CaptureDiff.GenerateDataBasedReport(baseCap, toDiff), "FFXIVMon Reborn").Show();
                }
            }
            catch (Exception ex)
            {
                new ExtendedErrorView("Could not generate data based diff.", ex.ToString(), "Error").ShowDialog();
            }
        }
コード例 #4
0
ファイル: XivMonTab.xaml.cs プロジェクト: dio85/ffxivmon
        public XivMonTab()
        {
            InitializeComponent();

            try
            {
                if (!string.IsNullOrEmpty(_currentXmlFile))
                {
                    ChangeTitle(System.IO.Path.GetFileNameWithoutExtension(_currentXmlFile));
                    var capture = XmlCaptureImporter.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();
            }
        }