本文整理汇总了C#中System.IO.DirectoryInfo.IsHidden方法的典型用法代码示例。如果您正苦于以下问题:C# DirectoryInfo.IsHidden方法的具体用法?C# DirectoryInfo.IsHidden怎么用?C# DirectoryInfo.IsHidden使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.DirectoryInfo
的用法示例。
在下文中一共展示了DirectoryInfo.IsHidden方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FromDirectory
public static FileSystemEntry FromDirectory(DirectoryInfo directory, string virtualPath)
{
Require.NotNull(directory, "directory");
return new FileSystemEntry
{
Name = directory.Name,
FullName = directory.FullName,
IsDirectory = true,
VirtualPath = virtualPath,
IsHidden = directory.IsHidden(),
CreationTime = directory.CreationTime,
LastWriteTime = directory.LastWriteTime
};
}
示例2: LoadViews
private void LoadViews(WidgetDefinition widget)
{
var viewsDir = new DirectoryInfo(Server.MapPath(widget.ViewsFolderVirtualPath));
if (!viewsDir.Exists)
{
return;
}
foreach (var viewDir in viewsDir.GetDirectories())
{
if (viewsDir.IsHidden()) continue;
var viewFile = viewDir.GetFiles("Default.*", SearchOption.TopDirectoryOnly).FirstOrDefault();
var view = new WidgetViewDefinition(widget)
{
Name = viewDir.Name,
Extension = viewFile.Extension
};
widget.Views.Add(view);
}
}
示例3: Create
public static FSGraph Create(string root)
{
var graph = new FSGraph();
var dirs = new Stack<string>(20);
if (!Directory.Exists(root))
{
throw new ArgumentException();
}
dirs.Push(root);
while (dirs.Count > 0)
{
string currentDir = dirs.Pop();
var dirInfo = new DirectoryInfo(currentDir);
if (dirInfo.IsHidden())
{
var vertex1 = graph.Vertices.SingleOrDefault(v => v.FullName == dirInfo.FullName);
if (vertex1 == null)
vertex1 = new FSVertex(dirInfo.Name, dirInfo.FullName, dirInfo.GetFriendlySize(), VertexType.Directory,
dirInfo.CreationTime, dirInfo.LastAccessTime, dirInfo.LastWriteTime);
graph.AddVertex(vertex1);
string[] subDirs = null;
try
{
subDirs = Directory.GetDirectories(currentDir);
foreach (string dir in subDirs)
{
var dirInfo2 = new DirectoryInfo(dir);
if (dirInfo2.IsHidden())
{
var vertex2 = graph.Vertices.SingleOrDefault(v => v.FullName == dirInfo2.FullName);
if (vertex2 == null)
vertex2 = new FSVertex(dirInfo2.Name, dirInfo2.FullName, dirInfo2.GetFriendlySize(), VertexType.Directory,
dirInfo2.CreationTime, dirInfo2.LastAccessTime, dirInfo2.LastWriteTime);
graph.AddVertex(vertex2);
var edge = new FSEdge(vertex1, vertex2);
graph.AddEdge(edge);
}
}
}
catch (UnauthorizedAccessException) { }
catch (DirectoryNotFoundException) { }
string[] files = null;
try
{
files = Directory.GetFiles(currentDir);
}
catch (UnauthorizedAccessException) {}
catch (DirectoryNotFoundException) {}
if (files != null)
{
foreach (string file in files)
{
try
{
var fileInfo = new FileInfo(file);
var vertex2 = graph.Vertices.SingleOrDefault(v => v.FullName == fileInfo.FullName);
if (vertex2 == null)
vertex2 = new FSVertex(fileInfo.Name, fileInfo.FullName, fileInfo.GetFriendlySize(), VertexType.File,
fileInfo.CreationTime, fileInfo.LastAccessTime, fileInfo.LastWriteTime);
graph.AddVertex(vertex2);
graph.AddEdge(new FSEdge(vertex1, vertex2));
}
catch (FileNotFoundException) {}
}
}
if (subDirs != null)
{
foreach (string dir in subDirs)
dirs.Push(dir);
}
}
}
return graph;
}