Author: gedmurphy
Date: Wed Jun 27 19:59:51 2007
New Revision: 27289
URL:
http://svn.reactos.org/svn/reactos?rev=27289&view=rev
Log:
- add an populate harddrives and netcards to the DB
- highlight when the user is moving outside of the recommended mem settings
- improve the error reporting messages
Modified:
trunk/tools/RosTE/GUI/ErrorForm.Designer.cs
trunk/tools/RosTE/GUI/ErrorForm.cs
trunk/tools/RosTE/GUI/MainForm.cs
trunk/tools/RosTE/GUI/SettingsForm.cs
trunk/tools/RosTE/GUI/VMConfig.xsd
trunk/tools/RosTE/GUI/VMConfig.xsx
trunk/tools/RosTE/GUI/VirtualMachine.cs
Modified: trunk/tools/RosTE/GUI/ErrorForm.Designer.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosTE/GUI/ErrorForm.Designer…
==============================================================================
--- trunk/tools/RosTE/GUI/ErrorForm.Designer.cs (original)
+++ trunk/tools/RosTE/GUI/ErrorForm.Designer.cs Wed Jun 27 19:59:51 2007
@@ -70,7 +70,9 @@
this.Controls.Add(this.errorCopyBtn);
this.Controls.Add(this.errorCloseBtn);
this.Controls.Add(this.errorText);
+ this.MaximizeBox = false;
this.Name = "ErrorForm";
+ this.ShowIcon = false;
this.Text = "Error";
this.ResumeLayout(false);
this.PerformLayout();
Modified: trunk/tools/RosTE/GUI/ErrorForm.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosTE/GUI/ErrorForm.cs?rev=2…
==============================================================================
--- trunk/tools/RosTE/GUI/ErrorForm.cs (original)
+++ trunk/tools/RosTE/GUI/ErrorForm.cs Wed Jun 27 19:59:51 2007
@@ -10,11 +10,11 @@
{
public partial class ErrorForm : Form
{
- public ErrorForm(string message)
+ public ErrorForm(string message, string exception, string trace)
{
InitializeComponent();
- errorText.Text = message;
+ errorText.Text = message + " : " + exception + "\n\t" +
trace;
}
private void errorCloseBtn_Click(object sender, EventArgs e)
Modified: trunk/tools/RosTE/GUI/MainForm.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosTE/GUI/MainForm.cs?rev=27…
==============================================================================
--- trunk/tools/RosTE/GUI/MainForm.cs (original)
+++ trunk/tools/RosTE/GUI/MainForm.cs Wed Jun 27 19:59:51 2007
@@ -136,7 +136,18 @@
if (delFrm.DeleteFullVM)
{
VirtualMachine vm = (VirtualMachine)lvi.Tag;
- Directory.Delete(vm.DefDir, true);
+
+ try
+ {
+ Directory.Delete(vm.DefDir, true);
+ }
+ catch (DirectoryNotFoundException ex)
+ {
+ MessageBox.Show(vm.DefDir + " has was not found!",
+ "error",
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ }
}
mainConf.DeleteVirtMach(lvi.Index/*lvi.Tag*/);
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 Wed Jun 27 19:59:51 2007
@@ -226,11 +226,23 @@
memoryUpDwn.Value = tb.Value;
char[] chars = { ' ', 'M', 'B' };
- string str = memoryRecMax.Text.TrimEnd(chars);
- if (tb.Value > Convert.ToInt32(str))
- memoryTrkBar.BackColor = Color.MistyRose;
- else
- memoryTrkBar.BackColor = SystemColors.Menu;
+ string max = memoryRecMax.Text.TrimEnd(chars);
+ string min = memoryRecMin.Text.TrimEnd(chars);
+ if (tb.Value > Convert.ToInt32(max))
+ {
+ memoryRecMin.ForeColor = SystemColors.WindowText;
+ memoryRecMax.ForeColor = Color.Red;
+ }
+ else if (tb.Value < Convert.ToInt32(min))
+ {
+ memoryRecMin.ForeColor = Color.Red;
+ memoryRecMax.ForeColor = SystemColors.WindowText;
+ }
+ else
+ {
+ memoryRecMin.ForeColor = SystemColors.WindowText;
+ memoryRecMax.ForeColor = SystemColors.WindowText;
+ }
}
private void memoryUpDwn_ValueChanged(object sender, EventArgs e)
@@ -278,4 +290,4 @@
}
}
}
-}
+}
Modified: trunk/tools/RosTE/GUI/VMConfig.xsd
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosTE/GUI/VMConfig.xsd?rev=2…
==============================================================================
--- trunk/tools/RosTE/GUI/VMConfig.xsd (original)
+++ trunk/tools/RosTE/GUI/VMConfig.xsd Wed Jun 27 19:59:51 2007
@@ -31,8 +31,9 @@
<xs:sequence>
<xs:element name="DiskID" type="xs:int" />
<xs:element name="VirtMachID" type="xs:int" />
+ <xs:element name="Name" type="xs:string" />
<xs:element name="Path" type="xs:string" />
- <xs:element name="Size" type="xs:string" />
+ <xs:element name="Size" type="xs:int" />
</xs:sequence>
</xs:complexType>
<xs:keyref name="VMConfigHardDisks" refer="VMConfigKey">
Modified: trunk/tools/RosTE/GUI/VMConfig.xsx
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosTE/GUI/VMConfig.xsx?rev=2…
==============================================================================
--- trunk/tools/RosTE/GUI/VMConfig.xsx (original)
+++ trunk/tools/RosTE/GUI/VMConfig.xsx Wed Jun 27 19:59:51 2007
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--This file is auto-generated by the XML Schema Designer. It holds layout
information for components on the designer surface.-->
-<XSDDesignerLayout Style="LeftRight" layoutVersion="2"
viewPortLeft="-128" viewPortTop="-6097" zoom="100">
- <VMConfig_XmlElement left="7091" top="-3148"
width="7858" height="11721" selected="0"
zOrder="0" index="0" expanded="1" />
- <HardDisks_XmlElement left="872" top="-3201"
width="5292" height="2831" selected="0" zOrder="3"
index="1" expanded="1" />
- <NetCards_XmlElement left="16033" top="-3176"
width="5292" height="5371" selected="0" zOrder="1"
index="2" expanded="1" />
- <VMConfigHardDisks_XmlKeyref left="5129" top="-5302"
width="503" height="503" selected="0" zOrder="4"
expanded="0" />
- <VMConfigNetCards_XmlKeyref left="13857" top="-5195"
width="503" height="503" selected="0" zOrder="8"
expanded="0" />
+<XSDDesignerLayout Style="LeftRight" layoutVersion="2"
viewPortLeft="-842" viewPortTop="-6097" zoom="100">
+ <VMConfig_XmlElement left="5159" top="-3175"
width="7858" height="11721" selected="0"
zOrder="0" index="0" expanded="1" />
+ <HardDisks_XmlElement left="-451" top="-3228"
width="5292" height="3254" selected="0" zOrder="2"
index="1" expanded="1" />
+ <NetCards_XmlElement left="13546" top="-3176"
width="5292" height="5371" selected="0" zOrder="1"
index="2" expanded="1" />
+ <VMConfigHardDisks_XmlKeyref left="4996" top="-5275"
width="503" height="503" selected="0" zOrder="3"
expanded="0" />
+ <VMConfigNetCards_XmlKeyref left="12692" top="-5195"
width="503" height="503" selected="0" zOrder="7"
expanded="0" />
</XSDDesignerLayout>
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 Wed Jun 27 19:59:51 2007
@@ -4,13 +4,18 @@
using System.Data;
using System.Xml;
using System.Windows.Forms;
+using System.Collections;
namespace RosTEGUI
{
public class VirtualMachine
{
private Data data;
- private DataRow dataRow;
+ private DataRow vmDataRow;
+ private DataRow hdDataRow;
+ private DataRow netDataRow;
+ private ArrayList hardDrives;
+
#region Virtual machine properties
@@ -117,11 +122,12 @@
{
try
{
- return (int)dataRow[key];
- }
- catch (ArgumentException e)
- {
- ErrorForm err = new ErrorForm(e.Message);
+ return (int)vmDataRow[key];
+ }
+ catch (ArgumentException e)
+ {
+ string message = "Failed to get " + key + " value";
+ ErrorForm err = new ErrorForm(message, e.Message, e.StackTrace);
err.ShowDialog();
return 0;
}
@@ -131,11 +137,12 @@
{
try
{
- return (bool)dataRow[key];
- }
- catch (ArgumentException e)
- {
- ErrorForm err = new ErrorForm(e.Message);
+ return (bool)vmDataRow[key];
+ }
+ catch (ArgumentException e)
+ {
+ string message = "Failed to get " + key + " value";
+ ErrorForm err = new ErrorForm(message, e.Message, e.StackTrace);
err.ShowDialog();
return false;
}
@@ -145,11 +152,12 @@
{
try
{
- return (string)dataRow[key];
- }
- catch (ArgumentException e)
- {
- ErrorForm err = new ErrorForm(e.Message);
+ return (string)vmDataRow[key];
+ }
+ catch (ArgumentException e)
+ {
+ string message = "Failed to get " + key + " value";
+ ErrorForm err = new ErrorForm(message, e.Message, e.StackTrace);
err.ShowDialog();
return string.Empty;
}
@@ -159,11 +167,12 @@
{
try
{
- dataRow[key] = value;
- }
- catch (ArgumentException e)
- {
- ErrorForm err = new ErrorForm(e.Message);
+ vmDataRow[key] = value;
+ }
+ catch (ArgumentException e)
+ {
+ string message = "Failed to set " + key + " value";
+ ErrorForm err = new ErrorForm(message, e.Message, e.StackTrace);
err.ShowDialog();
}
}
@@ -172,11 +181,12 @@
{
try
{
- dataRow[key] = value;
- }
- catch (ArgumentException e)
- {
- ErrorForm err = new ErrorForm(e.Message);
+ vmDataRow[key] = value;
+ }
+ catch (ArgumentException e)
+ {
+ string message = "Failed to set " + key + " value";
+ ErrorForm err = new ErrorForm(message, e.Message, e.StackTrace);
err.ShowDialog();
}
}
@@ -185,25 +195,17 @@
{
try
{
- dataRow[key] = value;
- }
- catch (ArgumentException e)
- {
- ErrorForm err = new ErrorForm(e.Message);
+ vmDataRow[key] = value;
+ }
+ catch (ArgumentException e)
+ {
+ string message = "Failed to set " + key + " value";
+ ErrorForm err = new ErrorForm(message, e.Message, e.StackTrace);
err.ShowDialog();
}
}
#endregion
-
- private static void PrintRows(DataTable dt)
- {
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- string str = "row: " + i + ", Name: " +
dt.Rows[i]["Name"] + ", DefDir " + dt.Rows[i]["DefDir"];
- MessageBox.Show(str);
- }
- }
private bool PopulateVMDatabase(string name,
string dir,
@@ -215,33 +217,52 @@
try
{
- DataTable dt = data.DataSet.Tables["VMConfig"];
- int i = dt.Rows.Count + 1;
- dataRow = dt.NewRow();
- dataRow["VirtMachID"] = i;
- dataRow["Name"] = name;
- dataRow["MachType"] = "pc";
- dataRow["DefDir"] = dir;
- dataRow["MemSize"] = memSize;
- dataRow["SetClockToHost"] = true;
- dataRow["CdRomEnable"] = true;
- dataRow["CdRomUsePhys"] = true;
- dataRow["CdRomPhysDrv"] = string.Empty;
- dataRow["CdRomUseIso"] = false;
- dataRow["CdRomIsoImg"] = string.Empty;
- dataRow["FloppyEnable"] = true;
- dataRow["FloppyUsePhys"] = true;
- dataRow["FloppyPhysDrv"] = string.Empty;
- dataRow["FloppyUseImg"] = false;
- dataRow["FloppyIsoImg"] = string.Empty;
-
- dt.Rows.Add(dataRow);
+ DataTable vmdt = data.DataSet.Tables["VMConfig"];
+ vmDataRow = vmdt.NewRow();
+ vmDataRow["VirtMachID"] = vmdt.Rows.Count + 1;
+ vmDataRow["Name"] = name;
+ vmDataRow["MachType"] = "pc";
+ vmDataRow["DefDir"] = dir;
+ vmDataRow["MemSize"] = memSize;
+ vmDataRow["SetClockToHost"] = true;
+ vmDataRow["CdRomEnable"] = true;
+ vmDataRow["CdRomUsePhys"] = true;
+ vmDataRow["CdRomPhysDrv"] = string.Empty;
+ vmDataRow["CdRomUseIso"] = false;
+ vmDataRow["CdRomIsoImg"] = string.Empty;
+ vmDataRow["FloppyEnable"] = true;
+ vmDataRow["FloppyUsePhys"] = true;
+ vmDataRow["FloppyPhysDrv"] = string.Empty;
+ vmDataRow["FloppyUseImg"] = false;
+ vmDataRow["FloppyIsoImg"] = string.Empty;
+ vmdt.Rows.Add(vmDataRow);
+
+ DataTable hddt = data.DataSet.Tables["HardDisks"];
+ hdDataRow = hddt.NewRow();
+ hdDataRow["DiskID"] = hddt.Rows.Count + 1;
+ hdDataRow["VirtMachID"] = vmDataRow["VirtMachID"];
+ hdDataRow["Name"] = "hda";
+ hdDataRow["Path"] = string.Empty;
+ hdDataRow["Size"] = 0;
+ hddt.Rows.Add(hdDataRow);
+
+ DataTable netdt = data.DataSet.Tables["NetCards"];
+ netDataRow = netdt.NewRow();
+ netDataRow["CardID"] = netdt.Rows.Count + 1;
+ netDataRow["VirtMachID"] = vmDataRow["VirtMachID"];
+ netDataRow["Option"] = "hda";
+ netDataRow["Vlan"] = 0;
+ netDataRow["MacAddr"] = string.Empty;
+ netDataRow["Model"] = string.Empty;
+ netDataRow["Hostname"] = string.Empty;
+ netdt.Rows.Add(netDataRow);
ret = true;
}
catch (Exception e)
{
- ErrorForm err = new ErrorForm(e.Message);
+ string message = "Failed to populate database";
+ ErrorForm err = new ErrorForm(message, e.Message, e.StackTrace);
err.ShowDialog();
}
@@ -314,14 +335,17 @@
data.DataSet.ReadXml(xtr, System.Data.XmlReadMode.ReadSchema);
xtr.Close();
- DataTable dt = data.DataSet.Tables["VMConfig"];
- dataRow = dt.Rows[0];
+ DataTable vmdt = data.DataSet.Tables["VMConfig"];
+ vmDataRow = vmdt.Rows[0];
+
+ DataTable hddt = data.DataSet.Tables["HardDisks"];
+ hdDataRow = hddt.Rows[0];
ret = true;
}
catch (Exception e)
{
- MessageBox.Show("error loading VM Config.xml: " +
e.Message);
+ MessageBox.Show("error loading the VM Config.xml: " +
e.Message);
}
}