protected ParallelPortDevice(RegistryKey deviceKey)
        {
            DeviceKeyName = deviceKey.Name;
            string HKLM_BackSlash = CurrentControlSetDeviceEnumerator.CombinePath(CurrentControlSetDeviceEnumerator.HKLM, string.Empty);

            if (DeviceKeyName.StartsWith(HKLM_BackSlash))
            {
                DeviceKeyName = DeviceKeyName.Replace(HKLM_BackSlash, string.Empty);
            }

            object _class = deviceKey.GetValue("Class"); // do not translate

            Class = objectToString(_class);

            object deviceDesc = deviceKey.GetValue("DeviceDesc"); // do not translate

            DeviceDesc = objectToString(deviceDesc);

            object friendlyName = deviceKey.GetValue("FriendlyName"); // do not translate

            FriendlyName = objectToString(friendlyName);

            object mfg = deviceKey.GetValue("Mfg"); // do not translate

            Mfg = objectToString(mfg);

            using (RegistryKey deviceParametersKey = deviceKey.OpenSubKey("Device Parameters")) // do not translate
            {
                if (null != deviceParametersKey)
                {
                    object portName = deviceParametersKey.GetValue("PortName"); // do not translate
                    PortName = objectToString(portName);
                    if (PortName.EndsWith(":"))
                    {
                        PortName = PortName.Substring(0, PortName.Length - 1);
                    }
                    object ieee1284Manufacturer = deviceParametersKey.GetValue("IEEE_1284_Manufacturer");
                    IEEE_1284_Manufacturer = objectToString(ieee1284Manufacturer);
                    object ieee1284Model = deviceParametersKey.GetValue("IEEE_1284_Model");
                    IEEE_1284_Model = objectToString(ieee1284Model);
                }
            }

            object upperFilters = deviceKey.GetValue("UpperFilters"); // do not translate

            UpperFilters = objectToString(upperFilters);

            object service = deviceKey.GetValue("Service"); // do not translate

            Service = objectToString(service);
        }
Esempio n. 2
0
        protected SerialPortDevice(RegistryKey deviceKey)
        {
            DeviceKeyName = deviceKey.Name;
            string HKLM_BackSlash = CurrentControlSetDeviceEnumerator.CombinePath(CurrentControlSetDeviceEnumerator.HKLM, string.Empty);

            if (DeviceKeyName.StartsWith(HKLM_BackSlash))
            {
                DeviceKeyName = DeviceKeyName.Replace(HKLM_BackSlash, string.Empty);
            }

            object _class = deviceKey.GetValue("Class"); // do not translate

            Class = objectToString(_class);

            object deviceDesc = deviceKey.GetValue("DeviceDesc"); // do not translate

            DeviceDesc = objectToString(deviceDesc);

            object friendlyName = deviceKey.GetValue("FriendlyName"); // do not translate

            FriendlyName = objectToString(friendlyName);

            object mfg = deviceKey.GetValue("Mfg"); // do not translate

            Mfg = objectToString(mfg);

            using (RegistryKey deviceParametersKey = deviceKey.OpenSubKey("Device Parameters")) // do not translate
            {
                if (null != deviceParametersKey)
                {
                    object portName = deviceParametersKey.GetValue("PortName"); // do not translate
                    PortName = objectToString(portName);
                }
            }

            object upperFilters = deviceKey.GetValue("UpperFilters"); // do not translate

            UpperFilters = objectToString(upperFilters);

            object service = deviceKey.GetValue("Service"); // do not translate

            Service = objectToString(service);
        }