private void OnMachineInfoRequest(INetworkConnection con, Packet packet) { bool cpu, gpu, drives, mainboard, os, ram; cpu = gpu = drives = mainboard = os = ram = false; PacketGenericMessage m = packet as PacketGenericMessage; m.ReplyPacket = CreateStandardReply(packet, ReplyType.OK, ""); if (m.Parms.GetBoolProperty("cpu").GetValueOrDefault(false)) { cpu = true; CPUInfo ci = MachineInfo.ReadCPUInfo(); m.ReplyPacket.Parms.SetProperty("cpu", ci.ToString()); } if (m.Parms.GetBoolProperty("gpu").GetValueOrDefault(false)) { gpu = true; VideoCardInfo gi = MachineInfo.ReadGPUInfo(); m.ReplyPacket.Parms.SetProperty("gpu", gi.ToString()); } if (m.Parms.GetBoolProperty("drives").GetValueOrDefault(false)) { drives = true; PatcherLib.DriveInfo di = MachineInfo.ReadLogicalDiskInfo(); m.ReplyPacket.Parms.SetProperty("drives", di.ToString()); } if (m.Parms.GetBoolProperty("mainboard").GetValueOrDefault(false)) { mainboard = true; MotherboardInfo mi = MachineInfo.ReadMotherboardInfo(); m.ReplyPacket.Parms.SetProperty("mainboard", mi.ToString()); } if (m.Parms.GetBoolProperty("os").GetValueOrDefault(false)) { os = true; OperatingSystemInfo osr = MachineInfo.ReadOperatingSystemInfo(); m.ReplyPacket.Parms.SetProperty("os", osr.ToString()); } if (m.Parms.GetBoolProperty("ram").GetValueOrDefault(false)) { ram = true; RamInfo ri = MachineInfo.ReadRAMInfo(); m.ReplyPacket.Parms.SetProperty("ram", ri.ToString()); } if (MachineInfoRequestArrived != null) { MachineInfoRequestArrived(cpu, gpu, mainboard, drives, os, ram); } }
private void button24_Click(object sender, EventArgs e) { var info = new MotherboardInfo(); MessageBox.Show(info.Manufacturer + "\n" + info.Product + "\n" + info.SerialNumber); }