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) { if (_scripting == null) { _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_RunOnPacket(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); RunScriptsOnNewCheckBox.IsChecked = false; return; } } }
private void Scripting_LoadScripts(object sender, RoutedEventArgs e) { _scripting = new Scripting(); _scripting.LoadScripts(System.IO.Path.Combine(Environment.CurrentDirectory, "Scripts")); }