C# Class MediaPortal.Util.RemovableDriveHelper

Removable Drive Detection helper class
显示文件 Open project: MediaPortal/MediaPortal-1 Class Usage Examples

Public Methods

Method Description
EjectDrive ( String path, String &message ) : bool

Ejects a drive. The caller has to ensure that it is a USB drive

EjectMedia ( string path, String &message ) : bool
HandleDeviceChangedMessage ( Message msg ) : bool

Handles the window message when a drive change is in progress or finished

SetExamineCDTime ( System.DateTime ExamineCDTime ) : void

Provides system last mount time

SetMountTime ( System.DateTime mountTime ) : void

Provides system last mount

Private Methods

Method Description
CM_Get_Parent ( int &pdnDevInst, int dnDevInst, int ulFlags ) : int
CM_Request_Device_Eject ( int dnDevInst, PNP_VETO_TYPE &pVetoType, StringBuilder pszVetoName, int ulNameLength, int ulFlags ) : int
CloseHandle ( IntPtr handle ) : bool
CreateFile ( string lpFileName, int dwDesiredAccess, int dwShareMode, IntPtr lpSecurityAttributes, int dwCreationDisposition, int dwFlagsAndAttributes, IntPtr hTemplateFile ) : IntPtr
DeviceIoControl ( IntPtr hDevice, int dwIoControlCode, byte lpInBuffer, int nInBufferSize, IntPtr lpOutBuffer, int nOutBufferSize, int &lpBytesReturned, IntPtr lpOverlapped ) : bool
DeviceIoControl ( IntPtr hDevice, int dwIoControlCode, byte lpInBuffer, int nInBufferSize, byte lpOutBuffer, int nOutBufferSize, int &lpBytesReturned, IntPtr lpOverlapped ) : bool
DeviceNew ( DEV_BROADCAST_VOLUME volumeInformation ) : bool

Extracts the Volume letter and sends a gui message with the extracted volume letter so that other plugins can add this drive out of there virtual directory

DeviceRemoved ( DEV_BROADCAST_VOLUME volumeInformation ) : bool

Extracts the Volume letter and sends a gui message with the extracted volume letter so that other plugins can remove this drive out of there virtual directory

GetDevInfoForDeviceNumber ( long DeviceNumber ) : SP_DEVINFO_DATA

Get Device data for the given device number

GetDeviceNumber ( string devicePath ) : int

Determins the device number

GetVolumeLetter ( int Mask ) : char

Extract the volume letter from the WIN32 Mask extracted from a windows message

SetupDiEnumDeviceInterfaces ( IntPtr deviceInfoSet, SP_DEVINFO_DATA deviceInfoData, System.Guid &interfaceClassGuid, int memberIndex, SP_DEVICE_INTERFACE_DATA deviceInterfaceData ) : bool
SetupDiGetClassDevs ( System.Guid &classGuid, int enumerator, IntPtr hwndParent, int flags ) : IntPtr
SetupDiGetDeviceInterfaceDetail ( IntPtr deviceInfoSet, SP_DEVICE_INTERFACE_DATA deviceInterfaceData, IntPtr deviceInterfaceDetailData, int deviceInterfaceDetailDataSize, int &requiredSize, SP_DEVINFO_DATA deviceInfoData ) : bool

Method Details

EjectDrive() public static method

Ejects a drive. The caller has to ensure that it is a USB drive
public static EjectDrive ( String path, String &message ) : bool
path String Path of the drive to eject
message String Response message
return bool

EjectMedia() public static method

public static EjectMedia ( string path, String &message ) : bool
path string
message String
return bool

HandleDeviceChangedMessage() public static method

Handles the window message when a drive change is in progress or finished
public static HandleDeviceChangedMessage ( Message msg ) : bool
msg System.Windows.Forms.Message Window message
return bool

SetExamineCDTime() public static method

Provides system last mount time
public static SetExamineCDTime ( System.DateTime ExamineCDTime ) : void
ExamineCDTime System.DateTime
return void

SetMountTime() public static method

Provides system last mount
public static SetMountTime ( System.DateTime mountTime ) : void
mountTime System.DateTime
return void