當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。