Author: gedmurphy
Date: Fri Feb 8 18:56:05 2008
New Revision: 32221
URL:
http://svn.reactos.org/svn/reactos?rev=32221&view=rev
Log:
Rewrite parts of the Virtual Machine class and start to use it to load and save VM's
Modified:
trunk/tools/RosTE/GUI/ConfigHandler.cs
trunk/tools/RosTE/GUI/MainForm.Designer.cs
trunk/tools/RosTE/GUI/MainForm.cs
trunk/tools/RosTE/GUI/MainForm.resx
trunk/tools/RosTE/GUI/NewVMWizard.cs
trunk/tools/RosTE/GUI/SettingsForm.cs
trunk/tools/RosTE/GUI/VirtualMachine.cs
Modified: trunk/tools/RosTE/GUI/ConfigHandler.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosTE/GUI/ConfigHandler.cs?r…
==============================================================================
--- trunk/tools/RosTE/GUI/ConfigHandler.cs (original)
+++ trunk/tools/RosTE/GUI/ConfigHandler.cs Fri Feb 8 18:56:05 2008
@@ -75,87 +75,6 @@
return null;
}
- private bool LoadVirtMachs()
- {
- bool bRet = false;
-
- if (dataSet != null)
- {
- if (virtMachs == null)
- {
- virtMachs = new List<MainVmInfo>();
- }
-
- try
- {
- foreach (DataRow dr in dataSet.Tables["VirtMach"].Rows)
- {
- virtMachs.Add(new MainVmInfo((int)dr["VMConfigID"],
(string)dr["Path"]));
- }
-
- bRet = true;
- }
- catch (Exception ex)
- {
- Debug.LogMessage("Failed loading virtual machines",
ex.Message, ex.StackTrace, true);
- }
- }
-
- return bRet;
- }
-
- private void SaveVirtMachs()
- {
- if (dataSet != null && virtMachs != null)
- {
- try
- {
- DataTable virtMachTable = dataSet.Tables["VirtMach"];
- virtMachTable.Clear();
-
- foreach (MainVmInfo vm in virtMachs)
- {
- DataRow dr = virtMachTable.NewRow();
- dr["VMConfigID"] = vm.id;
- dr["Path"] = vm.path;
-
- virtMachTable.Rows.Add(dr);
- }
- }
- catch (Exception ex)
- {
- Debug.LogMessage("Failed to save virtual machine table",
ex.Message, ex.StackTrace, true);
- }
- }
- }
-
- public int AddVirtMach(string pathIn)
- {
- if (dataSet != null && virtMachs != null)
- {
- int id = virtMachs.Count;
- virtMachs.Add(new MainVmInfo(id, pathIn));
- }
-
- return virtMachs.Count;
- }
-
- public bool DeleteVirtMach(int index)
- {
- bool bRet = false;
-
- foreach (MainVmInfo vm in virtMachs)
- {
- if (vm.id == index)
- {
- virtMachs.Remove(vm);
- bRet = true;
- }
- }
-
- return bRet;
- }
-
public int GetNumberOfVms()
{
return virtMachs.Count;
@@ -238,10 +157,12 @@
settingsRow["DefVmPath"] = defVmPath;
settingsRow["UpdateSched"] = updateSched;
settingsRow["AppDebug"] = appDebug;
- }
- catch (Exception ex)
- {
- Debug.LogMessage("Failed to read settings from mainConf
dataset", ex.Message);
+
+
+ }
+ catch (Exception ex)
+ {
+ Debug.LogMessage("Failed to write settings to mainConf
dataset", ex.Message);
}
}
}
@@ -290,26 +211,87 @@
return;
}
- SaveVirtMachs();
-
- try
- {
- FileStream fs = new FileStream(fileName, FileMode.Create,
FileAccess.Write);
- xtw = new XmlTextWriter(fs, System.Text.Encoding.Unicode);
- dataSet.WriteXml(xtw, System.Data.XmlWriteMode.WriteSchema);
- }
- catch (Exception ex)
- {
- Debug.LogMessage("Failed to save main config file", ex.Message,
ex.StackTrace, true);
- }
- finally
- {
- if (xtw != null)
- xtw.Close();
+ if (SaveVirtMachs())
+ {
+ try
+ {
+ FileStream fs = new FileStream(fileName, FileMode.Create,
FileAccess.Write);
+ xtw = new XmlTextWriter(fs, System.Text.Encoding.Unicode);
+ dataSet.WriteXml(xtw, System.Data.XmlWriteMode.WriteSchema);
+ }
+ catch (Exception ex)
+ {
+ Debug.LogMessage("Failed to save main config file",
ex.Message, ex.StackTrace, true);
+ }
+ finally
+ {
+ if (xtw != null)
+ xtw.Close();
+ }
}
}
#region private methods
+ private bool LoadVirtMachs()
+ {
+ bool bRet = false;
+
+ if (dataSet != null)
+ {
+ if (virtMachs == null)
+ {
+ virtMachs = new List<MainVmInfo>();
+ }
+
+ try
+ {
+ foreach (DataRow dr in dataSet.Tables["VirtMach"].Rows)
+ {
+ virtMachs.Add(new MainVmInfo((int)dr["VMConfigID"],
(string)dr["Path"]));
+ }
+
+ bRet = true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogMessage("Failed loading virtual machines",
ex.Message, ex.StackTrace, true);
+ }
+ }
+
+ return bRet;
+ }
+
+ private bool SaveVirtMachs()
+ {
+ bool bRet = false;
+
+ if (dataSet != null && virtMachs != null)
+ {
+ try
+ {
+ DataTable virtMachTable = dataSet.Tables["VirtMach"];
+ virtMachTable.Clear();
+
+ foreach (MainVmInfo vm in virtMachs)
+ {
+ DataRow dr = virtMachTable.NewRow();
+ dr["VMConfigID"] = vm.id;
+ dr["Path"] = vm.path;
+
+ virtMachTable.Rows.Add(dr);
+ }
+
+ bRet = true;
+ }
+ catch (Exception ex)
+ {
+ Debug.LogMessage("Failed to save virtual machine table",
ex.Message, ex.StackTrace, true);
+ }
+ }
+
+ return bRet;
+ }
+
private bool LoadMainSchema()
{
XmlTextReader xtr = null;
@@ -342,26 +324,6 @@
#endregion
}
-
- public struct VirtMachInfo
- {
- public int virtMachID;
- public string name;
- public string machType;
- public string defDir;
- public int memSize;
- public bool setClockToHost;
- public bool cdRomEnable;
- public bool cdRomUsePhys;
- public string cdRomPhysDrv;
- public bool cdRomUseIso;
- public string cdRomIsoImg;
- public bool floppyEnable;
- public bool floppyUsePhys;
- public string floppyPhysDrv;
- public bool floppyUseImg;
- public string floppyIsoImg;
- }
public class VirtMachConfig
{
@@ -406,6 +368,35 @@
vmi.floppyUseImg = (bool)vmRow["FloppyUseImg"];
vmi.floppyIsoImg = (string)vmRow["FloppyIsoImg"];
+ vmi.hardDrives = new List<HardDriveInfo>();
+ foreach (DataRow hdRow in
dataSet.Tables["HardDisks"].Rows)
+ {
+ HardDriveInfo hdi = new HardDriveInfo();
+ hdi.diskID = (int)hdRow["DiskID"];
+ hdi.name = (string)hdRow["Name"];
+ hdi.drive = (string)hdRow["Drive"];
+ hdi.path = (string)hdRow["Path"];
+ hdi.size = (int)hdRow["Size"];
+ hdi.bootImg = (bool)hdRow["BootImg"];
+
+ vmi.hardDrives.Add(hdi);
+ }
+
+ vmi.netCards = new List<NetCardInfo>();
+ foreach (DataRow hdRow in
dataSet.Tables["NetCards"].Rows)
+ {
+ NetCardInfo nci = new NetCardInfo();
+ nci.cardID = (int)hdRow["CardID"];
+ nci.virtMachID = (int)hdRow["VirtMachID"];
+ nci.option = (string)hdRow["Option"];
+ nci.vlan = (int)hdRow["Vlan"];
+ nci.macAddr = (string)hdRow["MacAddr"];
+ nci.model = (string)hdRow["Model"];
+ nci.hostname = (string)hdRow["HostName"];
+
+ vmi.netCards.Add(nci);
+ }
+
virtMachInfo.Add(vmi);
}
@@ -420,34 +411,62 @@
return bRet;
}
- public void SaveVmSettings()
+ public void SaveVmSettings(VirtMachInfo vmi)
{
if (dataSet != null)
{
- dataSet.Tables["VirtMach"].Rows.Clear();
-
- try
- {
- foreach (VirtMachInfo vmi in virtMachInfo)
- {
- DataRow vmRow = dataSet.Tables["VirtMach"].NewRow();
-
- vmRow["VirtMachID"] = vmi.virtMachID;
- vmRow["Name"] = vmi.name;
- vmRow["MachType"] = vmi.machType;
- vmRow["DefDir"] = vmi.defDir;
- vmRow["MemSize"] = vmi.memSize;
- vmRow["SetClockToHost"] = vmi.setClockToHost;
- vmRow["CdRomEnable"] = vmi.cdRomEnable;
- vmRow["CdRomUsePhys"] = vmi.cdRomUsePhys;
- vmRow["CdRomPhysDrv"] = vmi.cdRomPhysDrv;
- vmRow["CdRomUseIso"] = vmi.cdRomUseIso;
- vmRow["CdRomIsoImg"] = vmi.cdRomIsoImg;
- vmRow["FloppyEnable"] = vmi.floppyEnable;
- vmRow["FloppyUsePhys"] = vmi.floppyUsePhys;
- vmRow["FloppyPhysDrv"] = vmi.floppyPhysDrv;
- vmRow["FloppyUseImg"] = vmi.floppyUseImg;
- vmRow["FloppyIsoImg"] = vmi.floppyIsoImg;
+ try
+ {
+ dataSet.Tables["VMConfig"].Rows.Clear();
+
+ DataRow vmRow = dataSet.Tables["VMConfig"].NewRow();
+
+ vmRow["VirtMachID"] = vmi.virtMachID;
+ vmRow["Name"] = vmi.name;
+ vmRow["MachType"] = vmi.machType;
+ vmRow["DefDir"] = vmi.defDir;
+ vmRow["MemSize"] = vmi.memSize;
+ vmRow["SetClockToHost"] = vmi.setClockToHost;
+ vmRow["CdRomEnable"] = vmi.cdRomEnable;
+ vmRow["CdRomUsePhys"] = vmi.cdRomUsePhys;
+ vmRow["CdRomPhysDrv"] = vmi.cdRomPhysDrv;
+ vmRow["CdRomUseIso"] = vmi.cdRomUseIso;
+ vmRow["CdRomIsoImg"] = vmi.cdRomIsoImg;
+ vmRow["FloppyEnable"] = vmi.floppyEnable;
+ vmRow["FloppyUsePhys"] = vmi.floppyUsePhys;
+ vmRow["FloppyPhysDrv"] = vmi.floppyPhysDrv;
+ vmRow["FloppyUseImg"] = vmi.floppyUseImg;
+ vmRow["FloppyIsoImg"] = vmi.floppyIsoImg;
+
+ dataSet.Tables["VMConfig"].Rows.Add(vmRow);
+
+ foreach (HardDriveInfo hdi in vmi.hardDrives)
+ {
+ DataRow hdRow = dataSet.Tables["HardDisks"].NewRow();
+
+ hdRow["DiskID"] = hdi.diskID;
+ hdRow["Name"] = hdi.name;
+ hdRow["Drive"] = hdi.drive;
+ hdRow["Path"] = hdi.path;
+ hdRow["Size"] = hdi.size;
+ hdRow["BootImg"] = hdi.bootImg;
+
+ dataSet.Tables["HardDisks"].Rows.Add(hdRow);
+ }
+
+ foreach (NetCardInfo nci in vmi.netCards)
+ {
+ DataRow ncRow = dataSet.Tables["NetCards"].NewRow();
+
+ ncRow["CardID"] = nci.cardID;
+ ncRow["VirtMachID"] = nci.virtMachID;
+ ncRow["Option"] = nci.option;
+ ncRow["Vlan"] = nci.vlan;
+ ncRow["MacAddr"] = nci.macAddr;
+ ncRow["Model"] = nci.model;
+ ncRow["HostName"] = nci.hostname;
+
+ dataSet.Tables["NetCards"].Rows.Add(ncRow);
}
}
catch (Exception ex)
@@ -491,19 +510,21 @@
return ret;
}
- public void SaveVMConfig(string path)
+ public void SaveVMConfig(VirtualMachine vm)
{
XmlTextWriter xtw = null;
- string fileName = path + "\\Config.xml";
-
- if (!Directory.Exists(fileName))
- Directory.CreateDirectory(fileName);
+ string fileName = vm.VMInfo.defDir + "\\Config.xml";
+
+ if (!Directory.Exists(vm.VMInfo.defDir))
+ Directory.CreateDirectory(vm.VMInfo.defDir);
if (dataSet == null)
{
if (!LoadVirtMachSchema())
return;
}
+
+ SaveVmSettings(vm.VMInfo);
try
{
Modified: trunk/tools/RosTE/GUI/MainForm.Designer.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosTE/GUI/MainForm.Designer.…
==============================================================================
--- trunk/tools/RosTE/GUI/MainForm.Designer.cs (original)
+++ trunk/tools/RosTE/GUI/MainForm.Designer.cs Fri Feb 8 18:56:05 2008
@@ -39,32 +39,32 @@
this.toolbarSep2 = new System.Windows.Forms.ToolStripSeparator();
this.toolbarSep4 = new System.Windows.Forms.ToolStripSeparator();
this.mainToolbar = new System.Windows.Forms.ToolStrip();
+ this.toolbarLaunch = new System.Windows.Forms.ToolStripButton();
+ this.toolbarStop = new System.Windows.Forms.ToolStripButton();
+ this.toolbarImageAdd = new System.Windows.Forms.ToolStripButton();
+ this.toolbarImageDel = new System.Windows.Forms.ToolStripButton();
+ this.toolbarSnapShot = new System.Windows.Forms.ToolStripButton();
+ this.toolbarScreenShot = new System.Windows.Forms.ToolStripButton();
this.toolbarSep3 = new System.Windows.Forms.ToolStripSeparator();
+ this.toolbarHelpContents = new System.Windows.Forms.ToolStripButton();
+ this.toolbarExit = new System.Windows.Forms.ToolStripButton();
this.mainMenu = new System.Windows.Forms.MenuStrip();
this.mainmenuFile = new System.Windows.Forms.ToolStripMenuItem();
this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.virtualMachineToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.mainmenuFileExit = new System.Windows.Forms.ToolStripMenuItem();
this.mainmenuOptions = new System.Windows.Forms.ToolStripMenuItem();
- this.mainmenuHelp = new System.Windows.Forms.ToolStripMenuItem();
- this.mainmenuHelpContent = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
- this.MainMenuHelpAbout = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.settingsToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
- this.toolbarLaunch = new System.Windows.Forms.ToolStripButton();
- this.toolbarStop = new System.Windows.Forms.ToolStripButton();
- this.toolbarImageAdd = new System.Windows.Forms.ToolStripButton();
- this.toolbarImageDel = new System.Windows.Forms.ToolStripButton();
- this.toolbarSnapShot = new System.Windows.Forms.ToolStripButton();
- this.toolbarScreenShot = new System.Windows.Forms.ToolStripButton();
- this.toolbarHelpContents = new System.Windows.Forms.ToolStripButton();
- this.toolbarExit = new System.Windows.Forms.ToolStripButton();
this.snapshotToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.takeSnapshotToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.loadSnapshotToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.deleteSnapshotToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
+ this.mainmenuHelp = new System.Windows.Forms.ToolStripMenuItem();
+ this.mainmenuHelpContent = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
+ this.MainMenuHelpAbout = new System.Windows.Forms.ToolStripMenuItem();
this.mainToolbar.SuspendLayout();
this.mainMenu.SuspendLayout();
this.SuspendLayout();
@@ -162,10 +162,87 @@
this.mainToolbar.Size = new System.Drawing.Size(540, 25);
this.mainToolbar.TabIndex = 10;
//
+ // toolbarLaunch
+ //
+ this.toolbarLaunch.Image =
((System.Drawing.Image)(resources.GetObject("toolbarLaunch.Image")));
+ this.toolbarLaunch.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.toolbarLaunch.Name = "toolbarLaunch";
+ this.toolbarLaunch.Size = new System.Drawing.Size(66, 22);
+ this.toolbarLaunch.Text = "Launch";
+ this.toolbarLaunch.ToolTipText = "Starts the virtual machine";
+ //
+ // toolbarStop
+ //
+ this.toolbarStop.DisplayStyle =
System.Windows.Forms.ToolStripItemDisplayStyle.Image;
+ this.toolbarStop.Image =
((System.Drawing.Image)(resources.GetObject("toolbarStop.Image")));
+ this.toolbarStop.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.toolbarStop.Name = "toolbarStop";
+ this.toolbarStop.Size = new System.Drawing.Size(23, 22);
+ this.toolbarStop.ToolTipText = "Stops the virtual machine";
+ //
+ // toolbarImageAdd
+ //
+ this.toolbarImageAdd.DisplayStyle =
System.Windows.Forms.ToolStripItemDisplayStyle.Image;
+ this.toolbarImageAdd.Image =
((System.Drawing.Image)(resources.GetObject("toolbarImageAdd.Image")));
+ this.toolbarImageAdd.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.toolbarImageAdd.Name = "toolbarImageAdd";
+ this.toolbarImageAdd.Size = new System.Drawing.Size(23, 22);
+ this.toolbarImageAdd.ToolTipText = "Adds a new image";
+ this.toolbarImageAdd.Click += new
System.EventHandler(this.CreateNewVirtMach);
+ //
+ // toolbarImageDel
+ //
+ this.toolbarImageDel.DisplayStyle =
System.Windows.Forms.ToolStripItemDisplayStyle.Image;
+ this.toolbarImageDel.Image =
((System.Drawing.Image)(resources.GetObject("toolbarImageDel.Image")));
+ this.toolbarImageDel.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.toolbarImageDel.Name = "toolbarImageDel";
+ this.toolbarImageDel.Size = new System.Drawing.Size(23, 22);
+ this.toolbarImageDel.ToolTipText = "Deletes an existing image";
+ this.toolbarImageDel.Click += new System.EventHandler(this.DeleteVirtMach);
+ //
+ // toolbarSnapShot
+ //
+ this.toolbarSnapShot.DisplayStyle =
System.Windows.Forms.ToolStripItemDisplayStyle.Image;
+ this.toolbarSnapShot.Image =
((System.Drawing.Image)(resources.GetObject("toolbarSnapShot.Image")));
+ this.toolbarSnapShot.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.toolbarSnapShot.Name = "toolbarSnapShot";
+ this.toolbarSnapShot.Size = new System.Drawing.Size(23, 22);
+ this.toolbarSnapShot.Text = "toolStripButton1";
+ this.toolbarSnapShot.ToolTipText = "Create a snap shot of the current
status";
+ //
+ // toolbarScreenShot
+ //
+ this.toolbarScreenShot.DisplayStyle =
System.Windows.Forms.ToolStripItemDisplayStyle.Image;
+ this.toolbarScreenShot.Image =
((System.Drawing.Image)(resources.GetObject("toolbarScreenShot.Image")));
+ this.toolbarScreenShot.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.toolbarScreenShot.Name = "toolbarScreenShot";
+ this.toolbarScreenShot.Size = new System.Drawing.Size(23, 22);
+ this.toolbarScreenShot.Text = "toolStripButton2";
+ this.toolbarScreenShot.ToolTipText = "Grab a screenshot of the
display";
+ //
// toolbarSep3
//
this.toolbarSep3.Name = "toolbarSep3";
this.toolbarSep3.Size = new System.Drawing.Size(6, 25);
+ //
+ // toolbarHelpContents
+ //
+ this.toolbarHelpContents.DisplayStyle =
System.Windows.Forms.ToolStripItemDisplayStyle.Image;
+ this.toolbarHelpContents.Image =
((System.Drawing.Image)(resources.GetObject("toolbarHelpContents.Image")));
+ this.toolbarHelpContents.ImageTransparentColor =
System.Drawing.Color.Magenta;
+ this.toolbarHelpContents.Name = "toolbarHelpContents";
+ this.toolbarHelpContents.Size = new System.Drawing.Size(23, 22);
+ this.toolbarHelpContents.ToolTipText = "Opens help file";
+ //
+ // toolbarExit
+ //
+ this.toolbarExit.DisplayStyle =
System.Windows.Forms.ToolStripItemDisplayStyle.Image;
+ this.toolbarExit.Image =
((System.Drawing.Image)(resources.GetObject("toolbarExit.Image")));
+ this.toolbarExit.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.toolbarExit.Name = "toolbarExit";
+ this.toolbarExit.Size = new System.Drawing.Size(23, 22);
+ this.toolbarExit.ToolTipText = "Exits application";
+ this.toolbarExit.Click += new System.EventHandler(this.toolbarExit_Click);
//
// mainMenu
//
@@ -185,7 +262,7 @@
this.newToolStripMenuItem,
this.mainmenuFileExit});
this.mainmenuFile.Name = "mainmenuFile";
- this.mainmenuFile.Size = new System.Drawing.Size(35, 20);
+ this.mainmenuFile.Size = new System.Drawing.Size(37, 20);
this.mainmenuFile.Text = "File";
//
// newToolStripMenuItem
@@ -193,7 +270,7 @@
this.newToolStripMenuItem.DropDownItems.AddRange(new
System.Windows.Forms.ToolStripItem[] {
this.virtualMachineToolStripMenuItem});
this.newToolStripMenuItem.Name = "newToolStripMenuItem";
- this.newToolStripMenuItem.Size = new System.Drawing.Size(106, 22);
+ this.newToolStripMenuItem.Size = new System.Drawing.Size(98, 22);
this.newToolStripMenuItem.Text = "New";
//
// virtualMachineToolStripMenuItem
@@ -206,7 +283,7 @@
// mainmenuFileExit
//
this.mainmenuFileExit.Name = "mainmenuFileExit";
- this.mainmenuFileExit.Size = new System.Drawing.Size(106, 22);
+ this.mainmenuFileExit.Size = new System.Drawing.Size(98, 22);
this.mainmenuFileExit.Text = "Exit";
this.mainmenuFileExit.Click += new
System.EventHandler(this.exitToolStripMenuItem_Click);
//
@@ -216,125 +293,20 @@
this.toolStripSeparator2,
this.settingsToolStripMenuItem});
this.mainmenuOptions.Name = "mainmenuOptions";
- this.mainmenuOptions.Size = new System.Drawing.Size(56, 20);
+ this.mainmenuOptions.Size = new System.Drawing.Size(61, 20);
this.mainmenuOptions.Text = "Options";
//
- // mainmenuHelp
- //
- this.mainmenuHelp.DropDownItems.AddRange(new
System.Windows.Forms.ToolStripItem[] {
- this.mainmenuHelpContent,
- this.toolStripSeparator1,
- this.MainMenuHelpAbout});
- this.mainmenuHelp.Name = "mainmenuHelp";
- this.mainmenuHelp.Size = new System.Drawing.Size(40, 20);
- this.mainmenuHelp.Text = "Help";
- //
- // mainmenuHelpContent
- //
- this.mainmenuHelpContent.Name = "mainmenuHelpContent";
- this.mainmenuHelpContent.Size = new System.Drawing.Size(124, 22);
- this.mainmenuHelpContent.Text = "Content";
- //
- // toolStripSeparator1
- //
- this.toolStripSeparator1.Name = "toolStripSeparator1";
- this.toolStripSeparator1.Size = new System.Drawing.Size(121, 6);
- //
- // MainMenuHelpAbout
- //
- this.MainMenuHelpAbout.Name = "MainMenuHelpAbout";
- this.MainMenuHelpAbout.Size = new System.Drawing.Size(124, 22);
- this.MainMenuHelpAbout.Text = "About";
- this.MainMenuHelpAbout.Click += new
System.EventHandler(this.MainMenuHelpAbout_Click);
- //
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
- this.toolStripSeparator2.Size = new System.Drawing.Size(149, 6);
+ this.toolStripSeparator2.Size = new System.Drawing.Size(113, 6);
//
// settingsToolStripMenuItem
//
this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem";
- this.settingsToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.settingsToolStripMenuItem.Size = new System.Drawing.Size(116, 22);
this.settingsToolStripMenuItem.Text = "Settings";
this.settingsToolStripMenuItem.Click += new
System.EventHandler(this.settingsToolStripMenuItem_Click);
- //
- // toolbarLaunch
- //
- this.toolbarLaunch.Image =
((System.Drawing.Image)(resources.GetObject("toolbarLaunch.Image")));
- this.toolbarLaunch.ImageTransparentColor = System.Drawing.Color.Magenta;
- this.toolbarLaunch.Name = "toolbarLaunch";
- this.toolbarLaunch.Size = new System.Drawing.Size(61, 22);
- this.toolbarLaunch.Text = "Launch";
- this.toolbarLaunch.ToolTipText = "Starts the virtual machine";
- //
- // toolbarStop
- //
- this.toolbarStop.DisplayStyle =
System.Windows.Forms.ToolStripItemDisplayStyle.Image;
- this.toolbarStop.Image =
((System.Drawing.Image)(resources.GetObject("toolbarStop.Image")));
- this.toolbarStop.ImageTransparentColor = System.Drawing.Color.Magenta;
- this.toolbarStop.Name = "toolbarStop";
- this.toolbarStop.Size = new System.Drawing.Size(23, 22);
- this.toolbarStop.ToolTipText = "Stops the virtual machine";
- //
- // toolbarImageAdd
- //
- this.toolbarImageAdd.DisplayStyle =
System.Windows.Forms.ToolStripItemDisplayStyle.Image;
- this.toolbarImageAdd.Image =
((System.Drawing.Image)(resources.GetObject("toolbarImageAdd.Image")));
- this.toolbarImageAdd.ImageTransparentColor = System.Drawing.Color.Magenta;
- this.toolbarImageAdd.Name = "toolbarImageAdd";
- this.toolbarImageAdd.Size = new System.Drawing.Size(23, 22);
- this.toolbarImageAdd.ToolTipText = "Adds a new image";
- this.toolbarImageAdd.Click += new
System.EventHandler(this.CreateNewVirtMach);
- //
- // toolbarImageDel
- //
- this.toolbarImageDel.DisplayStyle =
System.Windows.Forms.ToolStripItemDisplayStyle.Image;
- this.toolbarImageDel.Image =
((System.Drawing.Image)(resources.GetObject("toolbarImageDel.Image")));
- this.toolbarImageDel.ImageTransparentColor = System.Drawing.Color.Magenta;
- this.toolbarImageDel.Name = "toolbarImageDel";
- this.toolbarImageDel.Size = new System.Drawing.Size(23, 22);
- this.toolbarImageDel.ToolTipText = "Deletes an existing image";
- this.toolbarImageDel.Click += new System.EventHandler(this.DeleteVirtMach);
- //
- // toolbarSnapShot
- //
- this.toolbarSnapShot.DisplayStyle =
System.Windows.Forms.ToolStripItemDisplayStyle.Image;
- this.toolbarSnapShot.Image =
((System.Drawing.Image)(resources.GetObject("toolbarSnapShot.Image")));
- this.toolbarSnapShot.ImageTransparentColor = System.Drawing.Color.Magenta;
- this.toolbarSnapShot.Name = "toolbarSnapShot";
- this.toolbarSnapShot.Size = new System.Drawing.Size(23, 22);
- this.toolbarSnapShot.Text = "toolStripButton1";
- this.toolbarSnapShot.ToolTipText = "Create a snap shot of the current
status";
- //
- // toolbarScreenShot
- //
- this.toolbarScreenShot.DisplayStyle =
System.Windows.Forms.ToolStripItemDisplayStyle.Image;
- this.toolbarScreenShot.Image =
((System.Drawing.Image)(resources.GetObject("toolbarScreenShot.Image")));
- this.toolbarScreenShot.ImageTransparentColor = System.Drawing.Color.Magenta;
- this.toolbarScreenShot.Name = "toolbarScreenShot";
- this.toolbarScreenShot.Size = new System.Drawing.Size(23, 22);
- this.toolbarScreenShot.Text = "toolStripButton2";
- this.toolbarScreenShot.ToolTipText = "Grab a screenshot of the
display";
- //
- // toolbarHelpContents
- //
- this.toolbarHelpContents.DisplayStyle =
System.Windows.Forms.ToolStripItemDisplayStyle.Image;
- this.toolbarHelpContents.Image =
((System.Drawing.Image)(resources.GetObject("toolbarHelpContents.Image")));
- this.toolbarHelpContents.ImageTransparentColor =
System.Drawing.Color.Magenta;
- this.toolbarHelpContents.Name = "toolbarHelpContents";
- this.toolbarHelpContents.Size = new System.Drawing.Size(23, 22);
- this.toolbarHelpContents.ToolTipText = "Opens help file";
- //
- // toolbarExit
- //
- this.toolbarExit.DisplayStyle =
System.Windows.Forms.ToolStripItemDisplayStyle.Image;
- this.toolbarExit.Image =
((System.Drawing.Image)(resources.GetObject("toolbarExit.Image")));
- this.toolbarExit.ImageTransparentColor = System.Drawing.Color.Magenta;
- this.toolbarExit.Name = "toolbarExit";
- this.toolbarExit.Size = new System.Drawing.Size(23, 22);
- this.toolbarExit.ToolTipText = "Exits application";
- this.toolbarExit.Click += new System.EventHandler(this.toolbarExit_Click);
//
// snapshotToolStripMenuItem
//
@@ -344,31 +316,59 @@
this.toolStripSeparator3,
this.deleteSnapshotToolStripMenuItem});
this.snapshotToolStripMenuItem.Name = "snapshotToolStripMenuItem";
- this.snapshotToolStripMenuItem.Size = new System.Drawing.Size(64, 20);
+ this.snapshotToolStripMenuItem.Size = new System.Drawing.Size(68, 20);
this.snapshotToolStripMenuItem.Text = "Snapshot";
//
// takeSnapshotToolStripMenuItem
//
this.takeSnapshotToolStripMenuItem.Name =
"takeSnapshotToolStripMenuItem";
- this.takeSnapshotToolStripMenuItem.Size = new System.Drawing.Size(163, 22);
+ this.takeSnapshotToolStripMenuItem.Size = new System.Drawing.Size(158, 22);
this.takeSnapshotToolStripMenuItem.Text = "Take snapshot";
//
// loadSnapshotToolStripMenuItem
//
this.loadSnapshotToolStripMenuItem.Name =
"loadSnapshotToolStripMenuItem";
- this.loadSnapshotToolStripMenuItem.Size = new System.Drawing.Size(163, 22);
+ this.loadSnapshotToolStripMenuItem.Size = new System.Drawing.Size(158, 22);
this.loadSnapshotToolStripMenuItem.Text = "Load snapshot";
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
- this.toolStripSeparator3.Size = new System.Drawing.Size(160, 6);
+ this.toolStripSeparator3.Size = new System.Drawing.Size(155, 6);
//
// deleteSnapshotToolStripMenuItem
//
this.deleteSnapshotToolStripMenuItem.Name =
"deleteSnapshotToolStripMenuItem";
- this.deleteSnapshotToolStripMenuItem.Size = new System.Drawing.Size(163,
22);
+ this.deleteSnapshotToolStripMenuItem.Size = new System.Drawing.Size(158,
22);
this.deleteSnapshotToolStripMenuItem.Text = "Delete snapshot";
+ //
+ // mainmenuHelp
+ //
+ this.mainmenuHelp.DropDownItems.AddRange(new
System.Windows.Forms.ToolStripItem[] {
+ this.mainmenuHelpContent,
+ this.toolStripSeparator1,
+ this.MainMenuHelpAbout});
+ this.mainmenuHelp.Name = "mainmenuHelp";
+ this.mainmenuHelp.Size = new System.Drawing.Size(44, 20);
+ this.mainmenuHelp.Text = "Help";
+ //
+ // mainmenuHelpContent
+ //
+ this.mainmenuHelpContent.Name = "mainmenuHelpContent";
+ this.mainmenuHelpContent.Size = new System.Drawing.Size(117, 22);
+ this.mainmenuHelpContent.Text = "Content";
+ //
+ // toolStripSeparator1
+ //
+ this.toolStripSeparator1.Name = "toolStripSeparator1";
+ this.toolStripSeparator1.Size = new System.Drawing.Size(114, 6);
+ //
+ // MainMenuHelpAbout
+ //
+ this.MainMenuHelpAbout.Name = "MainMenuHelpAbout";
+ this.MainMenuHelpAbout.Size = new System.Drawing.Size(117, 22);
+ this.MainMenuHelpAbout.Text = "About";
+ this.MainMenuHelpAbout.Click += new
System.EventHandler(this.MainMenuHelpAbout_Click);
//
// MainForm
//
Modified: trunk/tools/RosTE/GUI/MainForm.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosTE/GUI/MainForm.cs?rev=32…
==============================================================================
--- trunk/tools/RosTE/GUI/MainForm.cs (original)
+++ trunk/tools/RosTE/GUI/MainForm.cs Fri Feb 8 18:56:05 2008
@@ -14,6 +14,7 @@
public partial class MainForm : Form
{
private MainConfig mainConf;
+ private ArrayList virtualMachines;
public MainForm()
{
@@ -47,7 +48,7 @@
{
foreach (VirtMachInfo vmInfo in vmConfig.VMInfo)
{
- VirtualMachine vm = new VirtualMachine();
+ VirtualMachine vm = new VirtualMachine(vmInfo);
ListViewItem lvi =
VirtMachListView.Items.Add(vmConfig.ToString(), 0);
lvi.SubItems.Add(vm.MemSize.ToString() + " MB");
@@ -97,53 +98,30 @@
if (wizFrm.ShowDialog() == DialogResult.OK)
{
- if (wizFrm.Option == 1)
+ VirtualMachine virtMach = new VirtualMachine();
+ virtMach.Name = wizFrm.VMName;
+
+ switch (wizFrm.Option)
{
- try
- {
+ case 1:
if (!Directory.Exists(wizFrm.DefDir))
Directory.CreateDirectory(wizFrm.DefDir);
- }
- catch (Exception ex)
- {
- MessageBox.Show("Failed to create " + wizFrm.DefDir +
'\n' + ex.Message);
- return;
- }
- int i = mainConf.AddVirtMach(wizFrm.DefDir);
+ virtMach.DefDir = wizFrm.DefDir;
+ break;
- VirtualMachine VirtMach = new VirtualMachine();
- VirtMach.CreateVMConfig(wizFrm.VMName,
- wizFrm.DefDir,
- wizFrm.DiskSizeGB,
- wizFrm.ExistImg,
- wizFrm.MemSizeMB);
+ case 2:
- ListViewItem lvi = VirtMachListView.Items.Add(VirtMach.ToString(),
0);
- lvi.Tag = VirtMach;
+ break;
+
+ case 3:
+ virtMach.DefDir = "Images\\" + wizFrm.VMName;
+ break;
}
- else if (wizFrm.Option == 2)
- {
- DirectoryInfo di = Directory.GetParent(wizFrm.ExistImg);
- int i = mainConf.AddVirtMach(di.FullName);
- VirtualMachine VirtMach = new VirtualMachine();
- VirtMach.CreateVMConfig(wizFrm.VMName,
- wizFrm.ExistImg,
- wizFrm.MemSizeMB);
-
- ListViewItem lvi = VirtMachListView.Items.Add(VirtMach.ToString(),
0);
- lvi.Tag = VirtMach;
- }
- else
- {
- int i = mainConf.AddVirtMach("Images\\" + wizFrm.VMName);
- VirtualMachine VirtMach = new VirtualMachine();
- VirtMach.CreateVMConfig(wizFrm.VMName);
-
- ListViewItem lvi = VirtMachListView.Items.Add(VirtMach.ToString(),
0);
- lvi.Tag = VirtMach;
- }
+ ListViewItem lvi = VirtMachListView.Items.Add(virtMach.Name, 0);
+ lvi.SubItems.Add(virtMach.MemSize.ToString() + " MB");
+ lvi.Tag = virtMach;
}
}
@@ -174,7 +152,7 @@
}
}
- mainConf.DeleteVirtMach(lvi.Index/*lvi.Tag*/);
+ //mainConf.DeleteVirtMach(lvi.Index/*lvi.Tag*/);
VirtMachListView.Items.Remove(lvi);
}
}
@@ -182,10 +160,12 @@
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
- foreach(ListViewItem lvi in VirtMachListView.Items)
+ VirtMachConfig vmc = new VirtMachConfig();
+
+ foreach (ListViewItem lvi in VirtMachListView.Items)
{
- VirtMachConfig vm = (VirtMachConfig)lvi.Tag;
- vm.SaveVMConfig("err");
+ VirtualMachine vm = (VirtualMachine)lvi.Tag;
+ vmc.SaveVMConfig(vm);
}
mainConf.SaveSettings();
Modified: trunk/tools/RosTE/GUI/MainForm.resx
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosTE/GUI/MainForm.resx?rev=…
==============================================================================
--- trunk/tools/RosTE/GUI/MainForm.resx (original)
+++ trunk/tools/RosTE/GUI/MainForm.resx Fri Feb 8 18:56:05 2008
@@ -164,9 +164,6 @@
<metadata name="mainToolbar.TrayLocation" type="System.Drawing.Point,
System.Drawing, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a">
<value>358, 23</value>
</metadata>
- <metadata name="mainMenu.TrayLocation" type="System.Drawing.Point,
System.Drawing, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a">
- <value>242, 22</value>
- </metadata>
<assembly alias="System.Drawing" name="System.Drawing,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="toolbarLaunch.Image" type="System.Drawing.Bitmap,
System.Drawing"
mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
@@ -190,12 +187,12 @@
<data name="toolbarImageAdd.Image" type="System.Drawing.Bitmap,
System.Drawing"
mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAPtJREFUOE9jYKAV
- 8PDwYE9LS2Otr69nIscOxtDw4P/2DvZ/gfQ/EDs+Pp6DJIPCImz+3L5z6/+u3Tv/h0WE/Pbx8eEiyQCQ
- 7Xfu3v6/e8+u/0DNv0JDQ3kIGgDyr729PQtQMRvI6TADIqLCfkZHR/PhNQDkTyj+B7LdycXh7917d8Au
- iIwO/4MkD1aHYRhI8M7dW0B8+z9II4gG4QMH96Pgg4cO4DYAFGhHjh7+f/jIIbwYpwvQnXnm7On/IOzg
- BI5OmBexuwDdTyANV65eBuPwSNs/JKcDkAHXb1wDY7INuHzl0n8QJssAUOIJjwz9DcIgNihvEExIA6IA
- ADzE3xfN6Q2vAAAAAElFTkSuQmCC
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAPpJREFUOE9jYKAV
+ 8PDwYE9LS2Otr69nIscOxtDw4P/29vZ/gfQ/EDs+Pp6DJIPCIqz/3L5z6/+u3Tv/h0WE/Pbx8eEiyQCQ
+ 7Xfu3v6/e8+u/0DNv0JDQ3kIGgDyL1AjC1AxG8jpMAMiosJ+RkdH8+E1AORPKP4Hst3R2f7v3Xt3wC6I
+ jA7/gyQPVodhGEjwzt1bQHz7P0gjiAbhAwf3o+CDhw7gNgAUaEeOHv5/+MghvBinC9Cdeebs6f8gbO8I
+ jk6YF7G7AN1PIA1Xrl4G4/BImz8kpwOQAddvXANjsg24fOXSfxAmywBQ4gmPDP0NwiA2KG8QTEgDogAA
+ Is/fC3RwXJUAAAAASUVORK5CYII=
</value>
</data>
<data name="toolbarImageDel.Image" type="System.Drawing.Bitmap,
System.Drawing"
mimetype="application/x-microsoft.net.object.bytearray.base64">
@@ -241,20 +238,20 @@
<data name="toolbarHelpContents.Image" type="System.Drawing.Bitmap,
System.Drawing"
mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAthJREFUOE+FU11I
- U2EYXllBF3VjW91JklGUmCnSxBIVR+aSfgjMm0FKpgRezFwQdCIbQi5N259DcOBMUOjCfpSwFuRkRngj
- FhRIprmpzJ2/eXbOztnbeT9Tcl104OF853zP+37P+7zvt0OT8jiuVJVIuaeqlb37zic18iHc3qnZFU4T
- uLHdX7723x4cnkiNId8URe3xnNMHB48fUz76/QrPcyBJEoiiCDQdBf/bMeX50SwFOcjdlmRoaCjNk5MT
- em+5I0uhEAhTQWAYGqLRCAHDRCEWmID1mRkYq78pIxdjtpJ4zhZ+6DeZEtLcHDB1dUAXFwMT+kWSsCwN
- THgJ6LIyYCwtIExPQ5/KxRiSwHm1KteWeVgWZmeBMZmAKS2FSHU1+C4aE6rUOMJ3qSoRra0FtrISGLMZ
- +MkA2DIyZPdl42lNh/WBY7THneRfvwK6qAjWamrArtMmXRXlTqqL2o/wqGv7QV0y2thIlHCjb8D/Ylix
- Pbzn0nR22n5EIquqUWvAhkMwYjRK7rLip6lOOw0lT97pz8j86jLhhtWyMBbdj8diPDEL30S2empqAqJG
- 3ROE9T/G0oRLEmDLsFWCEPtvAlGMEy4aTBKgjJWVZdVtFgSOhZe36kV3RXl7qgK3obRj1GyOi6oClmVg
- aWlxowQ0wj/gU/jeXmAbGoAeHwdfZqbirjA4Nk10XTDYB7KOKNz3b8BaHwFnfwZ+l1PBBmiwFQ6tNslb
- LEDr9cBTFDCBAIzctUjddiqOGKEoKfZzHmJeL9AFBcDeuAH29PQkjgBR6tUXTATz8yHW3Ax0YSFwLS2A
- UmU5oUKGhCQC191Fgjl1HiazswFjtsrEsew7eWI1mJcHXFMTcD1uUidO4QYY4Bx2cjIGI3fbKG9eJq9e
- /9mh0yU/tVnlxcUF4jZiYWEBpqytskN7IImcfy7T347br18r6my932Oztc8/trWJCFzjP7zqqd35DfRf
- Lu+Mc2gnAAAAAElFTkSuQmCC
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAttJREFUOE+FU11I
+ U2EYXllBF3VjW91JklGUmCnWxBIVR+aSfgjMm4FKpgRezFwQdMK0oC1Nd/bjEBypCQpdWKmEtQgnM8Ib
+ saBAspmbytz5m2fn7Jzzdr7PlFwXHXg43znf877f8z7v++3QJD2OqxVFYvapSnnvvguKRjqEtndqdoVT
+ eHZ895evfbcHhyeTY/A3QRB7POf1gcHjx+SPPp/McSyIogiCIABFRcH3dlx+cTRDRhzE3ZZkaGgoxZOV
+ FXpvuSOJoRDw0wGgaQqi0QgGTUch5p+E9dlZGK+7KSEuitlK4jmX/+G5yZQQ5+eBrq0FqrAQ6NAvnIRh
+ KKDDS0CVlABtaQZ+ZgZ6VS6KwQmc1yqyremHJX5uDmiTCejiYohUVkLfJWNClRpH6LtckYjW1ABTXg60
+ 2QzclB+saWmS+4rxtKa97YFj1O1SuDevgSoogLWqKrDrtIqrrNRJdBL7ETzq2n5Qp0QbGrASdmwUfC+H
+ ZVvLPZemo8P2IxJZVY1aAyYcghGjUXSXFD5LdtppKHr67uwZiVtdxtywWhaKRe7HYzEOm4XeWLZ6anIC
+ rEbd4/n1P8ZSmIsToJahVvF87L8JBCGOuchgnADJWFlZVt1mgGcZeHWrTnCXlVqTFbgNxe1jZnNcUBUw
+ DA1LS4sbJSAjfAP9MtfTA0x9PVATE9Cfni67ywyOTRNdFw3kQMYRmf3+DZi2VmBJO/hcThk1QINaQWq1
+ CmexAKXXA0cQQPv9MHLXInaRRBxhhCDE2M8FiHm9QOXlAVNdDfbUVAWNAFbq1edNBnJzIdbUBFR+PrDN
+ zYCkSlJChQQJUQC2qxMHs+o8TGVmAorZKhONZe/JE6uBnBxgGxuB7XbjOtEUboAG1kHik1Ew4m4b5c3L
+ 5NXrP5M6nfLpUau0uBjEbiMEg0GYbm2RSO0BBXH+uUx/O07euF7Q8fB+t81mXXhieywgoDX6h656cnd+
+ A8q3Lto1lVQmAAAAAElFTkSuQmCC
</value>
</data>
<data name="toolbarExit.Image" type="System.Drawing.Bitmap,
System.Drawing"
mimetype="application/x-microsoft.net.object.bytearray.base64">
@@ -269,6 +266,9 @@
LCXCNDrnyf/3rlL671en+j+gTut/QL02TgPAyZuYjIQ1L5CTswFNRoUxygqSMgAAAABJRU5ErkJggg==
</value>
</data>
+ <metadata name="mainMenu.TrayLocation" type="System.Drawing.Point,
System.Drawing, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a">
+ <value>242, 22</value>
+ </metadata>
<data name="$this.Icon" type="System.Drawing.Icon,
System.Drawing"
mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAkAEBAAAAEACABoBQAAlgAAACAgAAABAAgAqAgAAP4FAAAwMAAAAQAIAKgOAACmDgAAEBAAAAEA
Modified: trunk/tools/RosTE/GUI/NewVMWizard.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosTE/GUI/NewVMWizard.cs?rev…
==============================================================================
--- trunk/tools/RosTE/GUI/NewVMWizard.cs (original)
+++ trunk/tools/RosTE/GUI/NewVMWizard.cs Fri Feb 8 18:56:05 2008
@@ -13,6 +13,7 @@
{
private MainConfig mainConf;
+ #region properties
public string VMName
{
get { return nameTxtBox.Text; }
@@ -42,6 +43,7 @@
else return 3;
}
}
+ #endregion
public NewVMWizard(MainConfig mainConfIn)
{
Modified: trunk/tools/RosTE/GUI/SettingsForm.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosTE/GUI/SettingsForm.cs?re…
==============================================================================
--- trunk/tools/RosTE/GUI/SettingsForm.cs (original)
+++ trunk/tools/RosTE/GUI/SettingsForm.cs Fri Feb 8 18:56:05 2008
@@ -87,10 +87,9 @@
private void LoadHardDiskPage()
{
- ArrayList hardDrives = VirtMach.GetHardDisks();
- foreach (VMHardDrive vmhd in hardDrives)
- {
- harddiskLstBox.Items.Add(vmhd);
+ foreach (HardDriveInfo hdi in VirtMach.HardDrives)
+ {
+ harddiskLstBox.Items.Add(hdi);
}
if (harddiskLstBox.Items.Count > 0)
@@ -308,12 +307,12 @@
ListBox lb = (ListBox)sender;
if (lb.SelectedItem != null)
{
- VMHardDrive vmhd = (VMHardDrive)lb.SelectedItem;
-
- harddiskDriveName.Text = vmhd.Drive;
- harddiskFileNameTxtBox.Text = vmhd.Path;
- harddiskSizeLbl.Text = vmhd.Size.ToString();
- harddiskBootImageChk.Checked = vmhd.BootImg;
+ HardDriveInfo hdi = (HardDriveInfo)lb.SelectedItem;
+
+ harddiskDriveName.Text = hdi.name;
+ harddiskFileNameTxtBox.Text = hdi.path;
+ harddiskSizeLbl.Text = hdi.size.ToString();
+ harddiskBootImageChk.Checked = hdi.bootImg;
}
}
Modified: trunk/tools/RosTE/GUI/VirtualMachine.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosTE/GUI/VirtualMachine.cs?…
==============================================================================
--- trunk/tools/RosTE/GUI/VirtualMachine.cs (original)
+++ trunk/tools/RosTE/GUI/VirtualMachine.cs Fri Feb 8 18:56:05 2008
@@ -9,6 +9,50 @@
namespace RosTEGUI
{
+ public struct VirtMachInfo
+ {
+ public int virtMachID;
+ public string name;
+ public string machType;
+ public string defDir;
+ public int memSize;
+ public bool setClockToHost;
+ public bool cdRomEnable;
+ public bool cdRomUsePhys;
+ public string cdRomPhysDrv;
+ public bool cdRomUseIso;
+ public string cdRomIsoImg;
+ public bool floppyEnable;
+ public bool floppyUsePhys;
+ public string floppyPhysDrv;
+ public bool floppyUseImg;
+ public string floppyIsoImg;
+
+ public List<HardDriveInfo> hardDrives;
+ public List<NetCardInfo> netCards;
+ }
+
+ public struct HardDriveInfo
+ {
+ public int diskID;
+ public string name;
+ public string drive;
+ public string path;
+ public int size;
+ public bool bootImg;
+ }
+
+ public struct NetCardInfo
+ {
+ public int cardID;
+ public int virtMachID;
+ public string option;
+ public int vlan;
+ public string macAddr;
+ public string model;
+ public string hostname;
+ }
+
public class VMHardDrive
{
private DataRow hdDataRow;
@@ -109,222 +153,120 @@
}
}
+ public class VMNetCard
+ {
+ }
+
public class VirtualMachine
{
- private DataRow vmDataRow;
-
+ private VirtMachInfo vmInfo;
+
+ private ArrayList netCards;
private ArrayList hardDrives;
- private ArrayList netCards;
#region Virtual machine properties
-
public int VirtMachID
{
- get { return GetIntValue("VirtMachID"); }
- }
-
+ get { return vmInfo.virtMachID; }
+ }
public string Name
{
- get { return GetStringValue("Name"); }
- set { SetStringValue("Name", value); }
- }
-
+ get { return vmInfo.name; }
+ set { vmInfo.name = value; }
+ }
public string MachType
{
- get { return GetStringValue("MachType"); }
- set { SetStringValue("MachType", value); }
- }
-
+ get { return vmInfo.machType; }
+ set { vmInfo.machType = value; }
+ }
public string DefDir
{
- get { return GetStringValue("DefDir"); }
- set { SetStringValue("DefDir", value); }
- }
-
+ get { return vmInfo.defDir; }
+ set { vmInfo.defDir = value; }
+ }
public int MemSize
{
- get { return GetIntValue("MemSize"); }
- set { SetIntValue("MemSize", value); }
- }
-
+ get { return vmInfo.memSize; }
+ set { vmInfo.memSize = value; }
+ }
public bool SetClockToHost
{
- get { return GetBoolValue("SetClockToHost"); }
- set { SetBoolValue("SetClockToHost", value); }
- }
-
+ get { return vmInfo.setClockToHost; }
+ set { vmInfo.setClockToHost = value; }
+ }
public bool CdRomEnable
{
- get { return GetBoolValue("CdRomEnable"); }
- set { SetBoolValue("CdRomEnable", value); }
- }
-
+ get { return vmInfo.cdRomEnable; }
+ set { vmInfo.cdRomEnable = value; }
+ }
public bool CdRomUsePhys
{
- get { return GetBoolValue("CdRomUsePhys"); }
- set { SetBoolValue("CdRomUsePhys", value); }
- }
-
+ get { return vmInfo.cdRomUsePhys; }
+ set { vmInfo.cdRomUsePhys = value; }
+ }
public string CdRomPhysDrv
{
- get { return GetStringValue("CdRomPhysDrv"); }
- set { SetStringValue("CdRomPhysDrv", value); }
- }
-
+ get { return vmInfo.cdRomPhysDrv; }
+ set { vmInfo.cdRomPhysDrv = value; }
+ }
public bool CdRomUseIso
{
- get { return GetBoolValue("CdRomUseIso"); }
- set { SetBoolValue("CdRomUseIso", value); }
- }
-
+ get { return vmInfo.cdRomUseIso; }
+ set { vmInfo.cdRomUseIso = value; }
+ }
public string CdRomIsoImg
{
- get { return GetStringValue("CdRomIsoImg"); }
- set { SetStringValue("CdRomIsoImg", value); }
- }
-
+ get { return vmInfo.cdRomIsoImg; }
+ set { vmInfo.cdRomIsoImg = value; }
+ }
public bool FloppyEnable
{
- get { return GetBoolValue("FloppyEnable"); }
- set { SetBoolValue("FloppyEnable", value); }
- }
-
+ get { return vmInfo.floppyEnable; }
+ set { vmInfo.floppyEnable = value; }
+ }
public bool FloppyUsePhys
{
- get { return GetBoolValue("FloppyUsePhys"); }
- set { SetBoolValue("FloppyUsePhys", value); }
- }
-
+ get { return vmInfo.floppyUsePhys; }
+ set { vmInfo.floppyUsePhys = value; }
+ }
public string FloppyPhysDrv
{
- get { return GetStringValue("FloppyPhysDrv"); }
- set { SetStringValue("FloppyPhysDrv", value); }
- }
-
- public bool FloppyUseIso
- {
- get { return GetBoolValue("FloppyUseIso"); }
- set { SetBoolValue("FloppyUseIso", value); }
- }
-
+ get { return vmInfo.floppyPhysDrv; }
+ set { vmInfo.floppyPhysDrv = value; }
+ }
+ public bool FloppyUseImg
+ {
+ get { return vmInfo.floppyUseImg; }
+ set { vmInfo.floppyUseImg = value; }
+ }
public string FloppyIsoImg
{
- get { return GetStringValue("FloppyIsoImg"); }
- set { SetStringValue("FloppyIsoImg", value); }
- }
-
+ get { return vmInfo.floppyIsoImg; }
+ set { vmInfo.floppyIsoImg = value; }
+ }
+ public VirtMachInfo VMInfo
+ {
+ get { return vmInfo; }
+ }
+ public List<HardDriveInfo> HardDrives
+ {
+ get { return vmInfo.hardDrives; }
+ }
+ public List<NetCardInfo> NetCards
+ {
+ get { return vmInfo.netCards; }
+ }
#endregion
- #region property helper functions
-
- private int GetIntValue(string key)
- {
- try
- {
- return (int)vmDataRow[key];
- }
- catch (ArgumentException e)
- {
- string message = "Failed to get " + key + " value";
- Debug.LogMessage(message, e.Message, e.StackTrace, true);
- return 0;
- }
- }
-
- private bool GetBoolValue(string key)
- {
- try
- {
- return (bool)vmDataRow[key];
- }
- catch (ArgumentException e)
- {
- string message = "Failed to get " + key + " value";
- Debug.LogMessage(message, e.Message, e.StackTrace, true);
- return false;
- }
- }
-
- private string GetStringValue(string key)
- {
- try
- {
- return (string)vmDataRow[key];
- }
- catch (ArgumentException e)
- {
- string message = "Failed to get " + key + " value";
- Debug.LogMessage(message, e.Message, e.StackTrace, true);
- return string.Empty;
- }
- }
-
- private void SetIntValue(string key, int value)
- {
- try
- {
- vmDataRow[key] = value;
- }
- catch (ArgumentException e)
- {
- string message = "Failed to set " + key + " value";
- Debug.LogMessage(message, e.Message, e.StackTrace, true);
- }
- }
-
- private void SetBoolValue(string key, bool value)
- {
- try
- {
- vmDataRow[key] = value;
- }
- catch (ArgumentException e)
- {
- string message = "Failed to set " + key + " value";
- Debug.LogMessage(message, e.Message, e.StackTrace, true);
- }
- }
-
- private void SetStringValue(string key, string value)
- {
- try
- {
- vmDataRow[key] = value;
- }
- catch (ArgumentException e)
- {
- string message = "Failed to set " + key + " value";
- Debug.LogMessage(message, e.Message, e.StackTrace, true);
- }
- }
-
- #endregion
-
- #region database functions
-
- private bool PopulateVMDatabase(string name,
- string dir,
- float diskSize,
- string existImg,
- int memSize)
- {
- bool ret = false;
-
- return ret;
- }
-
-
-
- #endregion
-
public VirtualMachine()
- {/*
- vmConfig = new VMConfig();
- if (!vmConfig.LoadVirtMachData())
- MessageBox.Show("Failed to load VM Schema");
-
- hardDrives = new ArrayList(3);
- netCards = new ArrayList();*/
+ {
+ vmInfo = new VirtMachInfo();
+ CreateDefaultConfig();
+ }
+
+ public VirtualMachine(VirtMachInfo vmInfoIn)
+ {
+ vmInfo = vmInfoIn;
}
public override string ToString()
@@ -369,11 +311,7 @@
;//FIXME: create a vm image 'qemu-img.exe create'
}
- return PopulateVMDatabase(name,
- dir,
- diskSize,
- existImg,
- memSize);
+ return false;
}
public VMHardDrive AddHardDisk(string nameIn,
@@ -402,5 +340,48 @@
{
return hardDrives;
}
+
+ private void CreateDefaultConfig()
+ {
+ vmInfo.virtMachID = 0;
+ vmInfo.name = "New VM " + vmInfo.virtMachID.ToString();
+ vmInfo.machType = string.Empty;
+ vmInfo.defDir = string.Empty;
+ vmInfo.memSize = 0;
+ vmInfo.setClockToHost = true;
+ vmInfo.cdRomEnable = true;
+ vmInfo.cdRomUsePhys = true;
+ vmInfo.cdRomPhysDrv = string.Empty;
+ vmInfo.cdRomUseIso = false;
+ vmInfo.cdRomIsoImg = string.Empty;
+ vmInfo.floppyEnable = false;
+ vmInfo.floppyUsePhys = false;
+ vmInfo.floppyPhysDrv = string.Empty;
+ vmInfo.floppyUseImg = false;
+ vmInfo.floppyIsoImg = string.Empty;
+
+ HardDriveInfo hdi = new HardDriveInfo();
+ hdi.bootImg = true;
+ hdi.diskID = 1;
+ hdi.drive = string.Empty;
+ hdi.name = "root";
+ hdi.path = string.Empty;
+ hdi.size = 0;
+
+ vmInfo.hardDrives = new List<HardDriveInfo>();
+ vmInfo.hardDrives.Add(hdi);
+
+ NetCardInfo nci = new NetCardInfo();
+ nci.cardID = 1;
+ nci.hostname = string.Empty;
+ nci.macAddr = string.Empty;
+ nci.model = string.Empty;
+ nci.option = string.Empty;
+ nci.virtMachID = 0;
+ nci.vlan = 0;
+
+ vmInfo.netCards = new List<NetCardInfo>();
+ vmInfo.netCards.Add(nci);
+ }
}
}