void CopyFile(FileInfoEx item, DirectoryInfoEx destDir) { FileSystemInfoEx lookupItem = destDir[item.Name]; if (lookupItem is FileInfoEx) { if (item.Length == (lookupItem as FileInfoEx).Length) { string srcCRC = Helper.GetFileCRC(item.FullName); string destCRC = Helper.GetFileCRC(lookupItem.FullName); if (srcCRC == destCRC && item.Length == (lookupItem as FileInfoEx).Length) { return; //Same file, no copy needed. } } } OverwriteMode overwrite = OverwriteMode.Replace; if (lookupItem != null) { overwrite = AskOverwrite(item, lookupItem); } switch (overwrite) { case OverwriteMode.Replace: if (lookupItem != null) { lookupItem.Delete(); } FileCancelDelegate cancel = delegate { return(Aborted); }; IOTools.CopyFile(item.FullName, PathEx.Combine(destDir.FullName, item.Name), cancel); break; } }
public void CreateDirectoryTest() { // IOTools.CreatePath(@"D:\test\test1\test0\file.txt"); IOTools.CopyFile(@"D:\temp\file.txt\1.txt", @"D:\test\test1\test0\file.txt"); //Assert.Fail(); }