本文整理汇总了C#中FileSystem.FindFiles方法的典型用法代码示例。如果您正苦于以下问题:C# FileSystem.FindFiles方法的具体用法?C# FileSystem.FindFiles怎么用?C# FileSystem.FindFiles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileSystem
的用法示例。
在下文中一共展示了FileSystem.FindFiles方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenameClasses
public void RenameClasses()
{
var folder = ".".ToFullPath().ParentDirectory().ParentDirectory()
.AppendPath("CodeTracker");
var fileSystem = new FileSystem();
var files = fileSystem.FindFiles(folder, FileSet.Shallow("*.json"));
foreach (var file in files)
{
var json = fileSystem.ReadStringFromFile(file);
json = replace(json, "GithubProject");
json = replace(json, "Timestamped[]");
json = replace(json, "ProjectStarted");
json = replace(json, "IssueCreated");
json = replace(json, "IssueClosed");
json = replace(json, "IssueReopened");
json = replace(json, "Commit");
fileSystem.WriteStringToFile(file, json);
}
}
示例2: LoadAllProjects
public void LoadAllProjects()
{
var fileSystem = new FileSystem();
var folder = AppContext.BaseDirectory;
while (!folder.EndsWith("Marten.Testing"))
{
folder = folder.ParentDirectory();
}
folder = folder.AppendPath("CodeTracker");
var files = fileSystem.FindFiles(folder, FileSet.Shallow("*.json"));
AllProjects = new Dictionary<Guid, GithubProject>();
foreach (var file in files)
{
var project = GithubProject.LoadFrom(file);
AllProjects.Add(project.Id, project);
Console.WriteLine($"Loaded {project.OrganizationName}{project.ProjectName} from JSON");
}
_store.Advanced.Clean.DeleteAllDocuments();
PublishAllProjectEvents(_store);
}
示例3: Main
public static int Main(string[] args)
{
var fileSystem = new FileSystem();
string srcDirectory = AppDomain.CurrentDomain.BaseDirectory.ParentDirectory().ParentDirectory().ParentDirectory().ParentDirectory();
string buildDirectory = args.Any()
? args.Single()
: srcDirectory.ParentDirectory().ParentDirectory().AppendPath("buildsupport");
Console.WriteLine("Trying to copy to " + buildDirectory);
if (!fileSystem.DirectoryExists(buildDirectory))
{
throw new ApplicationException("Could not find the buildsupport directory");
}
var targetDirectory = buildDirectory.AppendPath("FubuDocs");
fileSystem.CreateDirectory(targetDirectory);
fileSystem.CleanDirectory(targetDirectory);
var fromDirectory = srcDirectory.AppendPath("FubuDocsRunner").AppendPath("bin").AppendPath("debug");
var files = FileSet.Deep("*.dll;*.pdb;*.exe");
fileSystem.FindFiles(fromDirectory, files).Each(file => {
Console.WriteLine("Copying {0} to {1}", file, targetDirectory);
fileSystem.Copy(file, targetDirectory, CopyBehavior.overwrite);
});
return 0;
}
示例4: SetUp
public void SetUp()
{
var system = new FileSystem();
system.FindFiles(".".ToFullPath(), new FileSet
{
Include = "*.asset.config;*.script.config"
}).ToList().Each(system.DeleteFile);
}
示例5: FindAssemblies
public IEnumerable<string> FindAssemblies(string applicationDirectory)
{
var assemblyNames = new FileSet { Include = "*.dll", DeepSearch = false };
var fileSystem = new FileSystem();
return FubuMvcPackageFacility
.GetPackageDirectories()
.SelectMany(dir => fileSystem.FindFiles(dir, assemblyNames));
}
示例6: ReadDirectory
public void ReadDirectory(string directory)
{
Console.WriteLine("Searching directory {0} for samples", directory);
var system = new FileSystem();
system.FindFiles(directory, new FileSet{
DeepSearch = true,
Include = "*.cs"
})
.Each(readFile);
}
示例7: not_part_of_the_by_type_dump
public void not_part_of_the_by_type_dump()
{
var fileSystem = new FileSystem();
fileSystem.CleanDirectory("sql");
theStore.Schema.WriteDDLByType("sql");
fileSystem.FindFiles("sql", FileSet.Shallow("*.sql"))
.Any(x => x.EndsWith("mt_streams.sql"))
.ShouldBeFalse();
}
开发者ID:danielmarbach,项目名称:marten,代码行数:13,代码来源:Bug_443_erroneously_creating_the_event_tables_when_unnecessary.cs
示例8: cleans_up_the_orphaned_nupkg_files
public void cleans_up_the_orphaned_nupkg_files()
{
RippleOperation
.For<SolutionInput>(new SolutionInput(), theSolution)
.Step<DownloadMissingNugets>()
.Step<ExplodeDownloadedNugets>()
.Step<FixReferences>()
.Execute();
var fileSystem = new FileSystem();
var files = fileSystem.FindFiles(theSolution.PackagesDirectory(), new FileSet {DeepSearch = false, Include = "*.nupkg"});
files.ShouldHaveCount(0);
}
示例9: icontainer_facility_is_registered_during_construction_for_later
public void icontainer_facility_is_registered_during_construction_for_later()
{
var system = new FileSystem();
system.FindFiles(".".ToFullPath(), new FileSet{
Include = "*.asset.config;*.script.config"
}).ToList().Each(system.DeleteFile);
var container = new Container();
FubuApplication.For(new FubuRegistry()).StructureMap(container).Bootstrap();
container.GetInstance<IContainerFacility>()
.ShouldBeOfType<StructureMapContainerFacility>()
.ShouldNotBeNull();
}
示例10: readSpecs
private IDictionary<string, EmbeddedSpec> readSpecs()
{
var dict = new Dictionary<string, EmbeddedSpec>();
var fileSystem = new FileSystem();
fileSystem.FindFiles(_settings.Root, FileSet.Deep("*.specs.json")).Each(file =>
{
var json = fileSystem.ReadStringFromFile(file);
var response = JsonSerialization.Deserialize<BatchRunResponse>(json);
var fixtures = new Dictionary<string, FixtureModel>();
response.fixtures.Each(x => fixtures.Add(x.key, x));
response.records.Each(rec => dict.Add(rec.specification.path, new EmbeddedSpec(fixtures, rec)));
});
return dict;
}
示例11: findByName
private ApplicationSettings findByName(FileSystem system)
{
var files = system.FindFiles(".".ToFullPath(), ApplicationSettings.FileSearch(Location));
if (!files.Any())
{
Console.WriteLine("Could not find any matching *.application.config files");
return null;
}
if (files.Count() == 1)
{
var location = files.Single();
Console.WriteLine("Using file " + location);
return ApplicationSettings.Read(location);
}
Console.WriteLine("Found multiple *.application.settings files");
files.Each(x => Console.WriteLine(" - " + x));
return null;
}
示例12: regenerate_the_templates
public void regenerate_the_templates()
{
var applicationPath =
AppDomain.CurrentDomain.BaseDirectory
.ParentDirectory().ParentDirectory()
.AppendPath("FubuApp").ToFullPath();
var templatePath = applicationPath.AppendPath("_templates");
var files = new FileSystem();
files.CleanDirectory(templatePath);
var request = new ApplicationRequest
{
TemplatesFlag = true,
DirectoryFlag = applicationPath
};
new RunCommand().Execute(request).ShouldBeTrue();
files.FindFiles(templatePath, FileSet.Deep("*.htm")).Select(x => x.PathRelativeTo(applicationPath).Replace('\\', '/'))
.OrderBy(x => x)
.ShouldHaveTheSameElementsAs("_templates/en-US/Blue.htm", "_templates/en-US/Green.htm", "_templates/en-US/Red.htm");
}
示例13: readProjects
private static void readProjects(string directory, FileSystem system, Solution solution)
{
system.FindFiles(directory, new FileSet(){
Include = "packages.config"
}).Each(file =>
{
var project = Project.ReadFrom(file);
solution._projects.Add(project);
});
}
示例14: readNugetSpecs
private static void readNugetSpecs(string directory, SolutionConfig config, FileSystem system, Solution solution)
{
system.FindFiles(directory.AppendPath(config.NugetSpecFolder), new FileSet(){
Include = "*.nuspec"
})
.Each(file =>
{
var spec = NugetSpec.ReadFrom(file);
solution.AddNugetSpec(spec);
});
}
示例15: readProjects
private static void readProjects(string directory, FileSystem system, Solution solution)
{
var csProjSet = new FileSet(){
Include = "*.csproj"
};
system.FindFiles(directory, csProjSet).Each(file =>
{
var project = Project.ReadFrom(file);
solution.AddProject(project);
});
}