本文整理汇总了C#中System.IO.FileSystem.FindFiles方法的典型用法代码示例。如果您正苦于以下问题:C# FileSystem.FindFiles方法的具体用法?C# FileSystem.FindFiles怎么用?C# FileSystem.FindFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.FileSystem
的用法示例。
在下文中一共展示了FileSystem.FindFiles方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: copy_directory
public void copy_directory()
{
var system = new FileSystem();
system.ResetDirectory("dagobah");
system.WriteStringToFile("dagobah".AppendPath("f1", "a.txt"), "something");
system.WriteStringToFile("dagobah".AppendPath("f2", "a.txt"), "something");
system.WriteStringToFile("dagobah".AppendPath("f3", "a.txt"), "something");
system.WriteStringToFile("dagobah".AppendPath("f1", "f1a", "a.txt"), "something");
system.WriteStringToFile("dagobah".AppendPath("f1", "f1a", "f1b", "a.txt"), "something");
system.WriteStringToFile("dagobah".AppendPath("a.txt"), "something");
system.DeleteDirectory("rhenvar");
system.Copy("dagobah", "rhenvar");
system.FindFiles("rhenvar", FileSet.Everything()).Select(x => x.PathRelativeTo("rhenvar")).OrderBy(x => x)
.ShouldHaveTheSameElementsAs(
"a.txt",
FileSystem.Combine("f1", "a.txt"),
FileSystem.Combine("f1", "f1a", "a.txt"),
FileSystem.Combine("f1", "f1a", "f1b", "a.txt"),
FileSystem.Combine("f2", "a.txt"),
FileSystem.Combine("f3", "a.txt")
);
}
示例2: ReadTemplates
/// <summary>
/// Read [name].table and [name].function files from the named directory
/// to serve as templates for extra DDL (GRANT's probably)
/// </summary>
/// <param name="directory"></param>
public void ReadTemplates(string directory)
{
var system = new FileSystem();
system.FindFiles(directory, FileSet.Shallow("*.function")).Each(file =>
{
var name = Path.GetFileNameWithoutExtension(file).ToLower();
Templates[name].FunctionCreation = system.ReadStringFromFile(file);
});
system.FindFiles(directory, FileSet.Shallow("*.table")).Each(file =>
{
var name = Path.GetFileNameWithoutExtension(file).ToLower();
Templates[name].TableCreation = system.ReadStringFromFile(file);
});
}
示例3: CleanTarget
public void CleanTarget(string directory)
{
var fileSystem = new FileSystem();
foreach (var child in Directory.GetDirectories(directory))
{
if (child.Contains(".git")) continue;
fileSystem.DeleteDirectory(child);
}
fileSystem.FindFiles(directory, FileSet.Shallow("*.htm"))
.Each(fileSystem.DeleteFile);
}
示例4: LoadProjections
public void LoadProjections(string directory)
{
var files = new FileSystem();
using (var connection = new ManagedConnection(_connectionFactory))
{
files.FindFiles(directory, FileSet.Deep("*.js")).Each(file =>
{
var body = files.ReadStringFromFile(file);
var name = Path.GetFileNameWithoutExtension(file);
connection.Execute(cmd =>
{
cmd.CallsSproc(qualifyName("mt_load_projection_body"))
.With("proj_name", name)
.With("body", body)
.ExecuteNonQuery();
});
});
}
}
示例5: ReadFrom
public static Recipe ReadFrom(string recipeDirectory)
{
var recipeName = Path.GetFileName(recipeDirectory);
var recipe = new Recipe(recipeName);
var fileSystem = new FileSystem();
fileSystem.ReadTextFile(recipeDirectory.AppendPath(Milkman.ProfileFiles.RecipesControlFile), s =>
{
//TODO: Harden this for bad syntax
var parts = s.Split(':');
recipe.RegisterDependency(parts[1]);
});
fileSystem.FindFiles(recipeDirectory, new FileSet(){
Include = "*.host"
}).Each(file =>
{
var host = HostReader.ReadFrom(file);
recipe.RegisterHost(host);
});
return recipe;
}
示例6: write_ddl_by_type_with_events
public void write_ddl_by_type_with_events()
{
using (var store = DocumentStore.For(_ =>
{
_.RegisterDocumentType<User>();
_.RegisterDocumentType<Company>();
_.RegisterDocumentType<Issue>();
_.Events.AddAggregateType<Quest>();
_.Connection(ConnectionSource.ConnectionString);
}))
{
store.Schema.Events.IsActive.ShouldBeTrue();
store.Schema.WriteDDLByType("allsql");
}
var fileSystem = new FileSystem();
fileSystem.FindFiles("allsql", FileSet.Shallow("*mt_streams.sql"))
.Any().ShouldBeTrue();
}
示例7: write_ddl_by_type_with_events
public void write_ddl_by_type_with_events()
{
using (var store = DocumentStore.For(_ =>
{
_.RegisterDocumentType<User>();
_.RegisterDocumentType<Company>();
_.RegisterDocumentType<Issue>();
_.Events.AddEventType(typeof(MembersJoined));
_.Connection(ConnectionSource.ConnectionString);
}))
{
store.Schema.Events.IsActive.ShouldBeTrue();
store.Schema.WriteDDLByType(@"bin\allsql");
}
var fileSystem = new FileSystem();
fileSystem.FindFiles(@"bin\allsql", FileSet.Shallow("eventstore.sql"))
.Any().ShouldBeTrue();
}
示例8: can_write_ddl_by_type_with_no_database_connection
public void can_write_ddl_by_type_with_no_database_connection()
{
using (var store = DocumentStore.For(_ =>
{
_.RegisterDocumentType<User>();
_.RegisterDocumentType<Company>();
_.RegisterDocumentType<Issue>();
_.AutoCreateSchemaObjects = AutoCreate.None;
_.Connection("");
}))
{
store.Schema.Events.IsActive.ShouldBeFalse();
store.Schema.WriteDDLByType(@"bin\allsql");
}
var fileSystem = new FileSystem();
fileSystem.FindFiles(@"bin\allsql", FileSet.Shallow("*mt_streams.sql"))
.Any().ShouldBeFalse();
}
示例9: can_write_patch_by_type_smoke_test
public void can_write_patch_by_type_smoke_test()
{
using (var store = DocumentStore.For(_ =>
{
_.RegisterDocumentType<User>();
_.RegisterDocumentType<Company>();
_.RegisterDocumentType<Issue>();
_.Connection(ConnectionSource.ConnectionString);
}))
{
store.Advanced.Clean.CompletelyRemoveAll();
store.Schema.WritePatchByType(@"bin\allsql2");
}
var fileSystem = new FileSystem();
var files = fileSystem.FindFiles(@"bin\allsql2", FileSet.Shallow("*.sql")).ToArray();
files.ShouldNotContain("database_schemas.sql");
files.Select(Path.GetFileName).Where(x => x != "all.sql").OrderBy(x => x)
.ShouldHaveTheSameElementsAs("company.sql", "issue.sql", "mt_hilo.sql", "patch_doc.sql", "user.sql");
}
示例10: readRippleDependencies
private static IEnumerable<ProjectDependency> readRippleDependencies(string directory)
{
var fileSystem = new FileSystem();
var projectFiles = fileSystem.FindFiles(directory, FileSet.Deep("*.csproj"));
return projectFiles.SelectMany(file =>
{
var projectName = Path.GetFileNameWithoutExtension(file);
IList<string> names = null;
fileSystem.AlterFlatFile(file.ParentDirectory().AppendPath(RippleDependenciesConfig), list => names = list.Where(x => x.IsNotEmpty()).ToList());
return names.Select(x => new ProjectDependency {Nuget = x, Project = projectName});
});
}
示例11: findRippleFiles
private static IEnumerable<string> findRippleFiles(string directory)
{
var fileSystem = new FileSystem();
var list = fileSystem.FindFiles(directory, FileSet.Deep("ripple.dependencies.config")).ToList();
var rippleMain = directory.AppendPath("ripple.config");
list.Add(rippleMain);
return list;
}
示例12: FindFiles
public IEnumerable<string> FindFiles(FileSet files)
{
var system = new FileSystem();
return _directories.SelectMany(dir => system.FindFiles(dir, files));
}
示例13: fixing_bug_343_double_export_of_events
public void fixing_bug_343_double_export_of_events()
{
using (var store = DocumentStore.For(_ =>
{
_.RegisterDocumentType<User>();
_.RegisterDocumentType<Company>();
_.RegisterDocumentType<Issue>();
_.Events.AddEventType(typeof(MembersJoined));
_.Connection(ConnectionSource.ConnectionString);
}))
{
store.Schema.Events.IsActive.ShouldBeTrue();
store.Schema.WriteDDLByType(_binAllsql);
}
var fileSystem = new FileSystem();
fileSystem.FindFiles(_binAllsql, FileSet.Shallow(".sql"))
.Any().ShouldBeFalse();
}