Esempio n. 1
0
        private void Scripting_RunOnCapture(object sender, RoutedEventArgs e)
        {
            var res = MessageBox.Show("Do you want to execute scripts on shown packets? This can take some time, depending on the amount of packets.\n\nPackets: " + PacketListView.Items.Count, "FFXIVMon Reborn", MessageBoxButton.OKCancel, MessageBoxImage.Question);

            if (res == MessageBoxResult.OK)
            {
                Scripting scripting = new Scripting();
                scripting.LoadScripts(System.IO.Path.Combine(Environment.CurrentDirectory, "Scripts"));

                try
                {
                    foreach (var item in PacketListView.Items)
                    {
                        if (((PacketListItem)item).IsVisible)
                        {
                            PacketEventArgs args = new PacketEventArgs((PacketListItem)item);

                            scripting.ExecuteScripts(null, args);
                        }
                    }
                    MessageBox.Show("Scripts ran successfully.", "FFXIVMon Reborn", MessageBoxButton.OK,
                                    MessageBoxImage.Asterisk);
                }
                catch (Exception exc)
                {
                    MessageBox.Show(
                        $"[Main] Script error!\n\n{exc}",
                        "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
            }
        }
Esempio n. 2
0
        private void Scripting_RunOnPacket(PacketEventArgs args)
        {
            if (_scripting == null)
            {
                MessageBox.Show("No scripts were loaded.", "Error", MessageBoxButton.OK,
                                MessageBoxImage.Error);
                RunScriptsOnNewCheckBox.IsChecked = false;
                return;
            }

            _scripting.ExecuteScripts(null, args);
        }