public CdConfigDialog(VirtualCdDrive drive, Window parent) : base(Catalog.GetString ("Configure CD-ROM Drive"), parent, DialogFlags.NoSeparator, Stock.Cancel, ResponseType.Cancel, Stock.Ok, ResponseType.Ok) { this.drive = drive; IconThemeUtils.SetWindowIcon (this); Glade.XML xml = new Glade.XML ("vmx-manager.glade", "cdConfigContent"); xml.Autoconnect (this); busTypeCombo.Changed += delegate { PopulateDeviceNumberCombo (); }; VBox.Add (cdConfigContent); cdConfigContent.ShowAll (); combo = new CdDriveCombo (); cdComboContent.Add (combo); combo.Show (); FileFilter filter = new FileFilter (); filter.Name = Catalog.GetString (Catalog.GetString ("CD Images")); filter.AddPattern ("*.iso"); isoChooserButton.AddFilter (filter); physicalDriveRadio.Toggled += delegate { SetSensitivity (); }; Response += delegate (object o, ResponseArgs args) { if (args.ResponseId == ResponseType.Ok) { Save (); } this.Destroy (); }; Load (); SetSensitivity (); }
private void LoadDisks(DiskBusType busType) { for (ushort i = 0; i < 2; i++) { for (ushort j = 0; j < 6; j++) { string basekey = String.Format ("{0}{1}:{2}.", busType == DiskBusType.Ide ? "ide" : "scsi", i, j); if (this[basekey + "present"] != null && this[basekey + "present"] == "TRUE") { string diskFile = this[basekey + "fileName"]; if (diskFile != null && diskFile != "auto detect" && !Path.IsPathRooted (diskFile)) { diskFile = Path.Combine (Path.GetDirectoryName (file), diskFile); } ScsiDeviceType scsiType = OperatingSystem.SuggestedScsiDeviceType; if (this[basekey + "virtualDev"] != null) { scsiType = Utility.ParseScsiDeviceType (this[basekey + "virtualDev"]); } string devtype = this[basekey + "deviceType"]; if (devtype == null || devtype == "disk") { VirtualHardDisk disk = new VirtualHardDisk (diskFile, i, j, busType); disk.ScsiDeviceType = scsiType; hardDisks.Add (disk); } else { VirtualCdDrive drive = new VirtualCdDrive (diskFile, i, j, busType, Utility.ParseCdDeviceType (devtype)); drive.ScsiDeviceType = scsiType; cds.Add (drive); } } } } }
public void RemoveCdDrive(VirtualCdDrive drive) { if (cds.Contains (drive)) { cds.Remove (drive); RemoveDiskValues (drive); VirtualCdDriveHandler handler = CdDriveRemoved; if (handler != null) { handler (this, new VirtualCdDriveArgs (drive)); } } }
public void AddCdDrive(VirtualCdDrive drive) { cds.Add (drive); VirtualCdDriveHandler handler = CdDriveAdded; if (handler != null) { handler (this, new VirtualCdDriveArgs (drive)); } }
private void OnAddCdDrive(object o, EventArgs args) { VirtualCdDrive drive = new VirtualCdDrive ("/dev/hdc", 1, 0, DiskBusType.Ide, CdDeviceType.Raw); CdConfigDialog dialog = new CdConfigDialog (drive, this); dialog.Response += delegate (object b, ResponseArgs rargs) { if (rargs.ResponseId == ResponseType.Ok) { machine.AddCdDrive (drive); } }; dialog.Show (); }
public VirtualMachine CreateDefaultMachine(string baseName) { for (int i = 0;; i++) { string name; if (i == 0) { name = baseName; } else { name = String.Format (Catalog.GetString ("{0} #{1}"), baseName, i); } if (GetMachine (name) == null && GetMachineByFileName (name) == null) { VirtualMachine machine = CreateMachine (name); // add one network interface VirtualEthernet ethernet = new VirtualEthernet (Utility.GetDefaultNetworkType (), null, machine.OperatingSystem.SuggestedEthernetDeviceType); machine.AddEthernetDevice (ethernet); // add a default 6gb disk VirtualHardDisk disk = new VirtualHardDisk (0, 0, DiskBusType.Ide, (long) 6 * 1024 * 1024 * 1024); disk.HardDiskType = HardDiskType.SplitSparse; machine.AddHardDisk (disk); // add virtual cd devices for each physical one (up to two) ushort numdevs = 0; foreach (string dev in Utility.FindCdDrives ()) { if (numdevs > 1) break; VirtualCdDrive drive = new VirtualCdDrive (dev, 1, numdevs++, DiskBusType.Ide, CdDeviceType.Raw); machine.AddCdDrive (drive); } return machine; } } }
public VirtualCdDriveArgs(VirtualCdDrive drive) { this.drive = drive; }