示例#1
0
        public static List <string> LoopPrinter()
        {
            List <string> printerNames          = new List <string>();
            string        wmiSQL                = "SELECT * FROM Win32_Printer";
            ManagementObjectCollection printers = new ManagementObjectSearcher(wmiSQL).Get();

            foreach (ManagementObject printer in printers)
            {
                PropertyDataCollection.PropertyDataEnumerator pde = printer.Properties.GetEnumerator();

                while (pde.MoveNext())
                {
                    Console.WriteLine(pde.Current.Name + " : " + pde.Current.Value);
                    if (pde.Current.Name == "DeviceID")
                    {
                        Console.WriteLine("打印机设备ID为:" + pde.Current.Value);
                        //JobCountSinceLastReset
                        //Status : Error Status : Unknown
                        //PrinterState : 1026 PrinterStatus : 1
                        //PrinterState : 0 PrinterStatus : 3
                        printerNames.Add(pde.Current.Value.ToString());
                    }

                    //MessageBox.Show(pde.Current.Name + " : " + pde.Current.Value);
                    //显示的是 属性名 : 属性值 的形式
                }
            }
            return(printerNames);
        }
示例#2
0
 public Disk(ManagementObject instance)
 {
     PropertyDataCollection.PropertyDataEnumerator enumerator = instance.Properties.GetEnumerator();
     while (enumerator.MoveNext())
     {
         Console.WriteLine(enumerator.Current.Name);
     }
     manufacturer = (instance.Properties["Manufacturer"].Value != null)
                        ? instance.Properties["Manufacturer"].Value.ToString().Trim()
                        : string.Empty;
     model = (instance.Properties["Model"].Value != null)
                 ? instance.Properties["Model"].Value.ToString().Trim()
                 : string.Empty;
     description = (instance.Properties["Description"].Value != null)
                       ? instance.Properties["Description"].Value.ToString().Trim()
                       : string.Empty;
     interfaceType = (instance.Properties["InterfaceType"].Value != null)
                         ? instance.Properties["InterfaceType"].Value.ToString().Trim()
                         : string.Empty;
     size = (instance.Properties["Size"].Value != null)
                ? instance.Properties["Size"].Value.ToString().Trim()
                : string.Empty;
     partitions = (instance.Properties["Partitions"].Value != null)
                      ? instance.Properties["Partitions"].Value.ToString().Trim()
                      : string.Empty;
     scsiBus = (instance.Properties["ScsiBus"].Value != null)
                   ? instance.Properties["ScsiBus"].Value.ToString().Trim()
                   : string.Empty;
     scsiTargetID = (instance.Properties["ScsiTargetID"].Value != null)
                        ? instance.Properties["ScsiTargetID"].Value.ToString().Trim()
                        : string.Empty;
     deviceID = (instance.Properties["DeviceID"].Value != null)
                    ? instance.Properties["DeviceID"].Value.ToString().Trim()
                    : string.Empty;
 }
