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


C# DirectoryInfoBase.GetFiles方法代码示例

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


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

示例1: TryReadNpmVersion

 private static string TryReadNpmVersion(DirectoryInfoBase nodeDir)
 {
     var npmRedirectionFile = nodeDir.GetFiles("npm.txt").FirstOrDefault();
     if (npmRedirectionFile == null)
     {
         return null;
     }
     using (StreamReader reader = new StreamReader(npmRedirectionFile.OpenRead()))
     {
         return reader.ReadLine();
     }
 }
开发者ID:40a,项目名称:kudu,代码行数:12,代码来源:RuntimeController.cs

示例2: 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

示例3: GetFiles

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

示例4: CollectFiles

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

            foreach (FileInfoBase file in directory.GetFiles().Where(file => this.relevantFileDetector.IsRelevant(file)))
            {
                INode node = null;
                try
                {
                    node = this.featureNodeFactory.Create(rootNode.OriginalLocation, file);
                }
                catch (Exception)
                {
                    if (Log.IsWarnEnabled)
                    {
                        // retrieving the name as file.FullName may trigger an exception if the FullName is too long
                        // so we retreive Name and DirectoryName separately
                        // https://github.com/picklesdoc/pickles/issues/199
                        var fullName = file.Name + " in directory " + file.DirectoryName;
                        Log.Warn("The file {0} will be ignored because it could not be read in properly", fullName);
                    }
                }

                if (node != null)
                {
                    collectedNodes.Add(node);
                }
            }

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

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

示例5: tryResolveAssembly

        Assembly tryResolveAssembly(DirectoryInfoBase directory, ResolveEventArgs args)
        {
            try {
                if (directory.Exists) {
                    var files = directory.GetFiles("*.dll")
                        .Concat(directory.GetFiles("*.exe"));

                    foreach (var f in files) {
                        var assemblyName = AssemblyName.GetAssemblyName(f.FullName);

                        if (assemblyName.FullName == args.Name) {
                            return Assembly.Load(assemblyName);
                        }
                    }
                }
            }
            catch (Exception ex) {
                log.WarnException("Could not resolve assembly: " + args.Name, ex);
            }

            return null;
        }
开发者ID:rzhw,项目名称:Squirrel.Windows,代码行数:22,代码来源:InstallerHookOperations.cs

示例6: CollectFiles

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

        foreach (FileInfoBase file in directory.GetFiles().Where(file => this.relevantFileDetector.IsRelevant(file)))
        {
          INode node = null;
          try
          {
            node = this.featureNodeFactory.Create(rootNode.OriginalLocation, file);
          }
          catch (Exception)
          {
            if (log.IsWarnEnabled)
            {
              log.WarnFormat("The file, {0}, will be ignored because it could not be read in properly", file.FullName);
            }
          }

          if (node != null)
          {
            collectedNodes.Add(node);
          }
        }

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

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

示例7: CollectFiles

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

            foreach (FileInfoBase file in directory.GetFiles().Where(file => this.relevantFileDetector.IsRelevant(file)))
            {
                INode node = this.featureNodeFactory.Create(rootNode.OriginalLocation, file);
                collectedNodes.Add(node);
            }

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

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


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