Example #1
0
 internal Disk(VirtualMachine vm, string id, string displayname, string location, long capacity)
 {
     _vm = vm;
     _id = id;
     _displayName = displayname;
     _location = location;
     _capacity = capacity;
 }
Example #2
0
        public override VirtualDisk OpenDisk(FileLocator locator, string path, string extraInfo, Dictionary<string, string> parameters, FileAccess access)
        {
            VirtualMachine machine = new VirtualMachine(locator.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read), Ownership.Dispose);

            int diskIndex;
            if (!int.TryParse(extraInfo, out diskIndex))
            {
                diskIndex = 0;
            }

            int i = 0;
            foreach (var disk in machine.Disks)
            {
                if (i == diskIndex)
                {
                    return disk;
                }

                ++i;
            }

            return null;
        }