public MainWindow() { InitializeComponent(); #if !DEBUG AppDomain.CurrentDomain.UnhandledException += delegate(object sender, UnhandledExceptionEventArgs eventArgs) { new ExtendedErrorView("FFXIVMon Reborn ran into an error and needs to close.", eventArgs.ExceptionObject.ToString(), "Unhandled Exception").ShowDialog(); Process.GetCurrentProcess().Kill(); }; #endif bool loadedByArg = false; var args = Environment.GetCommandLineArgs(); for (var i = 1; i + 1 < args.Length; i += 2) { if (args[i] == "--xml") { var tab = new TabItem(); tab.Content = new XivMonTab(); tab.Header = "New Capture"; ((XivMonTab)tab.Content).SetParents(tab, this); MainTabControl.Items.Add(tab); ((XivMonTab)tab.Content).LoadCapture(args[i + 1]); loadedByArg = true; } } if (!loadedByArg) { var item = new TabItem(); item.Content = new XivMonTab(); item.Header = "New Capture"; ((XivMonTab)item.Content).SetParents(item, this); MainTabControl.Items.Add(item); } // register the event that is fired after the key press. _kbHook.KeyPressed += hook_KeyPressed; try { _kbHook.RegisterHotKey(ModifierKeys.Control | ModifierKeys.Alt, Keys.F12); } catch (Exception) { // ignored } CaptureMode = (TCPNetworkMonitor.NetworkMonitorType)Properties.Settings.Default.NetworkMonitorType; if (CaptureMode == TCPNetworkMonitor.NetworkMonitorType.RawSocket) { SwitchModeSockets.IsChecked = true; } else { SwitchModePcap.IsChecked = true; } try { ExdReader.Init(Properties.Settings.Default.GamePath); } catch (Exception exc) { new ExtendedErrorView("Unable to init EXD data. Please check your game path in Options -> Set Game Path.", exc.ToString(), "FFXIVMon Reborn").ShowDialog(); Properties.Settings.Default.LoadEXD = false; } if (!Properties.Settings.Default.DontUsePacketTimestamp) { DontUsePacketTimestamp.IsChecked = false; Properties.Settings.Default.DontUsePacketTimestamp = false; } else { CaptureFlags |= MachinaCaptureWorker.ConfigFlags.DontUsePacketTimestamp; DontUsePacketTimestamp.IsChecked = true; Properties.Settings.Default.DontUsePacketTimestamp = true; } if (Properties.Settings.Default.ForceRealtimePriority) { Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime; ForceRealtimePriority.IsChecked = true; } if (Properties.Settings.Default.LoadEXD) { ExEnabledCheckbox.IsChecked = true; } if (Properties.Settings.Default.EnableFsWatcher) { WatchDefFilesCheckBox.IsChecked = true; } if (Properties.Settings.Default.HideHexBoxActorId) { HideHexBoxActorIdCheckBox.IsChecked = true; } VersioningProvider.LocalDbChanged += VersioningProviderOnLocalDbChanged; ScriptDebugView.Show(); ScriptDebugView.Visibility = Visibility.Hidden; VersionChecker.CheckVersion(); }
private void Scripting_OpenOutputWindow(object sender, RoutedEventArgs e) { ScriptDebugView.Show(); }