当前位置: 首页>>代码示例>>C#>>正文


C# DirectoryInfo.IsHidden方法代码示例

本文整理汇总了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
            };
        }
开发者ID:sigcms,项目名称:Seeger,代码行数:15,代码来源:FileSystemEntry.cs

示例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);
            }
        }
开发者ID:sigcms,项目名称:Seeger,代码行数:21,代码来源:DefaultWidgetLoader.cs

示例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;
        }
开发者ID:piotrosz,项目名称:FSGraph,代码行数:89,代码来源:GraphCreator.cs


注:本文中的System.IO.DirectoryInfo.IsHidden方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。