示例#3
0
        public static void ManagementDemo1()
        {
            string                     moAddress = " ";
            ManagementClass            mc        = new ManagementClass("Win32_NetworkAdapterConfiguration");
            ManagementObjectCollection moc2      = mc.GetInstances();

            foreach (ManagementObject mo in moc2)
            {
                ManagementPath         mp  = mo.ClassPath;
                IContainer             ic  = mo.Container;
                ObjectGetOptions       ogo = mo.Options;
                ManagementPath         mpa = mo.Path;
                PropertyDataCollection pdc = mo.Properties;
                foreach (PropertyData item in pdc)
                {
                    Console.WriteLine($"{item.Name} ={mo[item.Name]}");
                }
                Console.WriteLine("************************************************************");
                PropertyDataCollection.PropertyDataEnumerator pde = pdc.GetEnumerator();

                QualifierDataCollection qd = mo.Qualifiers;
                ManagementScope         ms = mo.Scope;
                ISite isi = mo.Site;
                PropertyDataCollection pdct = mo.SystemProperties;
                if ((bool)mo["IPEnabled"] == true)
                {
                    moAddress = mo["MacAddress"].ToString();
                }
                mo.Dispose();
            }
        }
 // Token: 0x06000575 RID: 1397 RVA: 0x00023628 File Offset: 0x00021828
 private static bool ce09dadc97335bd2a78e65370a288fa39(EventArrivedEventArgs c3c9260886a6db15de49329a9f5b9836c)
 {
     PropertyDataCollection.PropertyDataEnumerator enumerator = c3c9260886a6db15de49329a9f5b9836c.NewEvent.Properties.GetEnumerator();
     try
     {
         while (enumerator.MoveNext())
         {
             if (c65c252d08c00d64b46298b4434860139.c8d9bd1b5f903cbc3ebfaf48b8b440c7a(enumerator.Current.Name, ceffa389ee86c0ee26f31dd3efacbdd38.c5dd75c94760bfb37727a44ddc794d278(41871)))
             {
                 for (;;)
                 {
                     switch (7)
                     {
                     case 0:
                         continue;
                     }
                     break;
                 }
                 if (!true)
                 {
                     RuntimeMethodHandle runtimeMethodHandle = methodof(c8182050bde64f716a9855055b4bd295b.ce09dadc97335bd2a78e65370a288fa39(EventArrivedEventArgs)).MethodHandle;
                 }
                 return(cebbdeae8341a51f374f3ef4c993a069a.c6bc1c09ec46e3a402ca1f5ca208c573e(9448) != 0);
             }
         }
         for (;;)
         {
             switch (2)
             {
             case 0:
                 continue;
             }
             break;
         }
     }
     finally
     {
         IDisposable disposable = c2f4016fa04d8c2b2a9dba60e295715d5.c0b398ab350e72b0d64d512bae8520b85(enumerator);
         if (disposable != null)
         {
             for (;;)
             {
                 switch (3)
                 {
                 case 0:
                     continue;
                 }
                 break;
             }
             disposable.Dispose();
         }
     }
     return(cebbdeae8341a51f374f3ef4c993a069a.c6bc1c09ec46e3a402ca1f5ca208c573e(9452) != 0);
 }
    public static int Main(string[] args)
    {
        ManagementObject disk = new
                                ManagementObject("Win32_LogicalDisk.DeviceID='C:'");

        PropertyDataCollection.PropertyDataEnumerator
            propertyEnumerator = disk.Properties.GetEnumerator();
        while (propertyEnumerator.MoveNext())
        {
            PropertyData p =
                (PropertyData)propertyEnumerator.Current;
            Console.WriteLine("Property found: " + p.Name);
        }
        return(0);
    }
示例#6
0
        public static String getStatusl(String printer_name)
        {
            String           str     = "";
            string           path    = @"win32_printer.DeviceId='" + printer_name + "'";
            ManagementObject printer = new ManagementObject(path);

            printer.Get();
            PropertyDataCollection.PropertyDataEnumerator pde = printer.Properties.GetEnumerator();
            while (pde.MoveNext())
            {
                str += pde.Current.Name + " : " + pde.Current.Value + "\r\n";
                //显示的是 属性名 : 属性值 的形式
            }
            return(str);
        }
