本文整理匯總了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");
}