Beispiel #1
0
        public static WinOSInfo GetInfoGPU(WinOSInfo winos)
        {
            ManagementObjectSearcher myVideoObject = new ManagementObjectSearcher("select * from Win32_VideoController");

            var gpus = new List <OSGPU>();

            foreach (ManagementObject obj in myVideoObject.Get())
            {
                var gpu = new OSGPU
                {
                    Name                    = obj["Name"].ToString(),
                    Status                  = obj["Status"].ToString(),
                    Caption                 = obj["Caption"].ToString(),
                    DeviceID                = obj["DeviceID"].ToString(),
                    AdapterRAM              = Convert.ToDecimal(obj["AdapterRAM"]),
                    AdapterDACType          = obj["AdapterDACType"].ToString(),
                    Monochrome              = Convert.ToBoolean(obj["Monochrome"]),
                    InstalledDisplayDrivers = obj["InstalledDisplayDrivers"].ToString(),
                    DriverVersion           = obj["DriverVersion"].ToString(),
                    VideoProcessor          = obj["VideoProcessor"].ToString(),
                    VideoArchitecture       = Convert.ToInt64(obj["VideoArchitecture"]),
                    VideoMemoryType         = Convert.ToInt64(obj["VideoMemoryType"])
                };
                gpus.Add(gpu);
            }

            winos.GPUs = gpus;

            return(winos);
        }
Beispiel #2
0
        public static WinOSInfo GetInfoDisk(WinOSInfo winos)
        {
            winos.LogicalDisksCount = Directory.GetLogicalDrives().Length;

            var winDisks = new List <OSDisk>();

            foreach (var disk in DriveInfo.GetDrives())
            {
                if (disk.IsReady)
                {
                    var disks = new OSDisk
                    {
                        Name          = disk.Name,
                        TotalSize     = Math.Ceiling(disk.TotalSize / 1073741824M),
                        FreeSize      = Math.Ceiling(disk.TotalFreeSpace / 1073741824M),
                        Format        = disk.DriveFormat,
                        RootDirectory = disk.RootDirectory.FullName
                    };

                    winDisks.Add(disks);
                }
            }

            winos.Disks = winDisks;

            return(winos);
        }
Beispiel #3
0
        public static WinOSInfo GetInfoEthernet(WinOSInfo winos)
        {
            if (!NetworkInterface.GetIsNetworkAvailable())
            {
                winos.ExistsConnection = false;
                return(winos);
            }

            winos.ExistsConnection = true;

            var netws = new List <OSNetwork>();

            foreach (var eth in NetworkInterface.GetAllNetworkInterfaces())
            {
                var net = new OSNetwork
                {
                    Name        = eth.Name,
                    NetworkType = eth.NetworkInterfaceType.ToString(),
                    Status      = eth.OperationalStatus.ToString(),
                    Description = eth.Description
                };

                net.Speed = eth.Speed.ToString();

                netws.Add(net);
            }

            winos.Networks = netws;

            return(winos);
        }
Beispiel #4
0
 public static WinOSInfo GetInfoProcessor(WinOSInfo winos)
 {
     winos.ProcessorArchitecture = Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE",
                                                                      EnvironmentVariableTarget.Machine);
     winos.ProcessorIden   = Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER");
     winos.ProcessorLevel  = Environment.GetEnvironmentVariable("PROCESSOR_LEVEL");
     winos.ProcessorNumber = Environment.ProcessorCount.ToString();
     return(winos);
 }
Beispiel #5
0
        public static WinOSInfo GetInfoMemory(WinOSInfo winos)
        {
            var memoryInfo = new GlobalKernelEx();

            winos.MemorySize             = Convert.ToDecimal((memoryInfo.TotalPhysicalMemory / (1024 * 1024)) * 0.001);
            winos.MemoryAvailable        = Convert.ToDecimal((memoryInfo.AvailablePhysicalMemory / (1024 * 1024)) * 0.001);
            winos.MemoryAvailableVertual = Convert.ToDecimal((memoryInfo.AvailableVirtualMemory / (1024 * 1024)) * 0.001);
            winos.MemoryVirtualSize      = Convert.ToDecimal((memoryInfo.TotalVirtualMemory / (1024 * 1024)) * 0.001);
            return(winos);
        }
Beispiel #6
0
        public static WinOSInfo GetInfoProcesses(WinOSInfo winos)
        {
            var listPro = new List <OSInfoProcesses>();

            foreach (var process in Process.GetProcesses())
            {
                var pro = new OSInfoProcesses
                {
                    ProcessId   = process.Id,
                    ProcessName = process.ProcessName,
                    Status      = (process.Responding == true) ? "OK" : "Stopped"
                };

                listPro.Add(pro);
            }

            winos.OSInfoProcesses = listPro;
            return(winos);
        }
Beispiel #7
0
        public static WinOSInfo GetInfoServices(WinOSInfo winos)
        {
            var listServices = new List <OSInfoServices>();

            foreach (var item in ServiceController.GetServices())
            {
                var service = new OSInfoServices
                {
                    Name         = item.DisplayName,
                    ServiceName  = item.ServiceName,
                    ServicesType = item.ServiceType.ToString(),
                    StartType    = item.StartType.ToString(),
                    Status       = item.Status.ToString()
                };

                listServices.Add(service);
            }
            winos.OSInfoServices = listServices;
            return(winos);
        }
Beispiel #8
0
        public static WinOSInfo GetInfoOS(WinOSInfo winos)
        {
            ManagementObjectSearcher mos = new ManagementObjectSearcher("select * from Win32_OperatingSystem");

            if (mos.Get().Count <= 0)
            {
                return(winos);
            }

            var listOS = new List <OSInfo>();

            foreach (ManagementObject managementObject in mos.Get())
            {
                var osInfo = new OSInfo();

                if (managementObject["Caption"] != null)
                {
                    osInfo.OperationName = managementObject["Caption"].ToString();
                }

                if (managementObject["OSArchitecture"] != null)
                {
                    osInfo.OperationArchitecture = managementObject["OSArchitecture"].ToString();
                }

                if (managementObject["CSDVersion"] != null)
                {
                    osInfo.OperationVersion = managementObject["CSDVersion"].ToString();
                }

                listOS.Add(osInfo);
            }

            winos.OSInfos = listOS;

            return(winos);
        }