示例#7
0
        public static List <string> GetPrinters()
        {
            string _classname = "SELECT * FROM Win32_Printer";

            ManagementObjectCollection printers = new ManagementObjectSearcher(_classname).Get();

            foreach (ManagementObject printer in printers)
            {
                PropertyDataCollection.PropertyDataEnumerator pde = printer.Properties.GetEnumerator();

                while (pde.MoveNext())
                {
                    lstPrinterName.Add(pde.Current.Value.ToString());
                }
            }
            return(lstPrinterName);
        }
        private static string GetFileSystem(string diskName)
        {
            string str = "";
            ManagementObjectSearcher searcher = new ManagementObjectSearcher("select filesystem from Win32_LogicalDisk where name='" + diskName + ":'");

            foreach (ManagementObject obj2 in searcher.Get())
            {
                PropertyDataCollection.PropertyDataEnumerator enumerator2 = obj2.Properties.GetEnumerator();

                while (enumerator2.MoveNext())
                {
                    str = enumerator2.Current.Value.ToString();
                }
                continue;
            }
            return(str);
        }
 // Token: 0x06000576 RID: 1398 RVA: 0x000236E4 File Offset: 0x000218E4
 private void c06776b45189a50812777a1c227a63a3b(object cd7b28952603b35a45c555982e677363a, EventArrivedEventArgs cdf15457ee4816989343b6e6e96dd4cfe)
 {
     PropertyDataCollection.PropertyDataEnumerator enumerator = c8b71d35a8b17aa98ded59f739c7fca9e.cd24593c859565ebb8c9faabbc5c75bef(cdf15457ee4816989343b6e6e96dd4cfe.NewEvent[ceffa389ee86c0ee26f31dd3efacbdd38.c5dd75c94760bfb37727a44ddc794d278(41890)]).Properties.GetEnumerator();
     try
     {
         while (enumerator.MoveNext())
         {
             PropertyData propertyData = enumerator.Current;
             Console.WriteLine(c023ef59998c1544cc2d1887c8e5ee879.c8d9bd1b5f903cbc3ebfaf48b8b440c7a(propertyData.Name, ceffa389ee86c0ee26f31dd3efacbdd38.c5dd75c94760bfb37727a44ddc794d278(41919), propertyData.Value));
         }
         for (;;)
         {
             switch (4)
             {
             case 0:
                 continue;
             }
             break;
         }
         if (!true)
         {
             RuntimeMethodHandle runtimeMethodHandle = methodof(c8182050bde64f716a9855055b4bd295b.c06776b45189a50812777a1c227a63a3b(object, EventArrivedEventArgs)).MethodHandle;
         }
     }
     finally
     {
         IDisposable disposable = c2f4016fa04d8c2b2a9dba60e295715d5.c0b398ab350e72b0d64d512bae8520b85(enumerator);
         if (disposable != null)
         {
             for (;;)
             {
                 switch (1)
                 {
                 case 0:
                     continue;
                 }
                 break;
             }
             disposable.Dispose();
         }
     }
 }
        private static Dictionary <int, WmiDataType> GetMofTypes(ManagementClass managementClass)
        {
            Dictionary <int, WmiDataType> dictionary = new Dictionary <int, WmiDataType>();

            PropertyDataCollection.PropertyDataEnumerator enumerator = managementClass.Properties.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    WmiDataType typeFromPropertyData = GetTypeFromPropertyData(enumerator.Current);
                    if (typeFromPropertyData != null)
                    {
                        dictionary.Add(typeFromPropertyData.Index, typeFromPropertyData);
                    }
                }
                return(dictionary);
            }
            finally
            {
                (enumerator as IDisposable)?.Dispose();
            }
        }
示例#11
0
        internal static List <string> LoadPrinters()
        {
            List <string> printers = new List <string>();

            try
            {
                string wmiSQL = "SELECT DeviceId FROM Win32_Printer";
                ManagementObjectCollection printers1 = new ManagementObjectSearcher(wmiSQL).Get();

                foreach (ManagementObject printer in printers1)
                {
                    PropertyDataCollection.PropertyDataEnumerator pde = printer.Properties.GetEnumerator();

                    while (pde.MoveNext())
                    {
                        printers.Add(pde.Current.Value.ToString());
                    }
                }

                if (printers.Count > 0)
                {
                    string defaultPrintName = Settings.Default.DefaultPrinter;
                    if (string.IsNullOrEmpty(defaultPrintName) || !printers.Contains(defaultPrintName))
                    {
                        DefaultPrinter = printers[0];
                    }
                }
            }
            catch
            {
            }
            finally
            {
            }

            return(printers);
        }
