[ros-diffs] [gedmurphy] 27316: only allow the user to select qemu harddisks which are not already being used

gedmurphy at svn.reactos.org gedmurphy at svn.reactos.org
Thu Jun 28 22:10:56 CEST 2007


Author: gedmurphy
Date: Fri Jun 29 00:10:56 2007
New Revision: 27316

URL: http://svn.reactos.org/svn/reactos?rev=27316&view=rev
Log:
only allow the user to select qemu harddisks which are not already being used

Modified:
    trunk/tools/RosTE/GUI/NewHardDiskForm.cs
    trunk/tools/RosTE/GUI/SettingsForm.cs

Modified: trunk/tools/RosTE/GUI/NewHardDiskForm.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosTE/GUI/NewHardDiskForm.cs?rev=27316&r1=27315&r2=27316&view=diff
==============================================================================
--- trunk/tools/RosTE/GUI/NewHardDiskForm.cs (original)
+++ trunk/tools/RosTE/GUI/NewHardDiskForm.cs Fri Jun 29 00:10:56 2007
@@ -1,10 +1,7 @@
 using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
 using System.Text;
 using System.Windows.Forms;
+using System.Collections;
 
 namespace RosTEGUI
 {
@@ -35,9 +32,29 @@
             get { return newhdBoot.Checked; }
         }
 
-        public NewHardDiskForm()
+        public NewHardDiskForm(ArrayList curDrives)
         {
             InitializeComponent();
+
+            string[] allDrives = { "hda", "hdb", "hdd" };
+
+            foreach (string str in allDrives)
+            {
+                bool found = false;
+
+                foreach (string drive in curDrives)
+                {
+                    if (string.Compare(drive, str, true) == 0)
+                    {
+                        found = true;
+                    }
+                }
+                if (!found)
+                    newhdDrive.Items.Add(str);
+            }
+
+            if (newhdDrive.Items.Count > 0)
+                newhdDrive.SelectedIndex = 0;
         }
     }
 }

Modified: trunk/tools/RosTE/GUI/SettingsForm.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosTE/GUI/SettingsForm.cs?rev=27316&r1=27315&r2=27316&view=diff
==============================================================================
--- trunk/tools/RosTE/GUI/SettingsForm.cs (original)
+++ trunk/tools/RosTE/GUI/SettingsForm.cs Fri Jun 29 00:10:56 2007
@@ -321,7 +321,15 @@
         {
             if (harddiskLstBox.Items.Count < 3)
             {
-                NewHardDiskForm hdf = new NewHardDiskForm();
+                ArrayList curDrives = new ArrayList(3);
+                ArrayList hardDisks = VirtMach.GetHardDisks();
+                
+                foreach (VMHardDrive vmhd in hardDisks)
+                {
+                    curDrives.Add(vmhd.Drive);
+                }
+
+                NewHardDiskForm hdf = new NewHardDiskForm(curDrives);
                 if (hdf.ShowDialog() == DialogResult.OK)
                 {
                     VMHardDrive vmhd = VirtMach.AddHardDisk(hdf.DiskName,




More information about the Ros-diffs mailing list