private void button_SystemInfo_Click(object sender, EventArgs e) { try { this.sysinfoForm = new SystemInfoForm(); this.sysinfoForm.ShowDialog(this); } catch (Exception ex) { SimpleLogger.WriteLine(ex.Source); SimpleLogger.WriteLine(ex.Message); SimpleLogger.WriteLine(ex.StackTrace); } }
private void button_SystemInfo_Click(object sender, EventArgs e) { try { this.sysinfoForm = new SystemInfoForm(); this.sysinfoForm.ShowDialog(this); } catch (Exception ex) { SimpleLogger.WriteLine(ex.Source); SimpleLogger.WriteLine(ex.Message); SimpleLogger.WriteLine(ex.StackTrace); } }
private string getSystemInformation() { StringBuilder sb; ManagementObjectSearcher searcher; //try //{ sb = new StringBuilder(); sb.AppendLine(""); sb.AppendLine("========================================================"); sb.AppendLine(""); sb.AppendLine(" Trickster Tools System Infomation"); sb.AppendLine(""); sb.AppendLine("========================================================"); sb.AppendLine(""); /** * CPU情報取得 */ sb.Append("CPU : "); searcher = new ManagementObjectSearcher(@"root\CIMV2", "SELECT * FROM Win32_Processor"); foreach (ManagementObject queryObj in searcher.Get()) { sb.AppendLine(queryObj["Name"].ToString()); } sb.AppendLine(""); /** * メモリ情報取得 */ searcher = new ManagementObjectSearcher(@"root\CIMV2", "SELECT * FROM Win32_OperatingSystem"); sb.Append("System Memory : "); string SystemDrive = "C:"; foreach (ManagementObject queryObj in searcher.Get()) { //利用可能な物理メモリ sb.Append(queryObj["FreePhysicalMemory"].ToString()); sb.Append("/"); //合計物理メモリ sb.AppendLine(queryObj["TotalVisibleMemorySize"].ToString()); // システムドライブを取得 SystemDrive = queryObj["SystemDrive"].ToString(); } sb.AppendLine(""); /** * ハードディスク空き領域情報取得 */ searcher = new ManagementObjectSearcher(@"root\CIMV2", "SELECT * FROM Win32_LogicalDisk WHERE DriveType = 3 and DeviceID = '" + SystemDrive + "'"); sb.Append("Hardisk Space : "); foreach (ManagementObject queryObj in searcher.Get()) { sb.AppendLine((((ulong)queryObj["FreeSpace"] / 1024) / 1024) + " MBytes"); } sb.AppendLine(""); /** * ディスプレイドライバ情報 */ searcher = new ManagementObjectSearcher(@"root\CIMV2", "SELECT * FROM Win32_VideoController"); StringBuilder DisplayMode = new StringBuilder(); foreach (ManagementObject queryObj in searcher.Get()) { sb.Append("Graphic Card : "); if (queryObj["Name"] != null) { sb.Append(queryObj["Name"].ToString()); } sb.AppendLine(""); sb.AppendLine(""); sb.Append("Graphic Card Driver : "); if (queryObj["InstalledDisplayDrivers"] != null) { sb.Append(queryObj["InstalledDisplayDrivers"].ToString()); sb.Append(" ( " + queryObj["DriverVersion"].ToString() + ")"); } sb.AppendLine(""); sb.AppendLine(""); sb.Append("Graphic Card Memory : "); if (queryObj["AdapterRAM"] != null) { sb.Append(((uint)queryObj["AdapterRAM"] / 1024)); sb.Append(" Kbytes"); } sb.AppendLine(""); sb.AppendLine(""); if (queryObj["CurrentHorizontalResolution"] != null && queryObj["CurrentVerticalResolution"] != null) { DisplayMode.Append(queryObj["CurrentHorizontalResolution"].ToString()); DisplayMode.Append(" x "); DisplayMode.Append(queryObj["CurrentVerticalResolution"].ToString()); if (queryObj["CurrentRefreshRate"] != null) { DisplayMode.Append(" ("); DisplayMode.Append(queryObj["CurrentRefreshRate"].ToString()); DisplayMode.Append(")"); } if (queryObj["CurrentBitsPerPixel"] != null) { DisplayMode.Append(" "); DisplayMode.Append(queryObj["CurrentBitsPerPixel"].ToString()); DisplayMode.Append("bit"); } sb.AppendLine(""); } } /** * Direct X 情報取得 */ sb.Append("DirectX Version : DirectX "); sb.Append(SystemInfoForm.getDrirectXVersion()); sb.AppendLine(""); sb.AppendLine(""); /** * ディスプレイモードの情報を表示 */ if (DisplayMode.ToString() != "") { sb.Append("Display Mode : "); sb.Append(DisplayMode.ToString()); sb.AppendLine(""); sb.AppendLine(""); } /** * サウンドカード情報 */ searcher = new ManagementObjectSearcher(@"root\CIMV2", "SELECT * FROM Win32_SoundDevice"); foreach (ManagementObject queryObj in searcher.Get()) { sb.Append("Sound Card : "); if (queryObj["Name"] != null) { sb.Append(queryObj["Name"].ToString()); } sb.AppendLine(""); sb.AppendLine(""); break; } return(sb.ToString()); //} //catch(ArgumentOutOfRangeException aoore) //{ //SimpleLogger.WriteLine(aoore.Source); //SimpleLogger.WriteLine(aoore.Message); //SimpleLogger.WriteLine(aoore.StackTrace); //} //catch (Exception ex) //{ //SimpleLogger.WriteLine(ex.Source); //SimpleLogger.WriteLine(ex.Message); //SimpleLogger.WriteLine(ex.StackTrace); //} }