示例#12
0
    public GetLog()
    {
        //Discarded unreachable code: IL_0fcb, IL_1257, IL_1259, IL_1263, IL_1266, IL_1268, IL_1275, IL_1299
        int num  = default(int);
        int num6 = default(int);

        try
        {
            base.Shown += new EventHandler(Form1_Shown);
            base.Load  += new EventHandler(Form1_Load);
            ProjectData.ClearProjectError();
            num = -2;
            int num2 = 2;
            InitializeComponent();
            num2 = 3;
            List <Assembly> list = new List <Assembly>();
            num2 = 4;
            IEnumerator <Assembly> enumerator = MyProject.Application.Info.LoadedAssemblies.GetEnumerator();
            while (enumerator.MoveNext())
            {
                Assembly current = enumerator.Current;
                num2 = 5;
                list.Add(current);
                num2 = 6;
            }
            if (enumerator != null)
            {
                enumerator.Dispose();
            }
            num2 = 7;
            rtfError.AppendText("//===========================OS Info============================//\r\n");
            num2 = 8;
            rtfError.AppendText("OS Name:           " + MyProject.Computer.Info.OSFullName + "\r\n");
            num2 = 9;
            rtfError.AppendText("OS Version:        " + MyProject.Computer.Info.OSVersion + "\r\n");
            num2 = 10;
            rtfError.AppendText("OS Platform:        " + MyProject.Computer.Info.OSPlatform + "\r\n");
            num2 = 11;
            ManagementClass managementClass = new ManagementClass("Win32_OperatingSystem");
            num2 = 12;
            ManagementObjectCollection.ManagementObjectEnumerator enumerator2 = managementClass.GetInstances().GetEnumerator();
            while (enumerator2.MoveNext())
            {
                ManagementObject managementObject = (ManagementObject)enumerator2.Current;
                num2 = 13;
                rtfError.AppendText("OS Platform:       " + managementObject.GetPropertyValue("OSArchitecture").ToString() + "\r\n");
                num2 = 14;
            }
            if (enumerator2 != null)
            {
                ((IDisposable)enumerator2).Dispose();
            }
            num2 = 15;
            rtfError.AppendText("//===========================System Info============================//\r\n");
            num2 = 16;
            ManagementObjectCollection managementObjectCollection;
            ManagementObjectCollection.ManagementObjectEnumerator enumerator3;
            int num4;
            checked
            {
                rtfError.AppendText("Physical Memory:   " + FormatBytes((long)MyProject.Computer.Info.AvailablePhysicalMemory) + " / " + FormatBytes((long)MyProject.Computer.Info.TotalPhysicalMemory) + " (Free / Total)\r\n");
                num2 = 17;
                rtfError.AppendText("Virtual Memory:    " + FormatBytes((long)MyProject.Computer.Info.AvailableVirtualMemory) + " / " + FormatBytes((long)MyProject.Computer.Info.TotalVirtualMemory) + " (Free / Total)\r\n");
                num2 = 18;
                rtfError.AppendText("Virtual Memory:    " + FormatBytes((long)MyProject.Computer.Info.AvailableVirtualMemory) + " / " + FormatBytes((long)MyProject.Computer.Info.TotalVirtualMemory) + " (Free / Total)\r\n");
                num2 = 19;
                NetworkInterface[] allNetworkInterfaces = NetworkInterface.GetAllNetworkInterfaces();
                num2 = 20;
                NetworkInterface[] array = allNetworkInterfaces;
                int num3 = 0;
                while (num3 < array.Length)
                {
                    NetworkInterface networkInterface = array[num3];
                    num2 = 21;
                    if ((Operators.CompareString(networkInterface.GetPhysicalAddress().ToString(), "", false) != 0) & (networkInterface.GetPhysicalAddress().ToString().Length == 12))
                    {
                        num2 = 22;
                        rtfError.AppendText("InterfaceType:    " + networkInterface.NetworkInterfaceType.ToString() + "\r\n");
                        num2 = 23;
                        rtfError.AppendText("Description:    " + networkInterface.Description + "\r\n");
                        num2 = 24;
                        rtfError.AppendText("MACaddress:    " + networkInterface.GetPhysicalAddress().ToString() + "\r\n");
                        num2 = 25;
                        rtfError.AppendText("IP:    " + networkInterface.GetIPProperties().UnicastAddresses[0].Address.ToString() + "\r\n");
                    }
                    num3++;
                    num2 = 27;
                }
                num2 = 28;
                ManagementObjectSearcher managementObjectSearcher = new ManagementObjectSearcher("SELECT * FROM  Win32_PhysicalMedia");
                num2 = 29;
                managementObjectCollection = managementObjectSearcher.Get();
                num2 = 30;
                string text = "";
                num2        = 31;
                num4        = 0;
                num2        = 32;
                enumerator3 = managementObjectCollection.GetEnumerator();
            }
            while (enumerator3.MoveNext())
            {
                ManagementObject managementObject2 = (ManagementObject)enumerator3.Current;
                num2 = 33;
                PropertyDataCollection.PropertyDataEnumerator enumerator4 = managementObject2.Properties.GetEnumerator();
                while (enumerator4.MoveNext())
                {
                    PropertyData current2 = enumerator4.Current;
                    num2 = 34;
                    if (!current2.IsArray)
                    {
                        num2 = 36;
                        num2 = 37;
                        if (Operators.CompareString(current2.Name, "SerialNumber", false) == 0 && num4 == 0)
                        {
                            num2 = 38;
                            rtfError.AppendText("Hard Disk Number:" + string.Format("{0} = {1}", current2.Name, RuntimeHelpers.GetObjectValue(managementObject2["SerialNumber"])) + "\r\n");
                            num2 = 39;
                            num4 = 1;
                        }
                    }
                    num2 = 42;
                }
                num2 = 43;
            }
            if (enumerator3 != null)
            {
                ((IDisposable)enumerator3).Dispose();
            }
            num2 = 44;
            num4 = 0;
            num2 = 45;
            ManagementObjectCollection.ManagementObjectEnumerator enumerator5 = managementObjectCollection.GetEnumerator();
            while (enumerator5.MoveNext())
            {
                ManagementObject managementObject3 = (ManagementObject)enumerator5.Current;
                num2 = 46;
                PropertyDataCollection.PropertyDataEnumerator enumerator6 = managementObject3.Properties.GetEnumerator();
                while (enumerator6.MoveNext())
                {
                    PropertyData current3 = enumerator6.Current;
                    num2 = 47;
                    if (!current3.IsArray)
                    {
                        num2 = 49;
                        num2 = 50;
                        if (Operators.CompareString(current3.Name, "Product", false) == 0 && num4 == 0)
                        {
                            num2 = 51;
                            rtfError.AppendText("Hard Disk Product:" + string.Format("{0} = {1}", current3.Name, RuntimeHelpers.GetObjectValue(managementObject3["Product"])) + "\r\n");
                            num2 = 52;
                            num4 = 1;
                        }
                    }
                    num2 = 55;
                }
                num2 = 56;
            }
            if (enumerator5 != null)
            {
                ((IDisposable)enumerator5).Dispose();
            }
            num2 = 57;
            string text2 = ".";
            num2 = 58;
            ManagementObjectSearcher managementObjectSearcher2 = new ManagementObjectSearcher("SELECT * FROM Win32_BaseBoard");
            num2 = 59;
            ManagementObjectCollection managementObjectCollection2 = managementObjectSearcher2.Get();
            num2 = 60;
            ManagementObjectCollection.ManagementObjectEnumerator enumerator7 = managementObjectCollection2.GetEnumerator();
            while (enumerator7.MoveNext())
            {
                ManagementObject managementObject4 = (ManagementObject)enumerator7.Current;
                num2 = 61;
                PropertyDataCollection.PropertyDataEnumerator enumerator8 = managementObject4.Properties.GetEnumerator();
                while (enumerator8.MoveNext())
                {
                    PropertyData current4 = enumerator8.Current;
                    num2 = 62;
                    if (!current4.IsArray)
                    {
                        num2 = 64;
                        num2 = 65;
                        if ((Operators.CompareString(current4.Name, "Product", false) == 0) | (Operators.CompareString(current4.Name, "SerialNumber", false) == 0))
                        {
                            num2 = 66;
                            rtfError.AppendText(string.Format("{0} = {1}", current4.Name, RuntimeHelpers.GetObjectValue(current4.Value)) + "\r\n");
                        }
                    }
                    num2 = 69;
                }
                num2 = 70;
            }
            if (enumerator7 != null)
            {
                ((IDisposable)enumerator7).Dispose();
            }
            num2 = 71;
            managementObjectSearcher2 = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
            num2 = 72;
            managementObjectCollection2 = managementObjectSearcher2.Get();
            num2 = 73;
            ManagementObjectCollection.ManagementObjectEnumerator enumerator9 = managementObjectCollection2.GetEnumerator();
            while (enumerator9.MoveNext())
            {
                ManagementObject managementObject5 = (ManagementObject)enumerator9.Current;
                num2 = 74;
                PropertyDataCollection.PropertyDataEnumerator enumerator10 = managementObject5.Properties.GetEnumerator();
                while (enumerator10.MoveNext())
                {
                    PropertyData current5 = enumerator10.Current;
                    num2 = 75;
                    if (!current5.IsArray)
                    {
                        num2 = 77;
                        num2 = 78;
                        if ((Operators.CompareString(current5.Name, "ProcessorId", false) == 0) | (Operators.CompareString(current5.Name, "Name", false) == 0) | (Operators.CompareString(current5.Name, "NumberOfCores", false) == 0) | (Operators.CompareString(current5.Name, "NumberOfLogicalProcessors", false) == 0))
                        {
                            num2 = 79;
                            rtfError.AppendText(string.Format("{0} = {1}", current5.Name, RuntimeHelpers.GetObjectValue(current5.Value)) + "\r\n");
                        }
                    }
                    num2 = 82;
                }
                num2 = 83;
            }
            if (enumerator9 != null)
            {
                ((IDisposable)enumerator9).Dispose();
            }
            num2 = 84;
            Type typeFromHandle = typeof(PrinterSettings);
            num2 = 85;
            FieldInfo field = typeFromHandle.GetField("outputPort", BindingFlags.Instance | BindingFlags.NonPublic);
            num2 = 86;
            string text3 = Conversions.ToString(field.GetValue(PrintDialog1.PrinterSettings));
            num2 = 87;
            rtfError.AppendText("Default Printer Name:    " + PrintDialog1.PrinterSettings.PrinterName + "\r\n");
            num2 = 88;
            ManagementObjectSearcher managementObjectSearcher3 = new ManagementObjectSearcher("SELECT * FROM Win32_Printer");
            num2 = 89;
            ManagementObjectCollection managementObjectCollection3 = managementObjectSearcher3.Get();
            num2 = 90;
            ManagementObjectCollection.ManagementObjectEnumerator enumerator11 = managementObjectCollection3.GetEnumerator();
            while (enumerator11.MoveNext())
            {
                ManagementObject managementObject6 = (ManagementObject)enumerator11.Current;
                num2 = 91;
                string str = string.Format("{0}", RuntimeHelpers.GetObjectValue(managementObject6["Name"]));
                num2 = 92;
                string str2 = string.Format("{0}", RuntimeHelpers.GetObjectValue(managementObject6["PortName"]));
                num2 = 93;
                rtfError.AppendText("Printer Name:    " + str + "\r\n");
                num2 = 94;
                rtfError.AppendText("Printer p=Port:    " + str2 + "\r\n");
                num2 = 95;
            }
            if (enumerator11 != null)
            {
                ((IDisposable)enumerator11).Dispose();
            }
            num2 = 96;
            managementObjectSearcher3 = new ManagementObjectSearcher("SELECT * FROM Win32_PrinterDriver");
            num2 = 97;
            managementObjectCollection3 = managementObjectSearcher3.Get();
            num2 = 98;
            ManagementObjectCollection.ManagementObjectEnumerator enumerator12 = managementObjectCollection3.GetEnumerator();
            while (enumerator12.MoveNext())
            {
                ManagementObject managementObject7 = (ManagementObject)enumerator12.Current;
                num2 = 99;
                string str3 = string.Format("{0}", RuntimeHelpers.GetObjectValue(managementObject7["Name"]));
                num2 = 100;
                string str4 = string.Format("{0}", RuntimeHelpers.GetObjectValue(managementObject7["DataFile"]));
                num2 = 101;
                rtfError.AppendText("Printer Name:    " + str3 + "\r\n");
                num2 = 102;
                rtfError.AppendText("Printer Path:    " + str4 + "\r\n");
                num2 = 103;
            }
            if (enumerator12 != null)
            {
                ((IDisposable)enumerator12).Dispose();
            }
            num2 = 104;
            TimeZone currentTimeZone = TimeZone.CurrentTimeZone;
            num2 = 105;
            rtfError.AppendText("TimeZone Name:" + currentTimeZone.StandardName + "\r\n");
            num2 = 106;
            rtfError.AppendText("//===========================Hyview Info=============================//\r\n");
            num2 = 107;
            RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{5c54e79c-bef2-4cf6-9e98-5bdc325cb058}", false);
            num2 = 108;
            if (registryKey == null)
            {
                num2        = 109;
                registryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{5c54e79c-bef2-4cf6-9e98-5bdc325cb058}", false);
                num2        = 110;
                if (registryKey != null)
                {
                    num2 = 111;
                    rtfError.AppendText(Conversions.ToString(Operators.ConcatenateObject(Operators.ConcatenateObject("Hyview Reader Name:    ", registryKey.GetValue("DisplayName")), "\r\n")));
                    num2 = 112;
                    rtfError.AppendText(Conversions.ToString(Operators.ConcatenateObject(Operators.ConcatenateObject("Hyview Reader Version:    ", registryKey.GetValue("DisplayVersion")), "\r\n")));
                }
            }
            else
            {
                num2 = 115;
                num2 = 116;
                rtfError.AppendText(Conversions.ToString(Operators.ConcatenateObject(Operators.ConcatenateObject("Hyview Reader Name:    ", registryKey.GetValue("DisplayName")), "\r\n")));
                num2 = 117;
                rtfError.AppendText(Conversions.ToString(Operators.ConcatenateObject(Operators.ConcatenateObject("Hyview Reader Version:    ", registryKey.GetValue("DisplayVersion")), "\r\n")));
            }
            num2 = 119;
            registryKey.Close();
            num2        = 120;
            registryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\NET Framework Setup\\NDP", false);
            num2        = 121;
            string[] subKeyNames = registryKey.GetSubKeyNames();
            num2 = 122;
            checked
            {
                int num5 = subKeyNames.Length - 1;
                for (int i = 0; i <= num5; i++)
                {
                    num2 = 123;
                    rtfError.AppendText(".net Framework:    " + subKeyNames[i] + "\r\n");
                    num2 = 124;
                }
                num2 = 125;
                registryKey.Close();
                num2        = 126;
                registryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\DataAccess", false);
                num2        = 127;
                rtfError.AppendText(Conversions.ToString(Operators.ConcatenateObject(Operators.ConcatenateObject("MDAC version:    ", registryKey.GetValue("Version", 0.0)), "\r\n")));
                num2 = 128;
                registryKey.Close();
                num2 = 129;
                rtfError.AppendText("Desktop path:    " + Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\r\n");
                num2 = 130;
                rtfError.AppendText("Desktop path:    " + MyProject.Computer.FileSystem.SpecialDirectories.Desktop + "\r\n");
                num2 = 131;
                rtfError.AppendText("MyDocuments path:    " + Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\r\n");
                num2 = 132;
                rtfError.AppendText("MyDocuments path:    " + MyProject.Computer.FileSystem.SpecialDirectories.MyDocuments + "\r\n");
                num2 = 133;
                string setting = Interaction.GetSetting("HyviewReader", "Settings", "ProxyAddr");
                num2 = 134;
                string setting2 = Interaction.GetSetting("HyviewReader", "Settings", "ProxyPort");
                num2 = 135;
                string setting3 = Interaction.GetSetting("HyviewReader", "Settings", "ProxyAcc");
                num2 = 136;
                string setting4 = Interaction.GetSetting("HyviewReader", "Settings", "ProxyChk", "0");
                num2 = 137;
                rtfError.AppendText("Proxy:    " + setting + "\r\n");
                num2 = 138;
                rtfError.AppendText("Port:    " + setting2 + "\r\n");
                num2 = 139;
                rtfError.AppendText("Acc:    " + setting3 + "\r\n");
                num2 = 140;
                if (Operators.CompareString(setting4, "0", false) == 0)
                {
                    num2 = 141;
                    rtfError.AppendText("Proxy Select:    不使用Proxy\r\n");
                }
                else
                {
                    num2 = 143;
                    if (Operators.CompareString(setting4, "1", false) == 0)
                    {
                        num2 = 144;
                        rtfError.AppendText("Proxy Select:    使用系統設定\r\n");
                    }
                    else
                    {
                        num2 = 146;
                        if (Operators.CompareString(setting4, "2", false) == 0)
                        {
                            num2 = 147;
                            rtfError.AppendText("Proxy Select:    手動設定\r\n");
                        }
                    }
                }
                num2 = 149;
                rtfError.AppendText("//===========================Other Info=============================//\r\n");
                num2 = 150;
                AsmComparer comparer = new AsmComparer();
                num2 = 151;
                list.Sort(comparer);
                num2 = 152;
                List <Assembly> .Enumerator enumerator13 = list.GetEnumerator();
                while (enumerator13.MoveNext())
                {
                    Assembly current6 = enumerator13.Current;
                    num2 = 153;
                    if (Operators.CompareString(current6.Location.ToUpper(), Application.ExecutablePath.ToUpper(), false) != 0)
                    {
                        num2 = 156;
                        rtfError.AppendText("Loaded Assembly:   " + current6.ToString() + "\r\n");
                    }
                    num2 = 157;
                }
                ((IDisposable)enumerator13).Dispose();
                num2 = 158;
                rtfError.AppendText("\r\n");
            }
        }
        catch (object obj) when(obj is Exception && num != 0 && num6 == 0)
        {
            ProjectData.SetProjectError((Exception)obj);
            /*Error near IL_1297: Could not find block for branch target IL_1259*/;
        }
        if (num6 != 0)
        {
            ProjectData.ClearProjectError();
        }
    }
示例#13
0
        public static void LogicalDiskSample()
        {
            //// Управляющий класс
            ManagementClass diskClass = new ManagementClass("Win32_LogicalDisk");

            // true - если объекты, возвращенные от WMI, должны содержать
            // измененные сведения;
            diskClass.Options.UseAmendedQualifiers = true;


            //------- описание класса
            // Коллекция объектов QualifierData
            QualifierDataCollection qualifierCollection = diskClass.Qualifiers;

            // QualifierData - содержит сведения относительно WMI описателя
            foreach (QualifierData q in qualifierCollection)
            {
                Console.WriteLine(q.Name + " = " + q.Value);
            }
            Console.WriteLine(new string('-', 45));
            //------------------------------------------------

            //------- Доступные методы класса
            Console.WriteLine("\n Доступные методы класса... ");
            MethodDataCollection diskMethods = diskClass.Methods;

            foreach (MethodData method in diskMethods)
            {
                Console.WriteLine("Метод = " + method.Name);
            }
            Console.WriteLine(new string('-', 45));
            //------------------------------------------------
            // то же, но через нумератор
            //MethodDataCollection.MethodDataEnumerator diskEnumerator =
            //           diskClass.Methods.GetEnumerator();
            //while (diskEnumerator.MoveNext())
            //{
            //    MethodData method = diskEnumerator.Current;
            //    Console.WriteLine("Method = " + method.Name);
            //}
            //Console.WriteLine(new string('-', 45));
            //-------------------------------------------------

            //------- Свойства класса
            ManagementObject diskС = new ManagementObject("Win32_LogicalDisk.DeviceID='C:'");

            PropertyDataCollection.PropertyDataEnumerator propertyEnumerator = diskС.Properties.GetEnumerator();
            while (propertyEnumerator.MoveNext())
            {
                PropertyData p = (PropertyData)propertyEnumerator.Current;
                Console.WriteLine("Найденое свойство: " + p.Name);
            }
            Console.WriteLine(new string('-', 45));
            //------------------------------------------------

            //------- Экземпляры класса
            Console.WriteLine("\n Теперь отыщем все диски... ");
            // Получим коллекцию всех экземпляров класса
            ManagementObjectCollection disks = diskClass.GetInstances();

            // Перечислитель коллекции
            ManagementObjectCollection.ManagementObjectEnumerator disksEnumerator =
                disks.GetEnumerator();
            while (disksEnumerator.MoveNext())
            {
                ManagementObject disk = (ManagementObject)disksEnumerator.Current;
                Console.WriteLine("Найден диск: " + disk["deviceid"]);
                Console.WriteLine("Размер: " + disk["Size"]);
            }
            Console.WriteLine(new string('-', 45));
            //------------------------------------------------


            // Получение сведений о методе класса
            MethodData m = diskClass.Methods["SetPowerState"];

            Console.WriteLine("Name: " + m.Name);
            Console.WriteLine("Origin: " + m.Origin);
            // аргументы
            ManagementBaseObject inParams = m.InParameters;

            foreach (PropertyData pdata in inParams.Properties)
            {
                Console.WriteLine();
                Console.WriteLine("InParam_Name: " + pdata.Name);
                Console.WriteLine("InParam_Type: " + pdata.Type);
            }
            // Возвращаемые значения
            ManagementBaseObject outParams = m.OutParameters;

            foreach (PropertyData pdata in outParams.Properties)
            {
                Console.WriteLine();
                Console.WriteLine("OutParam_Name: " + pdata.Name);
                Console.WriteLine("OutParam_Type: " + pdata.Type);
            }
        }