/// <summary> /// Creates a new VHD differencing disk file. /// </summary> /// <param name="path">The path to the new disk file</param> /// <param name="parentPath">The path to the parent disk file</param> /// <returns>An object that accesses the new file as a Disk</returns> public static Disk InitializeDifferencing(string path, string parentPath) { LocalFileLocator parentLocator = new LocalFileLocator(Path.GetDirectoryName(parentPath)); string parentFileName = Path.GetFileName(parentPath); DiskImageFile newFile; using (DiskImageFile parent = new DiskImageFile(parentLocator, parentFileName, FileAccess.Read)) { LocalFileLocator locator = new LocalFileLocator(Path.GetDirectoryName(path)); newFile = parent.CreateDifferencing(locator, Path.GetFileName(path)); } return(new Disk(newFile, Ownership.Dispose, parentLocator, parentFileName)); }