Esempio n. 1
0
 public void Dispose()
 {
     VHDUtilities.DismountVirtualDisk(VirtualDiskPath);
     if (delete)
     {
         File.Delete(VirtualDiskPath);
     }
 }
Esempio n. 2
0
 public VirtualDiskSession(long sizeInGB = 20, bool delete = true, string existingVHD = null)
 {
     this.delete = delete;
     if (string.IsNullOrEmpty(existingVHD))
     {
         VirtualDiskPath = VHDUtilities.CreateVirtualDisk(sizeInGB);
     }
     else
     {
         VirtualDiskPath = existingVHD;
     }
     DiskId = VHDUtilities.MountVirtualDisk(VirtualDiskPath);
     VHDUtilities.AttachDriveLetterToDiskAndPartitionId(DiskId, 1, DriveLetter);
 }