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


C# FileSystem.ReadStringFromFile方法代码示例

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


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

示例1: before_all

        public void before_all()
        {
            // setup
            _command = new NewCommand();
            _fileSystem = new FileSystem();
            _zipService = new ZipFileService(_fileSystem);
            _commandInput = new NewCommandInput();

            tmpDir = FileSystem.Combine("Templating", Guid.NewGuid().ToString());
            repoZip = FileSystem.Combine("Templating", "repo.zip");
            _zipService.ExtractTo(repoZip, tmpDir, ExplodeOptions.DeleteDestination);

            solutionFile = FileSystem.Combine("Templating", "sample", "myproject.txt");
            oldContents = _fileSystem.ReadStringFromFile(solutionFile);
            solutionDir = _fileSystem.GetDirectory(solutionFile);

            _commandInput.GitFlag = "file:///{0}".ToFormat(_fileSystem.GetFullPath(tmpDir).Replace("\\", "/"));
            _commandInput.ProjectName = "MyProject";
            _commandInput.SolutionFlag = solutionFile;
            _commandInput.OutputFlag = solutionDir;
            _commandInput.RakeFlag = "init.rb";

            _commandResult = _command.Execute(_commandInput);

            newSolutionContents = _fileSystem.ReadStringFromFile(solutionFile);
        }
开发者ID:wbinford,项目名称:fubu,代码行数:26,代码来源:NewCommandEndToEndTester.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: 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

示例4: copy_with_preserve

        public void copy_with_preserve()
        {
            var system = new FileSystem();
            system.WriteStringToFile("a.txt", "something");
            system.WriteStringToFile("b.txt", "else");
            system.Copy("a.txt", "b.txt", CopyBehavior.preserve);

            system.ReadStringFromFile("b.txt").ShouldEqual("else");
        }
开发者ID:bobpace,项目名称:fubucore,代码行数:9,代码来源:FileSystemTester.cs

示例5: WriteAndReadText

        public void WriteAndReadText()
        {
            string theString = Guid.NewGuid().ToString();

            var system = new FileSystem();
            system.WriteStringToFile(theString, "test.txt");

            Assert.AreEqual(theString, system.ReadStringFromFile("test.txt"));
        }
开发者ID:adymitruk,项目名称:storyteller,代码行数:9,代码来源:FileSystemTester.cs

示例6: copy_with_overwrite

        public void copy_with_overwrite()
        {
            var system = new FileSystem();
            system.WriteStringToFile("a.txt", "something");
            system.WriteStringToFile("b.txt", "else");
            system.Copy("a.txt", "b.txt", CopyBehavior.overwrite);

            system.ReadStringFromFile("b.txt").ShouldBe("something");
        }
开发者ID:JasperFx,项目名称:baseline,代码行数:9,代码来源:FileSystemTester.cs


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