public static void DeserializeDiff(object target, IVirtualFile file) { MemoryStream ms = new MemoryStream(file.GetBinary()); XmlDocument doc = new XmlDocument(); doc.Load(ms); ObjectDiff.LoadDiff(target, doc.DocumentElement); }
public static void CopyFileTo(this IVirtualFile srcfile, IVirtualFile dstfile, CopyFileMode mode) { if (srcfile.DiskPath != null && dstfile.DiskPath != null && IOTool.FileIsLink(srcfile.DiskPath)) { IOTool.CopyFile(srcfile.DiskPath, dstfile.DiskPath, mode); return; } if (srcfile.DataDiskPath != null && dstfile.DataDiskPath != null) { IOTool.CopyFile(srcfile.DataDiskPath, dstfile.DataDiskPath, mode); return; } string text = null; byte[] data = null; try { text = srcfile.GetText(); } catch (Exception) { data = srcfile.GetBinary(); } if (text != null) { dstfile.SaveText(text); } else { dstfile.SaveBinary(data); } if (mode == CopyFileMode.Move) { srcfile.Remove(); } }