亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? device.cs

?? USB device eject 的源文件
?? CS
字號:
// UsbEject version 1.0 March 2006
// written by Simon Mourier <email: simon [underscore] mourier [at] hotmail [dot] com>

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Text;

namespace UsbEject.Library
{
    /// <summary>
    /// A generic base class for physical devices.
    /// </summary>
    [TypeConverter(typeof(ExpandableObjectConverter))]
    public class Device : IComparable
    {
        private string _path;
        private DeviceClass _deviceClass;
        private string _description;
        private string _class;
        private string _classGuid;
        private Device _parent;
        private int _index;
        private DeviceCapabilities _capabilities = DeviceCapabilities.Unknown;
        private List<Device> _removableDevices;
        private string _friendlyName;
        private Native.SP_DEVINFO_DATA _deviceInfoData;

        internal Device(DeviceClass deviceClass, Native.SP_DEVINFO_DATA deviceInfoData, string path, int index)
        {
            if (deviceClass == null)
                throw new ArgumentNullException("deviceClass");

            if (deviceInfoData == null)
                throw new ArgumentNullException("deviceInfoData");

            _deviceClass = deviceClass;
            _path = path; // may be null
            _deviceInfoData = deviceInfoData;
            _index = index;
        }

        /// <summary>
        /// Gets the device's index.
        /// </summary>
        public int Index
        {
            get
            {
                return _index;
            }
        }

        /// <summary>
        /// Gets the device's class instance.
        /// </summary>
        [Browsable(false)]
        public DeviceClass DeviceClass
        {
            get
            {
                return _deviceClass;
            }
        }

        /// <summary>
        /// Gets the device's path.
        /// </summary>
        public string Path
        {
            get
            {
                if (_path == null)
                {
                }
                return _path;
            }
        }

        /// <summary>
        /// Gets the device's instance handle.
        /// </summary>
        public int InstanceHandle
        {
            get
            {
                return _deviceInfoData.devInst;
            }
        }

        /// <summary>
        /// Gets the device's class name.
        /// </summary>
        public string Class
        {
            get
            {
                if (_class == null)
                {
                    _class = _deviceClass.GetProperty(_deviceInfoData, Native.SPDRP_CLASS, null);
                }
                return _class;
            }
        }

        /// <summary>
        /// Gets the device's class Guid as a string.
        /// </summary>
        public string ClassGuid
        {
            get
            {
                if (_classGuid == null)
                {
                    _classGuid = _deviceClass.GetProperty(_deviceInfoData, Native.SPDRP_CLASSGUID, null);
                }
                return _classGuid;
            }
        }

        /// <summary>
        /// Gets the device's description.
        /// </summary>
        public string Description
        {
            get
            {
                if (_description == null)
                {
                    _description = _deviceClass.GetProperty(_deviceInfoData, Native.SPDRP_DEVICEDESC, null);
                }
                return _description;
            }
        }

        /// <summary>
        /// Gets the device's friendly name.
        /// </summary>
        public string FriendlyName
        {
            get
            {
                if (_friendlyName == null)
                {
                    _friendlyName = _deviceClass.GetProperty(_deviceInfoData, Native.SPDRP_FRIENDLYNAME, null);
                }
                return _friendlyName;
            }
        }

        /// <summary>
        /// Gets the device's capabilities.
        /// </summary>
        public DeviceCapabilities Capabilities
        {
            get
            {
                if (_capabilities == DeviceCapabilities.Unknown)
                {
                    _capabilities = (DeviceCapabilities)_deviceClass.GetProperty(_deviceInfoData, Native.SPDRP_CAPABILITIES, 0);
                }
                return _capabilities;
            }
        }

        /// <summary>
        /// Gets a value indicating whether this device is a USB device.
        /// </summary>
        public virtual bool IsUsb
        {
            get
            {
                if (Class == "USB")
                    return true;

                if (Parent == null)
                    return false;

                return Parent.IsUsb;
            }
        }

        /// <summary>
        /// Gets the device's parent device or null if this device has not parent.
        /// </summary>
        public Device Parent
        {
            get
            {
                if (_parent == null)
                {
                    int parentDevInst = 0;
                    int hr = Native.CM_Get_Parent(ref parentDevInst, _deviceInfoData.devInst, 0);
                    if (hr == 0)
                    {
                        _parent = new Device(_deviceClass, _deviceClass.GetInfo(parentDevInst), null, -1);
                    }
                }
                return _parent;
            }
        }

