本文整理汇总了C#中System.IO.FileSystemInfo.IsDirectory方法的典型用法代码示例。如果您正苦于以下问题:C# FileSystemInfo.IsDirectory方法的具体用法?C# FileSystemInfo.IsDirectory怎么用?C# FileSystemInfo.IsDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.FileSystemInfo
的用法示例。
在下文中一共展示了FileSystemInfo.IsDirectory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckConflictsWithFile
private void CheckConflictsWithFile(FileSystemInfo file)
{
if (file.IsDirectory())
{
List<string> childFiles = ListFiles(file);
Conflicts.AddRange(childFiles);
}
else
{
FileSystemInfo parent = Directory.GetParent(file.FullName);
if (parent == null) return;
while (!parent.Equals(_root))
{
if (parent.IsDirectory())
{
break;
}
if (parent.IsFile())
{
Conflicts.Add(Repository.StripWorkDir(_root, parent));
break;
}
parent = Directory.GetParent(parent.FullName);
if (parent == null) return;
}
}
}
示例2: CreateFrom
public static FileSystemSearchResult CreateFrom(IResultProvider provider, FileSystemInfo fileSystemInfo)
{
if (fileSystemInfo.IsDirectory())
return new DirectorySearchResult(provider, (DirectoryInfo)fileSystemInfo);
if (fileSystemInfo.Extension == ".lnk")
return new ShortcutSearchResult(provider, (FileInfo)fileSystemInfo);
return new FileSearchResult(provider, (FileInfo)fileSystemInfo);
}
示例3: FileEntry
public FileEntry(FileSystemInfo f)
{
_file = f;
_fileLength = -1;
if (_file.IsDirectory())
{
_mode = PathUtil.CombineDirectoryPath((DirectoryInfo)_file, Constants.DOT_GIT).Exists ? FileMode.GitLink : FileMode.Tree;
}
else if (_file.IsFile())
{
_mode = FS.canExecute(_file) ? FileMode.ExecutableFile : FileMode.RegularFile;
}
}
示例4: FileEntry
public FileEntry(FileSystemInfo f)
{
_file = f;
if (f.IsDirectory())
{
_isADirectory = true;
if (PathUtil.CombineDirectoryPath((DirectoryInfo)f, Constants.DOT_GIT).IsDirectory())
_mode = FileMode.GitLink;
else
_mode = FileMode.Tree;
}
else if (FS.canExecute(_file))
_mode = FileMode.ExecutableFile;
else
_mode = FileMode.RegularFile;
}