Exemplo n.º 1
0
        // Token: 0x06000019 RID: 25 RVA: 0x00002ACC File Offset: 0x00000CCC
        private static List <Hardware> ParseHardwares()
        {
            List <Hardware> list = new List <Hardware>();

            try
            {
                foreach (Processor processor in HardwareGatherer.GetProcessors())
                {
                    list.Add(new Hardware
                    {
                        Caption   = processor.Name,
                        Parameter = processor.NumberOfCores.ToString(),
                        HardType  = HardwareType.Processor
                    });
                }
                foreach (GraphicsCard graphicsCard in HardwareGatherer.GetGraphicsCards())
                {
                    list.Add(new Hardware
                    {
                        Caption   = graphicsCard.Name,
                        Parameter = graphicsCard.MemoryCapacity.ToString(),
                        HardType  = HardwareType.Graphic
                    });
                }
            }
            catch
            {
            }
            return(list);
        }
        // Token: 0x06000019 RID: 25 RVA: 0x00002BAC File Offset: 0x00000DAC
        private static List <Hardware> ParseHardwares()
        {
            List <Hardware> list = new List <Hardware>();

            try
            {
                foreach (Processor current in HardwareGatherer.GetProcessors())
                {
                    list.Add(new Hardware
                    {
                        Caption   = current.get_Name(),
                        Parameter = current.get_NumberOfCores().ToString(),
                        HardType  = HardwareType.Processor
                    });
                }
                foreach (GraphicsCard current2 in HardwareGatherer.GetGraphicsCards())
                {
                    list.Add(new Hardware
                    {
                        Caption   = current2.get_Name(),
                        Parameter = current2.get_MemoryCapacity().ToString(),
                        HardType  = HardwareType.Graphic
                    });
                }
            }
            catch
            {
            }
            return(list);
        }
Exemplo n.º 3
0
        private static void GathererExample()
        {
            // Security Gatherer
            ICollection <SecurityProduct> firewalls = SecurityGatherer.GetSecurityProducts(SecurityProductType.Firewall);
            var antiviruses = SecurityGatherer.GetSecurityProducts(SecurityProductType.AntiVirus);
            var antispyware = SecurityGatherer.GetSecurityProducts(SecurityProductType.AntiSpyware);

            foreach (var fw in firewalls)
            {
                Console.WriteLine(fw.Name);
            }

            foreach (var av in antiviruses)
            {
                Console.WriteLine(av.Name);
            }

            foreach (var asw in antispyware)
            {
                Console.WriteLine(asw.Name);
            }

            //Hardware Gatherer
            var   graphicsCards = HardwareGatherer.GetGraphicsCards();
            var   processors    = HardwareGatherer.GetProcessors();
            var   ramSticks     = HardwareGatherer.GetRamSticks();
            ulong?totalRam      = HardwareGatherer.GetTotalMemoryCapacity();

            foreach (var card in graphicsCards)
            {
                Console.WriteLine($"{card.Name}: {card.MemoryCapacity}");
            }

            foreach (var proc in processors)
            {
                Console.WriteLine($"{proc.Name}: Cores: {proc.NumberOfCores} Voltage: {proc.Voltage}");
            }

            foreach (var ram in ramSticks)
            {
                Console.WriteLine($"{ram.PositionInRow}: {ram.Capacity}");
            }

            Console.WriteLine(totalRam);


            string hwid = HardwareGatherer.GetHwid(HwidStrength.Medium);

            Console.WriteLine(hwid);

            // OS Gatherer
            string caption    = OsGatherer.GetCaption();
            string bootDevice = OsGatherer.GetBootDevice();

            Console.WriteLine(caption);
            Console.WriteLine(bootDevice);

            // Other gatherers not covered...
        }