void AddPS3Targets() { // Get the PS3 IP addresses if (Ps3TmApi.Available) { int result = Ps3TmApi.SNPS3InitTargetComms(); currentConnectMessageBox = this; result = Ps3TmApi.SNPS3EnumerateTargetsEx(GetPS3TargetInfoCallback, IntPtr.Zero); currentConnectMessageBox = null; result = Ps3TmApi.SNPS3CloseTargetComms(); } else { System.Console.WriteLine("Failed to load PS3 Target Manager API"); } }
public LogData ProcessLog(StatoscopeForm ssForm) { TcpClient client = null; bool bShouldLogToFile = false; string connectionName = ""; using (ConnectMessageBox connectMsgBox = new ConnectMessageBox()) { bool successful = false; while (!successful) { if (connectMsgBox.ShowDialog() == DialogResult.OK) { try { client = new TcpClient(connectMsgBox.IpAddress, connectMsgBox.Port); bShouldLogToFile = connectMsgBox.logToFileCheckBox.Checked; connectionName = connectMsgBox.ConnectionName; successful = true; } catch (Exception ex) { ex.ToString(); ConnectionErrorDialog ced = new ConnectionErrorDialog(); ced.errorLabel.Text += connectMsgBox.IpAddress + ":" + connectMsgBox.Port; ced.ShowDialog(); } } else { return(null); } } } string logWriteFilename = ""; if (bShouldLogToFile) { SaveFileDialog fd = new SaveFileDialog(); fd.CheckFileExists = false; fd.FileName = "log.bin"; fd.Filter = "Binary log files (*.bin)|*.bin|All files (*.*)|*.*"; fd.FilterIndex = 0; if (fd.ShowDialog() == DialogResult.OK) { logWriteFilename = fd.FileName; } } SocketSessionInfo sessionInfo = new SocketSessionInfo(connectionName, logWriteFilename); SocketLogData logData = new SocketLogData(sessionInfo); logData.ProcessRecords(); List <LogRange> logRanges = new List <LogRange>(); LogRange logRange = new LogRange(logData, null); logRanges.Add(logRange); ssForm.AddToLogRangeList(logRange); ssForm.CreateLogControlTabPage(logRanges, connectionName, null); ThreadPool.QueueUserWorkItem(new WaitCallback(ProcessSocketDataStreamCB), new SSocketParseArgs(logData, logWriteFilename, client)); return(logData); }