        /// <summary>
        /// Gets this device's list of removable devices.
        /// Removable devices are parent devices that can be removed.
        /// </summary>
        public virtual List<Device> RemovableDevices
        {
            get
            {
                if (_removableDevices == null)
                {
                    _removableDevices = new List<Device>();

                    if ((Capabilities & DeviceCapabilities.Removable) != 0)
                    {
                        _removableDevices.Add(this);
                    }
                    else
                    {
                        if (Parent != null)
                        {
                            foreach (Device device in Parent.RemovableDevices)
                            {
                                _removableDevices.Add(device);
                            }
                        }
                    }
                }
                return _removableDevices;
            }
        }

        /// <summary>
        /// Ejects the device.
        /// </summary>
        /// <param name="allowUI">Pass true to allow the Windows shell to display any related UI element, false otherwise.</param>
        /// <returns>null if no error occured, otherwise a contextual text.</returns>
        public string Eject(bool allowUI)
        {
            foreach (Device device in RemovableDevices)
            {
                if (allowUI)
                {
                    Native.CM_Request_Device_Eject_NoUi(device.InstanceHandle, IntPtr.Zero, null, 0, 0);
                    // don't handle errors, there should be a UI for this
                }
                else
                {
                    StringBuilder sb = new StringBuilder(1024);

                    Native.PNP_VETO_TYPE veto;
                    int hr = Native.CM_Request_Device_Eject(device.InstanceHandle, out veto, sb, sb.Capacity, 0);
                    if (hr != 0)
                        throw new Win32Exception(hr);

                    if (veto != Native.PNP_VETO_TYPE.Ok)
                        return veto.ToString();
                }

            }
            return null;
        }

