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


C# DirectoryInfoBase.GetDirectories方法代码示例

本文整理汇总了C#中System.IO.Abstractions.DirectoryInfoBase.GetDirectories方法的典型用法代码示例。如果您正苦于以下问题:C# DirectoryInfoBase.GetDirectories方法的具体用法?C# DirectoryInfoBase.GetDirectories怎么用?C# DirectoryInfoBase.GetDirectories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.Abstractions.DirectoryInfoBase的用法示例。


在下文中一共展示了DirectoryInfoBase.GetDirectories方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetDirectories

 internal static IDictionary<string, DirectoryInfoBase> GetDirectories(DirectoryInfoBase info)
 {
     if (info == null)
     {
         return null;
     }
     return info.GetDirectories().ToDictionary(d => d.Name, StringComparer.OrdinalIgnoreCase);
 }
开发者ID:amitapl,项目名称:KuduSync.NET,代码行数:8,代码来源:FileSystemHelpers.cs

示例2: CollectDirectories

        private bool CollectDirectories(DirectoryInfoBase directory, INode rootNode, GeneralTree<INode> tree)
        {
            List<GeneralTree<INode>> collectedNodes = new List<GeneralTree<INode>>();

            foreach (DirectoryInfoBase subDirectory in directory.GetDirectories().OrderBy(di => di.Name))
            {
                GeneralTree<INode> subTree = this.Crawl(subDirectory, rootNode);
                if (subTree != null)
                {
                    collectedNodes.Add(subTree);
                }
            }

            foreach (var node in collectedNodes)
            {
                tree.Add(node);
            }

            return collectedNodes.Count > 0;
        }
开发者ID:MikeThomas64,项目名称:pickles,代码行数:20,代码来源:DirectoryTreeCrawler.cs

示例3: Copy

        internal static void Copy(string sourcePath,
                                  string destinationPath,
                                  DirectoryInfoBase sourceDirectory,
                                  DirectoryInfoBase destinationDirectory,
                                  Func<string, DirectoryInfoBase> createDirectoryInfo,
                                  bool skipScmFolder)
        {
            // Skip hidden directories and directories that begin with .
            if (skipScmFolder && IsSourceControlFolder(sourceDirectory))
            {
                return;
            }

            if (!destinationDirectory.Exists)
            {
                destinationDirectory.Create();
            }

            foreach (var sourceFile in sourceDirectory.GetFiles())
            {
                string path = GetDestinationPath(sourcePath, destinationPath, sourceFile);

                sourceFile.CopyTo(path, overwrite: true);
            }

            var destDirectoryLookup = GetDirectories(destinationDirectory);
            foreach (var sourceSubDirectory in sourceDirectory.GetDirectories())
            {
                DirectoryInfoBase targetSubDirectory;
                if (!destDirectoryLookup.TryGetValue(sourceSubDirectory.Name, out targetSubDirectory))
                {
                    string path = GetDestinationPath(sourcePath, destinationPath, sourceSubDirectory);
                    targetSubDirectory = createDirectoryInfo(path);
                }

                Copy(sourcePath, destinationPath, sourceSubDirectory, targetSubDirectory, createDirectoryInfo, skipScmFolder);
            }
        }
开发者ID:lookworld,项目名称:kudu,代码行数:38,代码来源:FileSystemHelpers.cs


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