public abstract GetFiles ( ) : System.IO.Abstractions.FileInfoBase[] | ||
return | System.IO.Abstractions.FileInfoBase[] |
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(); } }
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); } }
internal static IDictionary<string, FileInfoBase> GetFiles(DirectoryInfoBase info) { if (info == null) { return null; } return info.GetFiles().ToDictionary(f => f.Name, StringComparer.OrdinalIgnoreCase); }
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; }
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; }
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; }
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; }