示例#1
0
        private void ApplySpecificStructToPacket(object sender, RoutedEventArgs e)
        {
            if (PacketListView.SelectedIndex == -1)
            {
                return;
            }

            var view = new StructSelectView(_db.ServerZoneIpcType);

            view.ShowDialog();

            var item = (PacketEntry)PacketListView.Items[PacketListView.SelectedIndex];

            StructListView.Items.Clear();

            try
            {
                if (item.Direction == "S")
                {
                    var structText = _db.GetServerZoneStruct(view.GetSelectedOpCode());

                    var structProvider = new Struct();
                    var structEntries  = structProvider.Parse(structText, item.Data);

                    foreach (var entry in structEntries.Item1)
                    {
                        StructListView.Items.Add(entry);
                    }

                    if (_mainWindow.ShowObjectMapCheckBox.IsChecked)
                    {
                        new ExtendedErrorView("Object map for " + item.Name, structEntries.Item2.Print(), "FFXIVMon Reborn").ShowDialog();
                    }
                }
                else
                {
                    StructListItem infoItem = new StructListItem();
                    infoItem.NameCol = "Client Packet";
                    StructListView.Items.Add(infoItem);
                    return;
                }
            }
            catch (Exception exc)
            {
                new ExtendedErrorView($"[XivMonTab] Struct error! Could not get struct for {item.Name} - {item.Message}", exc.ToString(), "Error").ShowDialog();
            }

            UpdateInfoLabel();
        }