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


C# FileSystem.WriteStringToFile方法代码示例

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


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

示例1: can_read_and_write_the_packages_config

		public void can_read_and_write_the_packages_config()
		{
			var theFileSystem = new FileSystem();

			theFileSystem.WriteStringToFile(NuGetDependencyStrategy.PackagesConfig, "<?xml version=\"1.0\" encoding=\"utf-8\"?><packages></packages>");
			
			var theSolution = new Solution();
			theSolution.AddDependency(new Dependency("Bottles", "1.0.1.1"));
			theSolution.AddDependency(new Dependency("FubuCore", "1.2.0.1"));

			var theProject = new Project("Test.csproj");
			theProject.AddDependency("Bottles");
			theProject.AddDependency("FubuCore");

			theSolution.AddProject(theProject);

			var theStrategy = new NuGetDependencyStrategy();
			theStrategy.Write(theProject);

			theStrategy
				.Read(theProject)
				.ShouldHaveTheSameElementsAs(
					new Dependency("Bottles", "1.0.1.1"),
					new Dependency("FubuCore", "1.2.0.1")
				);

			theFileSystem.DeleteFile(NuGetDependencyStrategy.PackagesConfig);
		}
开发者ID:modulexcite,项目名称:ripple,代码行数:28,代码来源:NugetDependencyStrategyTester.cs

示例2: 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);
            }

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

示例3: generate_visualizers

        public void generate_visualizers()
        {
            var path = @"C:\code\diagnostics\src\FubuMVC.Diagnostics\Visualization\Visualizers\ConfigurationActions";

            var types = typeof (FubuRequest).Assembly.GetExportedTypes()
                .Where(x => x.IsConcreteTypeOf<IConfigurationAction>());

            var fileSystem = new FileSystem();

            types.Each(x =>
            {
                var writer = new StringWriter();
                /*
            <use master="" />
            <viewdata model="FubuMVC.Diagnostics.Visualization.BehaviorNodeViewModel" />
                 */
                writer.WriteLine("<use master=\"\" />");
                writer.WriteLine("<viewdata model=\"{0}\" />", x.FullName);

                var file = path.AppendPath(x.Name + ".spark");

                fileSystem.WriteStringToFile(file, writer.ToString());

            });
        }
开发者ID:jbogard,项目名称:fubumvc,代码行数:25,代码来源:debugging.cs

示例4: ForSolution

        public static PersistenceExpression<Solution> ForSolution(Solution target)
        {
            var file = "{0}-{1}.config".ToFormat(typeof(Solution).Name, Guid.NewGuid());
            var fileSystem = new FileSystem();

            if (fileSystem.FileExists(file))
            {
                fileSystem.DeleteFile(file);
            }

            var writer = ObjectBlockWriter.Basic(new RippleBlockRegistry());
            var contents = writer.Write(target);
            Debug.WriteLine(contents);
            fileSystem.WriteStringToFile(file, contents);

            var reader = SolutionLoader.Reader();

            var specification = new PersistenceSpecification<Solution>(x =>
            {
                var fileContents = fileSystem.ReadStringFromFile(file);
                var readValue = Solution.Empty(); 
                reader.Read(readValue, fileContents);

                fileSystem.DeleteFile(file);

                return readValue;
            });

            specification.Original = target;

            return new PersistenceExpression<Solution>(specification);
        }
开发者ID:modulexcite,项目名称:ripple,代码行数:32,代码来源:CheckObjectBlockPersistence.cs

示例5: SetUp

        public void SetUp()
        {
            var system = new FileSystem();
            system.WriteStringToFile("a.txt", "something");
            system.WriteStringToFile("b.txt", "else");
            system.WriteStringToFile("c.txt", "altogether");

            theWatcher = new FileChangePollingWatcher();

            action1 = MockRepository.GenerateMock<System.Action>();
            action2 = MockRepository.GenerateMock<System.Action>();
            action3 = MockRepository.GenerateMock<System.Action>();

            theWatcher.WatchFile("a.txt", action1);
            theWatcher.WatchFile("b.txt", action2);
            theWatcher.WatchFile("c.txt", action3);
        }
开发者ID:gbrunton,项目名称:fubucore,代码行数:17,代码来源:FileChangePollingWatcherTester.cs

