Beispiel #1
0
    static VirtualMachineDetector()
    {
        _detectors = new IVirtualEnvironment[]
        {
            new VmWarePlayer(),
            new HyperVMachine(),
            new QEmuMachine(),
            new VirtualBoxMachine(),
        };

        _computer    = Create <ComputerSystem>("Win32_ComputerSystem");
        _bios        = Create <BIOS>("Win32_BIOS");
        _motherboard = Create <MotherboardDevice>("Win32_MotherboardDevice");
        _devices     = CreateList <PnPEntity>("Win32_PnPEntity");
        _disks       = CreateList <DiskDrive>("Win32_DiskDrive");
        _services    = GetWindowsServices();
    }
    static VirtualMachineDetector()
    {
        _detectors = new IVirtualEnvironment[]
        {
            new VmWarePlayer(),
            new HyperVMachine(),
            new QEmuMachine(),
            new VirtualBoxMachine(),
        };

        _computer    = Create <ComputerSystem>("Win32_ComputerSystem");
        _bios        = Create <BIOS>("Win32_BIOS");
        _motherboard = Create <MotherboardDevice>("Win32_MotherboardDevice");
        _devices     = CreateList <PnPEntity>("Win32_PnPEntity");
        _disks       = CreateList <DiskDrive>("Win32_DiskDrive");
        _services    = GetWindowsServices();

        #region DEBUG PRINT
#if DEBUG
        Console.WriteLine();
        Console.WriteLine("MOTHERBOARD INFO");
        Console.WriteLine("================");
        Console.WriteLine(_motherboard);
        Console.WriteLine();

        Console.WriteLine("BIOS INFO");
        Console.WriteLine("=========");
        Console.WriteLine(_bios);
        Console.WriteLine();

        Console.WriteLine("COMPUTER INFO");
        Console.WriteLine("=============");
        Console.WriteLine(_computer);
        Console.WriteLine();

        Console.WriteLine("DEVICES INFO");
        Console.WriteLine("============");
        foreach (var device in _devices)
        {
            Console.WriteLine(device);
        }
        Console.WriteLine();

        Console.WriteLine("HARD DRIVES INFO");
        Console.WriteLine("================");
        foreach (var disk in _disks)
        {
            Console.WriteLine(disk);
        }
        Console.WriteLine();

        Console.WriteLine("WINDOWS SERVICES");
        Console.WriteLine("================");
        foreach (var service in _services)
        {
            Console.WriteLine(service);
        }
        Console.WriteLine();
#endif
        #endregion
    }