/// <summary> /// Starts API monitoring and intercepting of debug output /// </summary> public void Start() { bool canConnectDebugger = this.XboxViewItem.XboxDevice.ConnectDebugger(false); if (!canConnectDebugger) { MessageBoxResult result = MessageBox.Show("Another debugging session with this Xbox is already present. Do you want to connect anyway?", "Error", MessageBoxButton.YesNo, MessageBoxImage.Exclamation); if (result == MessageBoxResult.Yes) { canConnectDebugger = this.XboxViewItem.XboxDevice.ConnectDebugger(true); } } if (!canConnectDebugger) { this.XboxViewItem.DebugOutputViewModel = null; } else { this.debugOutputWindow = new DebugOutputWindow(this); this.debugOutputWindow.Closing += this.OnWindowClosing; this.OutputDebugStringASymbolSession = new DebugOutputMonitorAPISession(this, this.XboxViewItem.XboxDevice.MonitorAPI("OutputDebugStringA", this.InterceptAPICall), false); this.OutputDebugStringWSymbolSession = new DebugOutputMonitorAPISession(this, this.XboxViewItem.XboxDevice.MonitorAPI("OutputDebugStringW", this.InterceptAPICall), false); this.monitorAPISessions.Add(this.OutputDebugStringASymbolSession); this.monitorAPISessions.Add(this.OutputDebugStringWSymbolSession); this.XboxViewItem.XboxDevice.StartMonitoringDebugOutput(this.ReceiveDebugOutput); this.XboxViewItem.XboxDevice.StartMonitoringTitleFailures(this.OnTitleFailure); // Read XML config file for debug string XmlDocument configFile = new XmlDocument(); configFile.Load(@"DebugStrings.cfg"); XmlNodeList nodes = configFile.DocumentElement.SelectNodes("/DebugStringsConfig/GoodPrefixes/GoodPrefix"); foreach (XmlNode n in nodes) { this.safeDebugOutputPrefixText.Add(n.InnerText); } // Read XML config file for API monitor symbols configFile = new XmlDocument(); configFile.Load(@"MonitorAPISymbols.cfg"); nodes = configFile.DocumentElement.SelectNodes("/MonitorAPISymbols/MonitorAPISymbol"); foreach (XmlNode n in nodes) { this.MonitorAPISymbols.Add(new MonitorAPISymbol(n.InnerText)); } // Compose a unique name. TODO: verify valid file and path name string folderName = DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss") + "_DebugOutput"; this.logDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "CAT", folderName); Directory.CreateDirectory(this.logDirectory); this.Log("Debug Output For: " + this.XboxViewItem.XboxDevice.Name); this.debugOutputWindow.Show(); } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.DebugOutput = ((CAT.DebugOutputWindow)(target)); return; case 2: #line 45 "..\..\DebugOutput.xaml" ((System.Windows.Controls.ListView)(target)).SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.ListView_SelectionChanged); #line default #line hidden return; case 3: this.DebugOutputBox = ((System.Windows.Controls.RichTextBox)(target)); return; } this._contentLoaded = true; }