Exemplo n.º 1
0
        static void Main(string[] args)
        {
            //Console.WriteLine("Hello World!");
            var si = new arcware_runner.SystemInfo(true);

            //arcware_runner.SystemInfo.WriteInfo();

            //Console.Write(si.GetJSON());
            AppsController.I.Reset();
        }
Exemplo n.º 2
0
        public void Reload()
        {
            this.CPUs        = new List <CPU>();
            this.GPUs        = new List <GPU>();
            this.Drives      = new List <Drive>();
            this.InternalIPs = new List <string>();
            HInfo.RefreshAll();
            foreach (var cpu in HInfo.CpuList)
            {
                this.CPUs.Add(new CPU(cpu.Name, (int)cpu.NumberOfCores, (int)cpu.NumberOfLogicalProcessors));
            }
            foreach (var gpu in HInfo.VideoControllerList)
            {
                this.GPUs.Add(new GPU(gpu.Description));
            }
            foreach (var mbo in HInfo.MotherboardList)
            {
                this.Mainboard = new MBO(mbo.Manufacturer, mbo.Product, mbo.SerialNumber);
            }
            this.TotalMemory = HInfo.MemoryStatus.TotalPhysical;
            foreach (var address in HardwareInfo.GetLocalIPv4Addresses(NetworkInterfaceType.Ethernet,
                                                                       OperationalStatus.Up))
            {
                IPAddress ipAddress = null;
                bool      isValidIp = IPAddress.TryParse(address.ToString(), out ipAddress);
                if (isValidIp)
                {
                    InternalIPs.Add(address.ToString());
                }
            }

            OS = "unknown";
            if (OperatingSystem.IsWindows())
            {
                OS = "Windows";
            }
            if (OperatingSystem.IsLinux())
            {
                OS = "Linux";
            }
            if (OperatingSystem.IsAndroid())
            {
                OS = "Android";
            }
            if (OperatingSystem.IsMacOS())
            {
                OS = "Mac";
            }

            DriveInfo[] allDrives = DriveInfo.GetDrives();
            foreach (DriveInfo d in allDrives)
            {
                if (d.IsReady)
                {
                    this.Drives.Add(new Drive(d.Name, d.DriveType.ToString(), d.VolumeLabel, d.DriveFormat, (ulong)d.TotalSize, (ulong)d.AvailableFreeSpace));
                }
            }

            this.ExternalIP = SystemInfo.GetExternalIP();

            this.Processes = new List <SystemProcess>();
            foreach (var p in Process.GetProcesses())
            {
                try
                {
                    this.Processes.Add(new SystemProcess(p));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }