Ejemplo n.º 1
0
        private void ExportSelectedPacketsToSet(object sender, RoutedEventArgs e)
        {
            var packets = new List <byte[]>();

            foreach (var item in PacketListView.SelectedItems)
            {
                packets.Add(((PacketEntry)item).Data);
            }

            var fileDialog = new SaveFileDialog {
                Filter = @"DAT|*.dat"
            };

            var result = fileDialog.ShowDialog();

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                File.WriteAllBytes(fileDialog.FileName, InjectablePacketBuilder.BuildSet(packets));
                MessageBox.Show($"Packet Set containing {packets.Count} packets saved to {fileDialog.FileName}.", "FFXIVMon Reborn", MessageBoxButton.OK, MessageBoxImage.Asterisk);
            }
        }
Ejemplo n.º 2
0
        private void ExportSelectedSetsForReplay(object sender, RoutedEventArgs e)
        {
            var items = PacketListView.SelectedItems;

            if (items.Count == 0)
            {
                MessageBox.Show("No packets selected.", "Error", MessageBoxButton.OK,
                                MessageBoxImage.Error);
                return;
            }

            FolderBrowserDialog dialog = new FolderBrowserDialog();

            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                List <int> inSetIndexes = new List <int>();

                int count = 0;

                foreach (var item in items)
                {
                    var startPacket = (PacketEntry)item;

                    int index = PacketListView.Items.IndexOf(startPacket);

                    if (inSetIndexes.Contains(index) || startPacket.Direction == "C")
                    {
                        continue;
                    }

                    List <byte[]> packets = new List <byte[]>();
                    packets.Add(startPacket.Data);

                    int at = index - 1;
                    while (true && at != 0 && at != -1)
                    {
                        if (((PacketEntry)PacketListView.Items[at]).Set == startPacket.Set)
                        {
                            packets.Insert(0, ((PacketEntry)PacketListView.Items[at]).Data);
                            inSetIndexes.Add(at);
                        }
                        else
                        {
                            break;
                        }
                        at--;
                    }

                    at = index + 1;
                    while (true && at < PacketListView.Items.Count)
                    {
                        if (((PacketEntry)PacketListView.Items[at]).Set == startPacket.Set)
                        {
                            packets.Add(((PacketEntry)PacketListView.Items[at]).Data);
                            inSetIndexes.Add(at);
                        }
                        else
                        {
                            break;
                        }
                        at++;
                    }

                    Console.WriteLine(packets.Count);

                    File.WriteAllBytes(System.IO.Path.Combine(dialog.SelectedPath, $"{startPacket.SystemMsTime.ToString("D14")}-No{count}.dat"),
                                       InjectablePacketBuilder.BuildSet(packets));
                    count++;
                }
                MessageBox.Show($"{count} Sets saved to {dialog.SelectedPath}.", "FFXIVMon Reborn", MessageBoxButton.OK, MessageBoxImage.Asterisk);
            }
        }
Ejemplo n.º 3
0
        private void ExportSelectedPacketSetToDat(object sender, RoutedEventArgs e)
        {
            var items = PacketListView.SelectedItems;

            if (items.Count == 0)
            {
                MessageBox.Show("No packet selected.", "Error", MessageBoxButton.OK,
                                MessageBoxImage.Error);
                return;
            }
            else if (items.Count == 1)
            {
                var startPacket = (PacketEntry)PacketListView.Items[PacketListView.SelectedIndex];

                List <byte[]> packets = new List <byte[]>();
                packets.Add(startPacket.Data);

                int at = PacketListView.SelectedIndex - 1;
                while (true)
                {
                    if (((PacketEntry)PacketListView.Items[at]).Set == startPacket.Set)
                    {
                        packets.Insert(0, ((PacketEntry)PacketListView.Items[at]).Data);
                    }
                    else
                    {
                        break;
                    }
                    at--;
                }

                at = PacketListView.SelectedIndex + 1;
                while (true)
                {
                    if (((PacketEntry)PacketListView.Items[at]).Set == startPacket.Set)
                    {
                        packets.Add(((PacketEntry)PacketListView.Items[at]).Data);
                    }
                    else
                    {
                        break;
                    }
                    at++;
                }

                Console.WriteLine(packets.Count);

                var fileDialog = new SaveFileDialog {
                    Filter = @"DAT|*.dat"
                };

                var result = fileDialog.ShowDialog();
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    File.WriteAllBytes(fileDialog.FileName, InjectablePacketBuilder.BuildSet(packets));
                    MessageBox.Show($"Packet Set containing {packets.Count} packets saved to {fileDialog.FileName}.", "FFXIVMon Reborn", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                }
            }
            else
            {
                MessageBox.Show("Please only select one packet.", "Error", MessageBoxButton.OK,
                                MessageBoxImage.Error);
                return;
            }
        }