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


C# FileSystem.DeleteFile方法代码示例

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


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

示例1: 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

示例2: TeardownEnvironment

        public void TeardownEnvironment()
        {
            _application.Teardown();

            var fileSystem = new FileSystem();
            fileSystem.DeleteFile("pak1.zip");
            fileSystem.DeleteFile("pak2.zip");
            fileSystem.DeleteFile("pak3.zip");
        }
开发者ID:pojes,项目名称:fubumvc,代码行数:9,代码来源:FubuSystem.cs

示例3: 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

示例4: Test_FileSystem_That_File_Delete_Removes_File

        public void Test_FileSystem_That_File_Delete_Removes_File()
        {
            var fileSystem = new FileSystem();
            var path = Path.Combine(TestContext.DeploymentDirectory, @"IO\1.txt");
            fileSystem.DeleteFile(path);
            Assert.IsFalse(fileSystem.FileExists(path));

            // cleanup
            using(fileSystem.OpenFile(path, FileMode.OpenOrCreate)) {; }
            Assert.IsTrue(fileSystem.FileExists(path));
        }
开发者ID:patrickhuber,项目名称:Cyrus,代码行数:11,代码来源:FileSystemTests.cs

示例5: 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

示例6: 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

示例7: Delete

        /// <summary>
        /// Remove an auto evaluation (takes results with it)
        /// </summary>
        public bool Delete(int evalID)
        {
            Evaluation eval = GetInfo(evalID);

            //take evaluation
            m_dp.DeleteEval(evalID);

            //Delete zone files
            if (eval.Type == Evaluation.AUTO_TYPE) {
                FileSystem fs = new FileSystem(m_ident);
                AutoEvaluation aeval = eval as AutoEvaluation;
                CFile zdir = fs.GetFile(aeval.ZoneID);
                if (null != zdir)
                    fs.DeleteFile(zdir);
            }

            return true;
        }
开发者ID:padilhalino,项目名称:FrontDesk,代码行数:21,代码来源:evaluations.cs

示例8: should_add_project_references

        public void should_add_project_references()
        {
            // build it up through a stringbuilder to use the environment-specific newline
            var solutionBuilder = new StringBuilder("Microsoft Visual Studio Solution File, Format Version 11.00")
                .AppendLine()
                .AppendLine("# Visual Studio 2010")
                .AppendLine(@"Project(""{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"") = ""FubuMVC.StructureMap"", ""FubuMVC.StructureMap\FubuMVC.StructureMap.csproj"", ""{ABFEA520-820C-4B77-9015-6A09E24252FA}""")
                .AppendLine("EndProject")
                .AppendLine("Global")
                .AppendLine("	GlobalSection(SolutionConfigurationPlatforms) = preSolution")
                .AppendLine("		Debug|Any CPU = Debug|Any CPU")
                .AppendLine("		Release|Any CPU = Release|Any CPU")
                .AppendLine("	EndGlobalSection")
                .AppendLine("	GlobalSection(SolutionProperties) = preSolution")
                .AppendLine("		HideSolutionNode = FALSE")
                .AppendLine("	EndGlobalSection")
                .AppendLine("EndGlobal");

            var system = new FileSystem();
            var solutionFile = "tmp.sln";
            system.AppendStringToFile(solutionFile, solutionBuilder.ToString());

            var project = new CsProj
                              {
                                  Name = "Test",
                                  ProjectGuid = "123",
                                  RelativePath = @"example1\example1.csproj"
                              };
            var service = new SolutionFileService(system);
            service.AddProject(solutionFile, project);

            var solutionContents = system.ReadStringFromFile(solutionFile);
            var lines = service.SplitSolution(solutionContents);

            lines[4].ShouldEqual("Project(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Test\", \"example1\\example1.csproj\", \"{123}\"");
            lines[5].ShouldEqual("EndProject");

            system.DeleteFile(solutionFile);
        }
开发者ID:mmoore99,项目名称:fubumvc,代码行数:39,代码来源:SolutionFileServiceTester.cs

示例9: GilesAssemblyFileOperation

        private static void GilesAssemblyFileOperation(string testAssemblyFolder, FileOperationType fileOperationType)
        {
            var fileSystem = new FileSystem();
            var filesToCopy = GetGilesAssembliesToUse();

            var gilesTargetAssemblyFolder = Path.Combine(testAssemblyFolder, @"Giles");
            if (!Directory.Exists(gilesTargetAssemblyFolder))
                Directory.CreateDirectory(gilesTargetAssemblyFolder);

            filesToCopy.Each(f =>
                                 {
                                     var sourcePath = f.Contains("\\") ? f : GetFileSourceLocation(f);
                                     var targetPath = Path.Combine(gilesTargetAssemblyFolder, fileSystem.GetFileName(f));

                                     if (fileOperationType == FileOperationType.Copy || fileOperationType == FileOperationType.Delete)
                                         if (fileSystem.FileExists(targetPath))
                                             fileSystem.DeleteFile(targetPath);

                                     if (fileOperationType == FileOperationType.Copy)
                                     {
                                         fileSystem.CopyFile(sourcePath, targetPath);
                                     }
                                 });
        }
开发者ID:Erkan-Yilmaz,项目名称:Giles,代码行数:24,代码来源:GilesAppDomainManager.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: Clear

        public static void Clear()
        {
            var fileSystem = new FileSystem();
            string file = filename();

            fileSystem.DeleteFile(file);
        }
开发者ID:joemcbride,项目名称:fubumvc,代码行数:7,代码来源:FubuMode.cs

示例12: TeardownEnvironment

        public override void TeardownEnvironment()
        {
            base.TeardownEnvironment();

            var fileSystem = new FileSystem();
            fileSystem.DeleteFile("pak1.zip");
            fileSystem.DeleteFile("pak2.zip");
            fileSystem.DeleteFile("pak3.zip");
            fileSystem.DeleteFile("pak4.zip");
            fileSystem.DeleteFile("spark.zip");
        }
开发者ID:jemacom,项目名称:fubumvc,代码行数:11,代码来源:FubuSystem.cs

示例13: SetUp

        public void SetUp()
        {
            theFileSystem = new FileSystem();

            theFileSystem.DeleteDirectory("fake-app");
            theFileSystem.CreateDirectory("fake-app");

            theFileSystem.FindFiles(".".ToFullPath(), ApplicationSettings.FileSearch())
                .Each(x => theFileSystem.DeleteFile(x));

            theOriginalSettings = ApplicationSettings.For<KayakApplication>();
            theOriginalSettings.ParentFolder = "fake-app".ToFullPath();
            theOriginalSettings.Write();

            aSpecificLocation = theOriginalSettings.GetFileName();
        }
开发者ID:wbinford,项目名称:fubu,代码行数:16,代码来源:KayakCommandTester.cs

示例14: DeleteFileDeletesFile

 public void DeleteFileDeletesFile()
 {
     var fileSystem = new FileSystem();
     var fileName = Path.GetTempFileName();
     try
     {
         File.WriteAllText(fileName, "Test");
         fileSystem.DeleteFile(fileName);
         Assert.IsFalse(File.Exists(fileName));
     }
     finally
     {
         CleanUpFile(fileName);
     }
 }
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:15,代码来源:FileSystemTests.cs

示例15: DeleteFileTest

 public void DeleteFileTest()
 {
     FileSystem target = new FileSystem();
     int fileId = 150;
     string userEmail ="[email protected]";
     string userPass = "pass2";
     target.DeleteFile(fileId, userEmail, userPass);
 }
开发者ID:tel8618217223380,项目名称:sinchosaur,代码行数:8,代码来源:FileSystemTest.cs


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