        /// <summary>
        /// Compares the current instance with another object of the same type.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>A 32-bit signed integer that indicates the relative order of the comparands.</returns>
        public virtual int CompareTo(object obj)
        {
            Device device = obj as Device;
            if (device == null)
                throw new ArgumentException();

            return Index.CompareTo(device.Index);
        }
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久激情视频| 亚洲成av人片在线观看无码| 亚洲女爱视频在线| 麻豆成人免费电影| 色一区在线观看| 久久综合色天天久久综合图片| 依依成人精品视频| 国产99久久久久| 日韩欧美高清一区| 日韩在线观看一区二区| 91色.com| 一区二区三区在线不卡| 成人免费视频caoporn| 日韩色在线观看| 五月综合激情婷婷六月色窝| 色偷偷一区二区三区| 欧美激情一区在线| 国产成人免费视频| 精品国产91亚洲一区二区三区婷婷| 性感美女极品91精品| 91久久一区二区| 依依成人精品视频| 91女神在线视频| 亚洲免费观看在线视频| 91香蕉视频污| 亚洲猫色日本管| 91视频观看视频| 一区二区三区加勒比av| 色拍拍在线精品视频8848| 亚洲欧洲精品一区二区三区| 成人午夜在线免费| 国产精品久久久久久久久晋中 | 亚洲色图欧美在线| 成人av网站大全| 中文字幕色av一区二区三区| 北条麻妃国产九九精品视频| 国产欧美精品国产国产专区| 国产乱人伦偷精品视频免下载| 国产亚洲va综合人人澡精品| 成人免费毛片嘿嘿连载视频| 国产精品乱码一区二三区小蝌蚪| 风间由美中文字幕在线看视频国产欧美 | 综合色天天鬼久久鬼色| 91在线精品秘密一区二区| 亚洲免费高清视频在线| 欧美中文字幕亚洲一区二区va在线 | 99国产麻豆精品| 亚洲一区二区不卡免费| 欧美日韩精品一区二区天天拍小说| 亚洲 欧美综合在线网络| 欧美成人a视频| 狠狠色丁香九九婷婷综合五月| 久久久久久久久久久久久久久99 | 精品区一区二区| 国产伦精一区二区三区| 国产精品女主播在线观看| 色综合久久久久综合| 亚洲在线成人精品| 欧美一级国产精品| 丁香网亚洲国际| 亚洲一二三区在线观看| 欧美高清www午色夜在线视频| 激情综合五月天| 亚洲三级免费观看| 欧美一区日本一区韩国一区| 国产精品一区二区在线观看网站| 亚洲欧美成aⅴ人在线观看| 在线综合+亚洲+欧美中文字幕| 国产乱妇无码大片在线观看| 亚洲精选在线视频| 精品免费日韩av| 91色在线porny| 国产一区二区三区免费看| 亚洲欧洲综合另类在线| 精品人伦一区二区色婷婷| 91视频在线看| 国产伦精品一区二区三区视频青涩| 亚洲欧美激情插| 久久久精品中文字幕麻豆发布| 欧洲国内综合视频| 国产成人精品一区二| 亚洲成a天堂v人片| 中文av一区二区| 日韩网站在线看片你懂的| 色综合久久综合网97色综合 | 亚洲一区二区美女| 久久精品视频一区| 欧美剧情电影在线观看完整版免费励志电影 | 国产麻豆欧美日韩一区| 日韩专区中文字幕一区二区| 日韩理论片网站| 国产午夜精品久久久久久免费视 | 免费成人小视频| 一区二区三区四区蜜桃| 国产精品久久影院| 精品国产乱码久久久久久老虎| 欧美三级在线播放| 成人不卡免费av| 国产一区二区福利| 日韩av高清在线观看| 亚洲一区二区三区四区五区黄| 日本一区二区三区电影| 精品国产乱码久久久久久1区2区| 欧美日韩视频第一区| 欧美在线免费观看视频| 91色在线porny| 91丨porny丨在线| 99国产精品国产精品久久| 播五月开心婷婷综合| 国产福利电影一区二区三区| 精品一区二区三区久久| 蜜桃久久久久久| 天堂成人国产精品一区| 日韩av电影天堂| 日韩和欧美的一区| 日韩av不卡在线观看| 日韩精品久久久久久| 日本午夜一区二区| 美女视频黄频大全不卡视频在线播放| 天天影视涩香欲综合网| 日本不卡一区二区| 美腿丝袜在线亚洲一区| 韩国视频一区二区| 国产91丝袜在线播放九色| 国产99久久久精品| 91在线视频网址| 色婷婷综合久久久久中文| 欧美午夜一区二区三区| 欧美一区二区三区四区五区| 精品美女在线播放| 国产精品丝袜久久久久久app| 亚洲欧洲国产日韩| 亚洲在线观看免费| 日韩av在线免费观看不卡| 激情综合五月天| 91丝袜美腿高跟国产极品老师 | 亚洲宅男天堂在线观看无病毒| 亚洲小说欧美激情另类| 美腿丝袜一区二区三区| 国产91露脸合集magnet| 日本国产一区二区| 日韩一二三区不卡| 国产精品另类一区| 亚洲第一电影网| 国产精品自在欧美一区| 色综合天天狠狠| 日韩视频一区二区在线观看| 国产蜜臀97一区二区三区| 亚洲国产毛片aaaaa无费看| 麻豆成人久久精品二区三区红| 成人午夜精品一区二区三区| 欧美专区在线观看一区| 久久看人人爽人人| 亚洲午夜激情网页| 粉嫩欧美一区二区三区高清影视| 欧美色中文字幕| 欧美激情一区在线| 日韩av中文字幕一区二区三区| 国产精品一品视频| 欧美高清www午色夜在线视频| 国产亚洲欧洲一区高清在线观看| 一区二区成人在线| 国产麻豆精品视频| 欧美巨大另类极品videosbest| 国产精品免费视频观看| 日韩av中文字幕一区二区三区| av网站免费线看精品| 精品国产成人系列| 亚洲大片精品永久免费| 成人av综合在线| 精品国产麻豆免费人成网站| 午夜精品一区二区三区免费视频| 国产69精品一区二区亚洲孕妇| 7777女厕盗摄久久久| 自拍av一区二区三区| 国产成人在线免费| 日韩一卡二卡三卡国产欧美| 一区二区三区 在线观看视频| 成人一道本在线| 欧美r级电影在线观看| 亚洲成人av中文| 在线视频一区二区三区| 国产精品私人影院| 国产馆精品极品| 久久综合九色综合欧美亚洲| 日欧美一区二区| 欧美美女一区二区在线观看| 一个色在线综合| 色综合天天做天天爱| 国产精品成人免费| 懂色一区二区三区免费观看| 国产婷婷一区二区| 国产乱码精品一品二品| 亚洲精品在线免费播放| 久久机这里只有精品| 欧美一区二区成人| 蜜桃av一区二区在线观看 | av日韩在线网站| 国产精品初高中害羞小美女文| 丁香婷婷综合五月|