本文整理汇总了C#中System.IO.FileSystem.Copy方法的典型用法代码示例。如果您正苦于以下问题:C# FileSystem.Copy方法的具体用法?C# FileSystem.Copy怎么用?C# FileSystem.Copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.FileSystem
的用法示例。
在下文中一共展示了FileSystem.Copy方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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")
);
}
示例2: SetUp
public void SetUp()
{
fileSystem = new FileSystem();
fileSystem.Copy("FubuMVC.SlickGrid.Docs.csproj.fake", "FubuMVC.SlickGrid.Docs.csproj");
fileSystem.Copy("SlickGridHarness.csproj.fake", "SlickGridHarness.csproj");
fileSystem.Copy("SlickGridHarness.csproj.fake", "SlickGridHarness/SlickGridHarness.csproj");
fileSystem.DeleteDirectory("myproj");
fileSystem.CreateDirectory("myproj");
}
示例3: 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");
}
示例4: ResetBottleProjectCode
public static void ResetBottleProjectCode()
{
var system = new FileSystem();
CleanStagingDirectory();
system.Copy(SourceDirectory, StagingDirectory);
system.CreateDirectory(ZipsDirectory);
system.CleanDirectory(ZipsDirectory);
}
示例5: SetUp
public void SetUp()
{
var fileSystem = new FileSystem();
fileSystem.DeleteDirectory("myfoo");
fileSystem.CreateDirectory("myfoo");
fileSystem.Copy("SlickGridHarness.csproj.fake", "SlickGridHarness.csproj");
}
示例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");
}