【发布时间】:2018-01-30 20:00:49
【问题描述】:
正如标题所暗示的,我想知道网络驱动器是 NTFS 还是 Fat 格式。
对于本地驱动器和路径,我使用了 DriveInfo,它工作正常,但是当您尝试将驱动器信息与网络驱动器路径一起使用时,我得到了这个异常:
System.Collections.ListDictionaryInternal -Object 必须是根目录(“C:\”)或驱动器号(“C”)。
public static bool IsNtfsDrive(string directory)
{
try
{
// Get drive info
var driveInfo = new DriveInfo(directory);
// Check if drive is NTFS partition
return driveInfo.DriveFormat == Cntfs;
}
catch (Exception e)
{
Console.WriteLine("Data: " + e.Data + " -Message: " + e.Message);
return false;
}
}
【问题讨论】:
标签: c# networking network-programming format