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


C# FileSystem.FindFiles方法代码示例

本文整理汇总了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")
                );
        }
开发者ID:bobpace,项目名称:fubucore,代码行数:25,代码来源:FileSystemTester.cs

示例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);
            });
        }
开发者ID:phillip-haydon,项目名称:marten,代码行数:23,代码来源:DdlRules.cs

示例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);
        }
开发者ID:storyteller,项目名称:Storyteller,代码行数:14,代码来源:Exporter.cs

示例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();

                    });
                });
            }
        }
开发者ID:nieve,项目名称:marten,代码行数:22,代码来源:EventStoreAdmin.cs

示例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;
        }
开发者ID:mtscout6,项目名称:bottles,代码行数:23,代码来源:RecipeReader.cs

示例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();
        }
开发者ID:nieve,项目名称:marten,代码行数:21,代码来源:DocumentSchemaOnOtherSchemaTests.cs

示例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();
        }
开发者ID:phillip-haydon,项目名称:marten,代码行数:21,代码来源:DocumentSchemaTests.cs

示例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();
        }
开发者ID:phillip-haydon,项目名称:marten,代码行数:21,代码来源:DocumentSchemaTests.cs

示例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");


        }
开发者ID:phillip-haydon,项目名称:marten,代码行数:27,代码来源:DocumentSchemaTests.cs

示例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});
            });
        }
开发者ID:jeremydmiller,项目名称:Ripple2Paket,代码行数:14,代码来源:Program.cs

示例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;
        }
开发者ID:jeremydmiller,项目名称:Ripple2Paket,代码行数:10,代码来源:Program.cs

示例12: FindFiles

 public IEnumerable<string> FindFiles(FileSet files)
 {
     var system = new FileSystem();
     return _directories.SelectMany(dir => system.FindFiles(dir, files));
 }
开发者ID:henninga,项目名称:fubumvc,代码行数:5,代码来源:PackageFilesCache.cs

示例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();
        }
开发者ID:JasperFx,项目名称:marten,代码行数:21,代码来源:DocumentSchemaOnOtherSchemaTests.cs


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