/// Implements a convenient wrapping for mapping a path to a drive letter
/// </summary>
publicclassDefineDosDevice:IDisposable
{
/// <summary>
/// Encapsulation of Win32 calls
/// </summary>
privatestaticclassWin32API
{
/// <summary>
/// Flags that can be used with DefineDosDevice
/// </summary>
[Flags]
publicenumDDD_Flags:uint
{
/// <summary>
/// Uses the targetpath string as is. Otherwise, it is converted from an MS-DOS path to a path.
/// </summary>
DDD_RAW_TARGET_PATH=0x1,
/// <summary>
/// Removes the specified definition for the specified device. To determine which definition to remove, the function walks the list of mappings for the device, looking for a match of targetpath against a prefix of each mapping associated with this device. The first mapping that matches is the one removed, and then the function returns.
/// If targetpath is NULL or a pointer to a NULL string, the function will remove the first mapping associated with the device and pop the most recent one pushed. If there is nothing left to pop, the device name will be removed.
/// If this value is not specified, the string pointed to by the targetpath parameter will become the new mapping for this device.
/// </summary>
DDD_REMOVE_DEFINITION=0x2,
/// <summary>
/// If this value is specified along with DDD_REMOVE_DEFINITION, the function will use an exact match to determine which mapping to remove. Use this value to ensure that you do not delete something that you did not define.
/// </summary>
DDD_EXACT_MATCH_ON_REMOVE=0x4,
/// <summary>
/// Do not broadcast the WM_SETTINGCHANGE message. By default, this message is broadcast to notify the shell and applications of the change.
/// </summary>
DDD_NO_BROADCAST_SYSTEM=0x8
}
/// <summary>
/// Defines, redefines, or deletes MS-DOS device names.
/// </summary>
/// <param name="flags">The controllable aspects of the DefineDosDevice function</param>
/// <param name="devicename">A pointer to an MS-DOS device name string specifying the device the function is defining, redefining, or deleting. The device name string must not have a colon as the last character, unless a drive letter is being defined, redefined, or deleted. For example, drive C would be the string "C:". In no case is a trailing backslash ("\") allowed.</param>
/// <param name="targetpath">A pointer to a path string that will implement this device. The string is an MS-DOS path string unless the DDD_RAW_TARGET_PATH flag is specified, in which case this string is a path string.</param>
/// <returns>True on success, false otherwise</returns>