C# Class TrueLib.SystemDevices

Static wrapper for windows system devices.
Datei anzeigen Open project: nefarius/TrueMount-3

Public Methods

Method Description
GetDiskDriveBySignature ( String caption, uint signature ) : System.Management.ManagementObject

Gets a device with given caption and signature.

GetDiskSignatureFromLetter ( String letter, string &caption, uint &signature, uint &partitionNr ) : void

Gets the disk caption, signature and partition number by the drive letter.

GetDriveLetterBySignature ( String caption, uint signature, uint partitionNr ) : String

Gets the drive letter of a logical disk identified by its caption, signature and partition number.

GetLocalDiskPartitions ( ) : List

For debugging: returns identity information about all attached disks.

GetLogicalDisk ( String letter, int drive_type = 3 ) : System.Management.ManagementObject

Gets a logical disk by a drive letter an disk type.

GetPartitionByIndex ( uint DiskIndex, uint Index ) : System.Management.ManagementObject

Gets a partition by its disk index and partition index.

GetPartitionBySignature ( String caption, uint signature, uint partitionNr ) : System.Management.ManagementObject

Gets a partition with a given drive signature and partition index.

GetTCCompatibleDiskPath ( uint index ) : string

Returns a TC compatible path to an encrypted hard disk.

GetTCCompatibleName ( String deviceid ) : String

Converts the device id into a TrueCrypt compatible path.

IsDiskOnline ( string caption, uint signature ) : bool

Checks if a given disk is online.

IsLogicalDiskOnline ( String letter, int type = 2 ) : bool

Checks if logical device is online (=plugged in and mounted with drive letter).

IsPartitionOnline ( string caption, uint signature, uint partitionIndex ) : bool

Checks if a given disk drive partition is online.

IsRemovablePartition ( string deviceId ) : bool

Checks if a partition with given DeviceID is removable.

Private Methods

Method Description
ReplaceEvaluator ( Match m ) : string

Contains logic to build a TC compatible device path.

Method Details

GetDiskDriveBySignature() public static method

Gets a device with given caption and signature.
public static GetDiskDriveBySignature ( String caption, uint signature ) : System.Management.ManagementObject
caption String Caption (title, name) of the device.
signature uint Signature (10 digit unsigned integer) of the device. May be 0 in some cases.
return System.Management.ManagementObject

GetDiskSignatureFromLetter() public static method

Gets the disk caption, signature and partition number by the drive letter.
public static GetDiskSignatureFromLetter ( String letter, string &caption, uint &signature, uint &partitionNr ) : void
letter String Drive letter of the logical disk.
caption string Caption of the disk.
signature uint Signature of the disk.
partitionNr uint Partition number (zero based).
return void

GetDriveLetterBySignature() public static method

Gets the drive letter of a logical disk identified by its caption, signature and partition number.
public static GetDriveLetterBySignature ( String caption, uint signature, uint partitionNr ) : String
caption String Caption (title, name) of the disk.
signature uint Signature (10 digit unsigned integer) of the disk.
partitionNr uint Partition number (zero based).
return String

GetLocalDiskPartitions() public static method

For debugging: returns identity information about all attached disks.
public static GetLocalDiskPartitions ( ) : List
return List

GetLogicalDisk() public static method

Gets a logical disk by a drive letter an disk type.
public static GetLogicalDisk ( String letter, int drive_type = 3 ) : System.Management.ManagementObject
letter String Drive letter of the disk.
drive_type int Optional drive type (3 = local, 2 = removable).
return System.Management.ManagementObject

GetPartitionByIndex() public static method

Gets a partition by its disk index and partition index.
public static GetPartitionByIndex ( uint DiskIndex, uint Index ) : System.Management.ManagementObject
DiskIndex uint Disk index (zero based).
Index uint Partition index (zero based).
return System.Management.ManagementObject

GetPartitionBySignature() public static method

Gets a partition with a given drive signature and partition index.
public static GetPartitionBySignature ( String caption, uint signature, uint partitionNr ) : System.Management.ManagementObject
caption String The disk drive caption.
signature uint The disk drive signature.
partitionNr uint The zero-based partition number.
return System.Management.ManagementObject

GetTCCompatibleDiskPath() public static method

Returns a TC compatible path to an encrypted hard disk.
public static GetTCCompatibleDiskPath ( uint index ) : string
index uint
return string

GetTCCompatibleName() public static method

Converts the device id into a TrueCrypt compatible path.
public static GetTCCompatibleName ( String deviceid ) : String
deviceid String Device ID
return String

IsDiskOnline() public static method

Checks if a given disk is online.
public static IsDiskOnline ( string caption, uint signature ) : bool
caption string The caption of the disk drive.
signature uint The signature of the disk drive.
return bool

IsLogicalDiskOnline() public static method

Checks if logical device is online (=plugged in and mounted with drive letter).
public static IsLogicalDiskOnline ( String letter, int type = 2 ) : bool
letter String Drive letter of the device.
type int
return bool

IsPartitionOnline() public static method

Checks if a given disk drive partition is online.
public static IsPartitionOnline ( string caption, uint signature, uint partitionIndex ) : bool
caption string The caption of the disk drive.
signature uint The signature of the disk drive.
partitionIndex uint The zero-based partition index.
return bool

IsRemovablePartition() public static method

Checks if a partition with given DeviceID is removable.
public static IsRemovablePartition ( string deviceId ) : bool
deviceId string The disk partition DeviceID.
return bool