public DisplayDevices() { int counter = 0; ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_VideoController"); ManagementObjectCollection searchList = searcher.Get(); this.myDevices = new DisplayDevices[searcher.Get().Count]; try { foreach (ManagementObject mo in searchList) { myDevices[counter] = new DisplayDevices(counter); try { myDevices[counter].SetManufacturer(mo["AdapterCompatibility"].ToString().Trim()); } catch (Exception e) { myDevices[counter].SetManufacturer("none"); } try { myDevices[counter].SetModel(mo["name"].ToString().Trim()); } catch (Exception e) { myDevices[counter].SetModel("none"); } try { myDevices[counter].SetID(mo["deviceid"].ToString().Trim()); } catch { myDevices[counter].SetID("none"); } try { myDevices[counter].deviceMem = long.Parse(mo["adapterram"].ToString().Trim()) / 1048576; } catch { myDevices[counter].deviceMem = 0; } counter++; } } catch (System.Exception ex) { Console.WriteLine(ex.Message); } }
public void Init() { // TODO: Complete member initialization Console.WriteLine("Getting CPU Information"); compCPU = new CPU(); Console.WriteLine("Getting Motherboard Information"); compMobo = new Motherboard(); Console.WriteLine("Getting RAM Information"); compRAM = new RAM(); Console.WriteLine("Getting Drive Information"); compVols = new Volumes(); Console.WriteLine("Getting Display Adapter Information"); compDisplays = new DisplayDevices(); Console.WriteLine("Getting NIC Information"); compNICS = new NIC(); Console.WriteLine("Getting Service Information"); //Getting services information UpdateServices(); Console.Write("Getting Scheduled Task Information"); UpdateScheduledTasks(); //gotta program this Console.WriteLine("Init Complete"); }
public void InitComputer() { computer.Init(); compHardware = computer.GetHardware(); compCPU = (CPU)compHardware[0]; compMobo = (Motherboard)compHardware[1]; compRAM = (RAM)compHardware[2]; compVols = (Volumes)compHardware[3]; compDisplay = (DisplayDevices)compHardware[4]; compNIC = (NIC)compHardware[5]; }