Beispiel #1
0
 /// <summary>
 /// Determines whether the given path is on a local drive (no network drive).
 /// <locDE><para />Ermittelt, ob der angegebene Pfad auf einem lokalen Laufwerk liegt (kein Netzlaufwerk).</locDE>
 /// </summary>
 /// <param name="path">The path.<locDE><para />Der Pfad.</locDE></param>
 /// <returns>True, if the path is on a local drive.
 /// <locDE><para />True, falls der Pfad auf einen lokalen Laufwerk liegt.</locDE>
 /// </returns>
 public static bool IsLocalPath(string path)
 {
     System.IO.DriveType driveType = GetPathDriveType(path);
     switch (driveType)
     {
     case System.IO.DriveType.CDRom:
     case System.IO.DriveType.Fixed:
     case System.IO.DriveType.Ram:
     case System.IO.DriveType.Removable:
         return(true);
         //case System.IO.DriveType.Network:
         //case System.IO.DriveType.NoRootDirectory:
         //case System.IO.DriveType.Unknown:
         //    break;
     }
     return(false);
 }
Beispiel #2
0
        public static string GetDriveTypeDescription(System.IO.DriveType driveType)
        {
            string dt = string.Empty;

            switch (driveType)
            {
            case System.IO.DriveType.CDRom:
                dt = "只读光盘";
                break;

            case System.IO.DriveType.Fixed:
                dt = "本地磁盘";
                break;

            case System.IO.DriveType.Network:
                dt = "网络磁盘";
                break;

            case System.IO.DriveType.NoRootDirectory:
                dt = "<错误>无效根路径";
                break;

            case System.IO.DriveType.Ram:
                dt = "随机存取内存";
                break;

            case System.IO.DriveType.Removable:
                dt = "可移动磁盘";
                break;

            case System.IO.DriveType.Unknown:
                dt = "未知类型";
                break;

            default:
                dt = "未知类型";
                break;
            }
            return(dt);
        }