示例6: DownloadTo

		public INugetFile DownloadTo(Solution solution, string directory)
		{
			var files = new FileSystem();
			files.CreateDirectory(directory);

			var fileName = "{0}.{1}.nupkg".ToFormat(Name, Version);
			files.WriteStringToFile(fileName, "");

			return new StubNugetFile(new Dependency(Name, Version.ToString())) { FileName = fileName};
		}
开发者ID:modulexcite,项目名称:ripple,代码行数:10,代码来源:StubNuget.cs

示例7: Alter

        public void Alter(CsProjFile file, ProjectPlan plan)
        {
            var fileSystem = new FileSystem();
            var rawText = fileSystem.ReadStringFromFile(_source);

            var templatedText = plan.
                ApplySubstitutions(rawText, _relativePath);

            var expectedPath = file.ProjectDirectory.AppendPath(_relativePath);

            fileSystem.WriteStringToFile(expectedPath, templatedText);
        }
开发者ID:nosami,项目名称:FubuCsProjFile,代码行数:12,代码来源:CopyFileToProject.cs

示例8: ExplodeTo

	    public IPackage ExplodeTo(string directory)
		{
			var explodedDirectory = directory.AppendPath(Name).ToFullPath();
			RippleLog.Info("Exploding to " + explodedDirectory);

			var fileSystem = new FileSystem();
			fileSystem.CreateDirectory(explodedDirectory);
			fileSystem.CleanDirectory(explodedDirectory);

			fileSystem.DeleteFile(FileName);

			fileSystem.WriteStringToFile(explodedDirectory.AppendPath(FileName), "");
			
			return new StubPackage(Name, Version.ToString());
		}
开发者ID:modulexcite,项目名称:ripple,代码行数:15,代码来源:StubNugetFile.cs

示例9: Check

        public void Check(IPackageLog log)
        {
            var file = _folder.AppendPath(TracerFile);
            try
            {
                var system = new FileSystem();
                system.WriteStringToFile(file, "just a test of whether or not a process can write to a folder");
                system.DeleteFile(file);

                log.Trace(SuccessMessage.ToFormat(_folder));
            }
            catch (Exception)
            {
                log.MarkFailure(FailureMessage.ToFormat(_folder));
            }
        }
开发者ID:DarthFubuMVC,项目名称:bottles,代码行数:16,代码来源:CanWriteToFolder.cs

示例10: SetMode

 public void SetMode(string mode)
 {
     var fileSystem = new FileSystem();
     string file = filename();
     if (mode.IsEmpty())
     {
         fileSystem.DeleteFile(file);
     }
     else
     {
         fileSystem.WriteStringToFile(file, mode);
     }
 }
开发者ID:joemcbride,项目名称:fubumvc,代码行数:13,代码来源:FubuMode.cs

示例11: SetUp

        public void SetUp()
        {
            var context = TemplatePlan.CreateClean("assembly-info");
            context.Add(new CreateSolution("AssemblyInfoSolution"));

            var project = new ProjectPlan("MyProject");

            context.Add(project);

            var system = new FileSystem();
            system.CreateDirectory("assembly-info");
            system.CreateDirectory("assembly-info", "src");
            system.CreateDirectory("assembly-info", "src", "MyProject");
            system.CreateDirectory("assembly-info", "src", "MyProject", "Properties");

            var expectedPath = "assembly-info".AppendPath("src", "MyProject", "Properties", "AssemblyInfo.cs");
            system.WriteStringToFile(expectedPath, @"using System.Reflection;

            [assembly: AssemblyTitle('MyProject')]
            ".Replace("'", "\""));

            var alteration = new AssemblyInfoAlteration("using System.Reflection;", "[assembly: AssemblyTitle(\"%ASSEMBLYNAME%\")]", "using FubuMVC.Core;", "[assembly: FubuModule]");
            project.Add(alteration);

            context.Execute();

            theProject = CsProjFile.LoadFrom("assembly-info".AppendPath("src", "MyProject", "MyProject.csproj"));
            theContents =
                new FileSystem().ReadStringFromFile(expectedPath);
        }
开发者ID:awelburn,项目名称:FubuCsProjFile,代码行数:30,代码来源:AssemblyInfoAlterationTester.cs


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