[ros-diffs] [gedmurphy] 31980: rewrite the config handler

gedmurphy at svn.reactos.org gedmurphy at svn.reactos.org
Thu Jan 24 22:33:59 CET 2008


Author: gedmurphy
Date: Fri Jan 25 00:33:58 2008
New Revision: 31980

URL: http://svn.reactos.org/svn/reactos?rev=31980&view=rev
Log:
rewrite the config handler

Added:
    trunk/tools/RosTE/GUI/ConfigHandler.cs
Modified:
    trunk/tools/RosTE/GUI/ConsoleSettings.Designer.cs
    trunk/tools/RosTE/GUI/ConsoleSettings.cs
    trunk/tools/RosTE/GUI/MainConfig.xsx
    trunk/tools/RosTE/GUI/MainForm.cs
    trunk/tools/RosTE/GUI/Properties/Resources.Designer.cs
    trunk/tools/RosTE/GUI/RosTEGUI.csproj
    trunk/tools/RosTE/GUI/SettingsForm.cs
    trunk/tools/RosTE/GUI/VMConfig.xsx
    trunk/tools/RosTE/GUI/VirtualMachine.cs
    trunk/tools/RosTE/GUI/qemu.cs

Added: trunk/tools/RosTE/GUI/ConfigHandler.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosTE/GUI/ConfigHandler.cs?rev=31980&view=auto
==============================================================================
--- trunk/tools/RosTE/GUI/ConfigHandler.cs (added)
+++ trunk/tools/RosTE/GUI/ConfigHandler.cs Fri Jan 25 00:33:58 2008
@@ -1,0 +1,384 @@
+using System;
+using System.Data;
+using System.IO;
+using System.Xml;
+using System.Windows.Forms;
+using System.Collections.Generic;
+
+namespace RosTEGUI
+{
+    public struct VirtMach
+    {
+        public int id;
+        public string path;
+
+        public VirtMach(int idIn, string pathIn)
+        {
+            id = idIn;
+            path = pathIn;
+        }
+    }
+
+    public class MainConfig
+    {
+        private VMConfig vmConfig = null;
+        private DataSet dataSet = null;
+
+        private string qemuPath;
+        private string vdkPath;
+        private string defVmPath;
+        private int updateSched;
+        private bool appDebug;
+
+        List<VirtMach> virtMachs = null;
+
+        #region properties
+        public string QemuPath
+        {
+            get { return qemuPath; }
+            set { qemuPath = value; }
+        }
+
+        public string VdkPath
+        {
+            get { return vdkPath; }
+            set { vdkPath = value; }
+        }
+
+        public string DefVmPath
+        {
+            get { return defVmPath; }
+            set { defVmPath = value; }
+        }
+
+        public int UpdateSched
+        {
+            get { return updateSched; }
+            set { updateSched = value; }
+        }
+
+        public bool AppDebug
+        {
+            get { return appDebug; }
+            set { appDebug = value; }
+        }
+        #endregion
+
+        #region virtmach element
+        public string GetExistingImage(int index)
+        {
+            foreach (VirtMach vm in virtMachs)
+            {
+                if (vm.id == index)
+                    return vm.path;
+            }
+
+            return null;
+        }
+
+        private bool LoadVirtMachs()
+        {
+            bool bRet = false;
+
+            if (dataSet != null)
+            {
+                if (virtMachs == null)
+                {
+                    virtMachs = new List<VirtMach>();
+                }
+
+                try
+                {
+                    foreach (DataRow dr in dataSet.Tables["VirtMach"].Rows)
+                    {
+                        virtMachs.Add(new VirtMach((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 (VirtMach 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 + 1;
+                virtMachs.Add(new VirtMach(id, pathIn));
+            }
+
+            return virtMachs.Count;
+        }
+
+        public void DeleteVirtMach(int index)
+        {
+            bool bRet = false;
+
+            foreach (VirtMach vm in virtMachs)
+            {
+                if (vm.id == index)
+                {
+                    virtMachs.Remove(vm);
+                    bRet = true;
+                }
+            }
+        }
+
+        public int GetNumberOfVms()
+        {
+            return virtMachs.Count;
+        }
+        #endregion
+
+        #region settings element
+        public void CreateSettings()
+        {
+            if (dataSet != null)
+            {
+                DataTable settingsTable;
+                DataRow settingsRow;
+
+                try
+                {
+                    settingsTable = dataSet.Tables["Settings"];
+
+                    if (settingsTable.Rows.Count == 0)
+                    {
+                        settingsRow = settingsTable.NewRow();
+                    }
+                    else
+                    {
+                        settingsRow = settingsTable.Rows[0];
+                    }
+
+                    // FIXME: these should be assigned by the installer
+                    settingsRow["QemuPath"] = @"C:\Program Files\RosTE\QEmu";
+                    settingsRow["VdkPath"] = @"C:\Program Files\RosTE\VDK";
+                    settingsRow["DefVmPath"] = @"C:\Program Files\RosTE\Images";
+                    settingsRow["UpdateSched"] = 3;
+                    settingsRow["AppDebug"] = false;
+
+                    settingsTable.Rows.Add(settingsRow);
+                }
+                catch (Exception ex)
+                {
+                    Debug.LogMessage("failed to create new settings", ex.Message, ex.StackTrace, true);
+                }
+            }
+        }
+        
+        public bool LoadSettings()
+        {
+            bool bRet = false;
+
+            if (dataSet != null)
+            {
+                try
+                {
+                    DataRow settingsRow = dataSet.Tables["Settings"].Rows[0];
+
+                    qemuPath = (string)settingsRow["QemuPath"];
+                    vdkPath = (string)settingsRow["VdkPath"];
+                    defVmPath = (string)settingsRow["DefVmPath"];
+                    updateSched = (int)settingsRow["UpdateSched"];
+                    appDebug = (bool)settingsRow["AppDebug"];
+
+                    bRet = LoadVirtMachs();
+                }
+                catch (Exception ex)
+                {
+                    Debug.LogMessage("Failed to read settings from mainConf dataset", ex.Message);
+                }
+            }
+
+            return bRet;
+        }
+
+        public void SaveSettings()
+        {
+            if (dataSet != null)
+            {
+                try
+                {
+                    DataRow settingsRow = dataSet.Tables["Settings"].Rows[0];
+                    settingsRow["QemuPath"] = qemuPath;
+                    settingsRow["VdkPath"] = vdkPath;
+                    settingsRow["DefVmPath"] = defVmPath;
+                    settingsRow["UpdateSched"] = updateSched;
+                    settingsRow["AppDebug"] = appDebug;
+                }
+                catch (Exception ex)
+                {
+                    Debug.LogMessage("Failed to read settings from mainConf dataset", ex.Message);
+                }
+            }
+        }
+        #endregion
+
+        public bool LoadMainConfig()
+        {
+            XmlTextReader xtr = null;
+            string fileName = "Config.xml";
+            bool ret = false;
+
+            if (LoadMainSchema())
+            {
+                if (File.Exists(fileName))
+                {
+                    try
+                    {
+                        FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+                        xtr = new XmlTextReader(fs);
+                        dataSet.ReadXml(xtr, System.Data.XmlReadMode.ReadSchema);
+                        ret = true;
+                    }
+                    catch (Exception ex)
+                    {
+                        Debug.LogMessage("Failed to load main config file", ex.Message, ex.StackTrace, true);
+                    }
+                    finally
+                    {
+                        if (xtr != null)
+                            xtr.Close();
+                    }
+                }
+            }
+
+            return ret;
+        }
+
+        public void SaveMainConfig()
+        {
+            XmlTextWriter xtw = null;
+            string fileName = "Config.xml";
+
+            if (dataSet == null)
+            {
+                if (!LoadMainSchema())
+                    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();
+            }
+        }
+
+        #region private methods
+        private bool LoadMainSchema()
+        {
+            string filename = "MainConfig.xsd";
+            bool ret = false;
+
+            dataSet = new DataSet();
+            if (File.Exists(filename))
+            {
+                try
+                {
+                    FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);
+                    XmlTextReader xtr = new XmlTextReader(fs);
+                    dataSet.ReadXmlSchema(xtr);
+                    xtr.Close();
+                    ret = true;
+                }
+                catch (Exception ex)
+                {
+                    Debug.LogMessage("error loading main config schema", ex.Message, ex.StackTrace, true);
+                }
+            }
+
+            return ret;
+        }
+        #endregion
+    }
+
+
+
+    public class VMConfig
+    {
+        private DataSet data = null;
+
+        public DataSet DataSet
+        {
+            get { return data; }
+        }
+
+        /// <summary>
+        /// Load the schema for the virtual machine configuration file
+        /// </summary>
+        /// <returns>True on success, false on failure</returns>
+        public bool LoadVirtMachData()
+        {
+            XmlTextReader xtr = null;
+            string filename = "VMConfig.xsd";
+            bool ret = false;
+
+            data = new DataSet();
+            if (File.Exists(filename))
+            {
+                try
+                {
+                    FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);
+                    xtr = new XmlTextReader(fs);
+                    data.ReadXmlSchema(xtr);
+                    ret = true;
+                }
+                catch (Exception ex)
+                {
+                    Debug.LogMessage("error loading VM config schema", ex.Message, ex.StackTrace, true);
+                }
+                finally
+                {
+                    if (xtr != null)
+                        xtr.Close();
+                }
+            }
+
+            return ret;
+        }
+    }
+}

Modified: trunk/tools/RosTE/GUI/ConsoleSettings.Designer.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosTE/GUI/ConsoleSettings.Designer.cs?rev=31980&r1=31979&r2=31980&view=diff
==============================================================================
--- trunk/tools/RosTE/GUI/ConsoleSettings.Designer.cs (original)
+++ trunk/tools/RosTE/GUI/ConsoleSettings.Designer.cs Fri Jan 25 00:33:58 2008
@@ -99,6 +99,7 @@
             this.conUpdateNow.TabIndex = 1;
             this.conUpdateNow.Text = "Check now";
             this.conUpdateNow.UseVisualStyleBackColor = true;
+            this.conUpdateNow.Click += new System.EventHandler(this.checkupdate_click);
             // 
             // conUpdateCombo
             // 
@@ -145,7 +146,7 @@
             this.button5.TabIndex = 1;
             this.button5.Text = "Browse...";
             this.button5.UseVisualStyleBackColor = true;
-            this.button5.Click += new System.EventHandler(this.button5_Click);
+            this.button5.Click += new System.EventHandler(this.vmloc_click);
             // 
             // conDefVmLoc
             // 
@@ -173,7 +174,7 @@
             this.button4.TabIndex = 1;
             this.button4.Text = "Browse...";
             this.button4.UseVisualStyleBackColor = true;
-            this.button4.Click += new System.EventHandler(this.button4_Click);
+            this.button4.Click += new System.EventHandler(this.vdkloc_click);
             // 
             // conVdkLoc
             // 
@@ -201,7 +202,7 @@
             this.button3.TabIndex = 1;
             this.button3.Text = "Browse...";
             this.button3.UseVisualStyleBackColor = true;
-            this.button3.Click += new System.EventHandler(this.button3_Click);
+            this.button3.Click += new System.EventHandler(this.qemuloc_click);
             // 
             // conQemuLoc
             // 
@@ -229,6 +230,7 @@
             this.conAppDebug.TabIndex = 0;
             this.conAppDebug.Text = "Turn on application debugging";
             this.conAppDebug.UseVisualStyleBackColor = true;
+            this.conAppDebug.CheckedChanged += new System.EventHandler(this.conAppDebug_CheckedChanged);
             // 
             // conDialogOK
             // 

Modified: trunk/tools/RosTE/GUI/ConsoleSettings.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosTE/GUI/ConsoleSettings.cs?rev=31980&r1=31979&r2=31980&view=diff
==============================================================================
--- trunk/tools/RosTE/GUI/ConsoleSettings.cs (original)
+++ trunk/tools/RosTE/GUI/ConsoleSettings.cs Fri Jan 25 00:33:58 2008
@@ -11,6 +11,7 @@
 {
     public partial class ConsoleSettings : Form
     {
+        #region properties
         public string QemuPath
         {
             get { return conQemuLoc.Text; }
@@ -35,6 +36,7 @@
         {
             get { return conAppDebug.Checked; }
         }
+        #endregion
 
         public ConsoleSettings(MainConfig mainConf)
         {
@@ -52,19 +54,19 @@
             conAppDebug.Checked = mainConf.AppDebug;
         }
 
-        private void button3_Click(object sender, EventArgs e)
+        private void qemuloc_click(object sender, EventArgs e)
         {
             if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
                 conQemuLoc.Text = folderBrowserDialog.SelectedPath;
         }
 
-        private void button4_Click(object sender, EventArgs e)
+        private void vdkloc_click(object sender, EventArgs e)
         {
             if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
                 conVdkLoc.Text = folderBrowserDialog.SelectedPath;
         }
 
-        private void button5_Click(object sender, EventArgs e)
+        private void vmloc_click(object sender, EventArgs e)
         {
             if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
                 conDefVmLoc.Text = folderBrowserDialog.SelectedPath;
@@ -93,5 +95,19 @@
             this.DialogResult = DialogResult.OK;
         }
 
+        private void conAppDebug_CheckedChanged(object sender, EventArgs e)
+        {
+            CheckBox cb = (CheckBox)sender;
+
+            if (cb.Checked)
+                Debug.TurnDebuggingOn();
+            else
+                Debug.TurnDebuggingOff();
+        }
+
+        private void checkupdate_click(object sender, EventArgs e)
+        {
+            MessageBox.Show("Updates are not yet implemented");
+        }
     }
 }

Modified: trunk/tools/RosTE/GUI/MainConfig.xsx
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosTE/GUI/MainConfig.xsx?rev=31980&r1=31979&r2=31980&view=diff
==============================================================================
--- trunk/tools/RosTE/GUI/MainConfig.xsx (original)
+++ trunk/tools/RosTE/GUI/MainConfig.xsx Fri Jan 25 00:33:58 2008
@@ -1,6 +1,6 @@
 <?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="0" viewPortTop="-4677" zoom="100">
-    <VirtMach_XmlElement left="8520" top="-3095" width="4842" height="1984" selected="0" zOrder="0" index="0" expanded="1" />
-    <Settings_XmlElement left="2461" top="-3148" width="5291" height="3254" selected="0" zOrder="1" index="1" expanded="1" />
+    <VirtMach_XmlElement left="8519" top="-3096" width="5371" height="2196" selected="0" zOrder="2" index="0" expanded="1" />
+    <Settings_XmlElement left="2461" top="-3149" width="5291" height="3625" selected="0" zOrder="1" index="1" expanded="1" />
 </XSDDesignerLayout>

Modified: trunk/tools/RosTE/GUI/MainForm.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosTE/GUI/MainForm.cs?rev=31980&r1=31979&r2=31980&view=diff
==============================================================================
--- trunk/tools/RosTE/GUI/MainForm.cs (original)
+++ trunk/tools/RosTE/GUI/MainForm.cs Fri Jan 25 00:33:58 2008
@@ -14,7 +14,7 @@
 	public partial class MainForm : Form
     {
         private MainConfig mainConf;
-        private Data mainData;
+        private VMConfig mainData;
 
         public MainForm()
         {
@@ -53,32 +53,24 @@
 
         private void MainForm_Load(object sender, EventArgs e)
         {
-            mainData = new Data();
-            if (!mainData.LoadMainData())
-                MessageBox.Show("Failed to load Main Schema");
-
-            mainConf = new MainConfig(mainData);
-
-            // load config and load any existing vm's
+            mainConf = new MainConfig();
             if (mainConf.LoadMainConfig())
             {
                 mainConf.LoadSettings();
                 LoadVirtualMachines(mainConf);
             }
-            else // create settings for first run
-            {
+            else
+            {
+                // create settings for first run
                 mainConf.CreateSettings();
             }
-
-            string str = mainConf.QemuPath;
-
         }
 
         private void MainMenuHelpAbout_Click(object sender, EventArgs e)
         {
             AboutForm dlg = new AboutForm();
             dlg.StartPosition = FormStartPosition.CenterScreen;
-            dlg.Show();
+            dlg.ShowDialog();
         }
 
         private void ImageListView_DoubleClick(object sender, EventArgs e)
@@ -166,7 +158,7 @@
                         {
                             Directory.Delete(vm.DefDir, true);
                         }
-                        catch (DirectoryNotFoundException ex)
+                        catch (DirectoryNotFoundException)
                         {
                             MessageBox.Show(vm.DefDir + " has was not found!",
                                             "error",
@@ -183,13 +175,14 @@
 
         private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
         {
-            mainConf.SaveMainConfig();
-
             foreach(ListViewItem lvi in VirtMachListView.Items)
             {
                 VirtualMachine vm = (VirtualMachine)lvi.Tag;
                 vm.SaveVMConfig();
             }
+
+            mainConf.SaveSettings();
+            mainConf.SaveMainConfig();
         }
 
         private void changeSettingsToolStripMenuItem_Click(object sender, EventArgs e)

Modified: trunk/tools/RosTE/GUI/Properties/Resources.Designer.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosTE/GUI/Properties/Resources.Designer.cs?rev=31980&r1=31979&r2=31980&view=diff
==============================================================================
--- trunk/tools/RosTE/GUI/Properties/Resources.Designer.cs (original)
+++ trunk/tools/RosTE/GUI/Properties/Resources.Designer.cs Fri Jan 25 00:33:58 2008
@@ -1,7 +1,7 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
-//     Runtime Version:2.0.50727.42
+//     Runtime Version:2.0.50727.312
 //
 //     Changes to this file may cause incorrect behavior and will be lost if
 //     the code is regenerated.

Modified: trunk/tools/RosTE/GUI/RosTEGUI.csproj
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosTE/GUI/RosTEGUI.csproj?rev=31980&r1=31979&r2=31980&view=diff
==============================================================================
--- trunk/tools/RosTE/GUI/RosTEGUI.csproj (original)
+++ trunk/tools/RosTE/GUI/RosTEGUI.csproj Fri Jan 25 00:33:58 2008
@@ -120,6 +120,7 @@
     <Compile Include="AboutForm.Designer.cs">
       <DependentUpon>AboutForm.cs</DependentUpon>
     </Compile>
+    <Compile Include="ConfigHandler.cs" />
     <Compile Include="ConsoleSettings.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -132,14 +133,11 @@
     <Compile Include="DeleteVM.Designer.cs">
       <DependentUpon>DeleteVM.cs</DependentUpon>
     </Compile>
-    <Compile Include="ErrorForm.cs">
-      <SubType>Form</SubType>
-    </Compile>
-    <Compile Include="ErrorForm.Designer.cs">
-      <DependentUpon>ErrorForm.cs</DependentUpon>
-    </Compile>
-    <Compile Include="MainConfig.cs">
-      <DependentUpon>MainConfig.xsd</DependentUpon>
+    <Compile Include="DebugForm.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="DebugForm.Designer.cs">
+      <DependentUpon>DebugForm.cs</DependentUpon>
     </Compile>
     <Compile Include="MainForm.cs">
       <SubType>Form</SubType>
@@ -185,7 +183,6 @@
     </Compile>
     <Compile Include="VirtualMachine.cs">
     </Compile>
-    <Compile Include="VMDataBase.cs" />
     <Compile Include="Wizard\Header.cs">
       <SubType>UserControl</SubType>
     </Compile>
@@ -238,9 +235,9 @@
       <SubType>Designer</SubType>
       <DependentUpon>DeleteVM.cs</DependentUpon>
     </EmbeddedResource>
-    <EmbeddedResource Include="ErrorForm.resx">
-      <SubType>Designer</SubType>
-      <DependentUpon>ErrorForm.cs</DependentUpon>
+    <EmbeddedResource Include="DebugForm.resx">
+      <SubType>Designer</SubType>
+      <DependentUpon>DebugForm.cs</DependentUpon>
     </EmbeddedResource>
     <EmbeddedResource Include="NewHardDiskForm.resx">
       <SubType>Designer</SubType>

Modified: trunk/tools/RosTE/GUI/SettingsForm.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosTE/GUI/SettingsForm.cs?rev=31980&r1=31979&r2=31980&view=diff
==============================================================================
--- trunk/tools/RosTE/GUI/SettingsForm.cs (original)
+++ trunk/tools/RosTE/GUI/SettingsForm.cs Fri Jan 25 00:33:58 2008
@@ -110,8 +110,8 @@
             floppyEnableChkBox.Checked = VirtMach.FloppyEnable;
 
             int id = floppyPhyDrvCombo.FindString(VirtMach.FloppyPhysDrv);
-            if (id == -1) id = 0;
-            floppyPhyDrvCombo.SelectedIndex = id;
+            if (id != -1)
+                floppyPhyDrvCombo.SelectedIndex = id;
 
             if (VirtMach.CdRomUsePhys)
             {
@@ -237,7 +237,7 @@
         {
             TrackBar tb = (TrackBar)sender;
             memoryUpDwn.Value = tb.Value;
-            
+            /*
             char[] chars = { ' ', 'M', 'B' };
             string max = memoryRecMax.Text.TrimEnd(chars);
             string min = memoryRecMin.Text.TrimEnd(chars);
@@ -255,7 +255,7 @@
             {
                 memoryRecMin.ForeColor = SystemColors.WindowText;
                 memoryRecMax.ForeColor = SystemColors.WindowText;
-            }
+            }*/
         }
 
         private void memoryUpDwn_ValueChanged(object sender, EventArgs e)

Modified: trunk/tools/RosTE/GUI/VMConfig.xsx
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosTE/GUI/VMConfig.xsx?rev=31980&r1=31979&r2=31980&view=diff
==============================================================================
--- trunk/tools/RosTE/GUI/VMConfig.xsx (original)
+++ trunk/tools/RosTE/GUI/VMConfig.xsx Fri Jan 25 00:33:58 2008
@@ -1,7 +1,7 @@
 <?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="-842" viewPortTop="-6097" zoom="100">
-    <VMConfig_XmlElement left="5159" top="-3175" width="7859" height="7911" selected="0" zOrder="1" index="0" expanded="1" />
-    <HardDisks_XmlElement left="-450" top="-3228" width="5292" height="3678" selected="0" zOrder="2" index="1" expanded="1" />
-    <NetCards_XmlElement left="13547" top="-3175" width="5292" height="4101" selected="0" zOrder="3" index="2" expanded="1" />
+    <VMConfig_XmlElement left="5159" top="-3175" width="7858" height="8864" selected="0" zOrder="1" index="0" expanded="1" />
+    <HardDisks_XmlElement left="-450" top="-3228" width="5292" height="4101" selected="0" zOrder="2" index="1" expanded="1" />
+    <NetCards_XmlElement left="13546" top="-3175" width="5292" height="4577" selected="0" zOrder="4" index="2" expanded="1" />
 </XSDDesignerLayout>

Modified: trunk/tools/RosTE/GUI/VirtualMachine.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosTE/GUI/VirtualMachine.cs?rev=31980&r1=31979&r2=31980&view=diff
==============================================================================
--- trunk/tools/RosTE/GUI/VirtualMachine.cs (original)
+++ trunk/tools/RosTE/GUI/VirtualMachine.cs Fri Jan 25 00:33:58 2008
@@ -10,7 +10,7 @@
 {
     public class VMHardDrive
     {
-        private Data data;
+        private VMConfig vmConfig;
         private DataRow hdDataRow;
 
         #region properties
@@ -48,9 +48,9 @@
             set { hdDataRow["BootImg"] = value; }
         }
 
-        public VMHardDrive(Data dataIn)
-        {
-            data = dataIn;
+        public VMHardDrive(VMConfig vmConfigIn)
+        {
+            vmConfig = vmConfigIn;
         }
 
         #endregion
@@ -70,7 +70,7 @@
 
             try
             {
-                DataTable hddt = data.DataSet.Tables["HardDisks"];
+                DataTable hddt = vmConfig.DataSet.Tables["HardDisks"];
                 hdDataRow = hddt.NewRow();
                 hdDataRow["DiskID"] = hddt.Rows.Count;
                 hdDataRow["Name"] = nameIn;
@@ -85,8 +85,7 @@
             catch (Exception e)
             {
                 string message = "Failed to populate hard disk database";
-                ErrorForm err = new ErrorForm(message, e.Message, e.StackTrace);
-                err.ShowDialog();
+                Debug.LogMessage(message, e.Message, e.StackTrace, true);
             }
 
             return ret;
@@ -94,7 +93,7 @@
 
         public void DeleteHardDrive(int diskID)
         {
-            DataTable dt = data.DataSet.Tables["HardDisks"];
+            DataTable dt = vmConfig.DataSet.Tables["HardDisks"];
             //DataRow dr = dt.Rows.Find(diskID); <-- can't seem to apply a primary key??
             // workaround for the above
             foreach (DataRow dr in dt.Rows)
@@ -110,14 +109,14 @@
 
         public void LoadHardDrive(int index)
         {
-            DataTable hddt = data.DataSet.Tables["HardDisks"];
+            DataTable hddt = vmConfig.DataSet.Tables["HardDisks"];
             hdDataRow = hddt.Rows[index];
         }
     }
 
     public class VirtualMachine
     {
-        private Data data;
+        private VMConfig vmConfig;
         private DataRow vmDataRow;
         private ArrayList hardDrives;
         private ArrayList netCards;
@@ -232,8 +231,7 @@
             catch (ArgumentException e)
             {
                 string message = "Failed to get " + key + " value";
-                ErrorForm err = new ErrorForm(message, e.Message, e.StackTrace);
-                err.ShowDialog();
+                Debug.LogMessage(message, e.Message, e.StackTrace, true);
                 return 0;
             }
         }
@@ -247,8 +245,7 @@
             catch (ArgumentException e)
             {
                 string message = "Failed to get " + key + " value";
-                ErrorForm err = new ErrorForm(message, e.Message, e.StackTrace);
-                err.ShowDialog();
+                Debug.LogMessage(message, e.Message, e.StackTrace, true);
                 return false;
             }
         }
@@ -262,8 +259,7 @@
             catch (ArgumentException e)
             {
                 string message = "Failed to get " + key + " value";
-                ErrorForm err = new ErrorForm(message, e.Message, e.StackTrace);
-                err.ShowDialog();
+                Debug.LogMessage(message, e.Message, e.StackTrace, true);
                 return string.Empty;
             }
         }
@@ -277,8 +273,7 @@
             catch (ArgumentException e)
             {
                 string message = "Failed to set " + key + " value";
-                ErrorForm err = new ErrorForm(message, e.Message, e.StackTrace);
-                err.ShowDialog();
+                Debug.LogMessage(message, e.Message, e.StackTrace, true);
             }
         }
 
@@ -291,8 +286,7 @@
             catch (ArgumentException e)
             {
                 string message = "Failed to set " + key + " value";
-                ErrorForm err = new ErrorForm(message, e.Message, e.StackTrace);
-                err.ShowDialog();
+                Debug.LogMessage(message, e.Message, e.StackTrace, true);
             }
         }
 
@@ -305,8 +299,7 @@
             catch (ArgumentException e)
             {
                 string message = "Failed to set " + key + " value";
-                ErrorForm err = new ErrorForm(message, e.Message, e.StackTrace);
-                err.ShowDialog();
+                Debug.LogMessage(message, e.Message, e.StackTrace, true);
             }
         }
 
@@ -325,7 +318,7 @@
 
             try
             {
-                DataTable vmdt = data.DataSet.Tables["VMConfig"];
+                DataTable vmdt = vmConfig.DataSet.Tables["VMConfig"];
                 vmDataRow = vmdt.NewRow();
                 vmDataRow["VirtMachID"] = vmdt.Rows.Count + 1;
                 vmDataRow["Name"] = name;
@@ -345,11 +338,11 @@
                 vmDataRow["FloppyIsoImg"] = string.Empty;
                 vmdt.Rows.Add(vmDataRow);
 
-                VMHardDrive vmhd = new VMHardDrive(data);
+                VMHardDrive vmhd = new VMHardDrive(vmConfig);
                 vmhd.CreateHardDrive("Main Drive", "hda", dir, 768, true);
                 hardDrives.Add(vmhd);
 
-                DataTable netdt = data.DataSet.Tables["NetCards"];
+                DataTable netdt = vmConfig.DataSet.Tables["NetCards"];
                 netDataRow = netdt.NewRow();
                 netDataRow["CardID"] = netdt.Rows.Count + 1;
                 netDataRow["VirtMachID"] = vmDataRow["VirtMachID"];
@@ -366,8 +359,7 @@
             catch (Exception e)
             {
                 string message = "Failed to populate database";
-                ErrorForm err = new ErrorForm(message, e.Message, e.StackTrace);
-                err.ShowDialog();
+                Debug.LogMessage(message, e.Message, e.StackTrace, true);
             }
 
             return ret;
@@ -384,21 +376,21 @@
                 {
                     FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
                     XmlTextReader xtr = new XmlTextReader(fs);
-                    data.DataSet.ReadXml(xtr, System.Data.XmlReadMode.ReadSchema);
+                    vmConfig.DataSet.ReadXml(xtr, System.Data.XmlReadMode.ReadSchema);
                     xtr.Close();
 
-                    DataTable vmdt = data.DataSet.Tables["VMConfig"];
+                    DataTable vmdt = vmConfig.DataSet.Tables["VMConfig"];
                     vmDataRow = vmdt.Rows[0];
 
-                    DataTable hddt = data.DataSet.Tables["HardDisks"];
+                    DataTable hddt = vmConfig.DataSet.Tables["HardDisks"];
                     for (int i = 0; i < hddt.Rows.Count; i++)
                     {
-                        VMHardDrive vmhd = new VMHardDrive(data);
+                        VMHardDrive vmhd = new VMHardDrive(vmConfig);
                         vmhd.LoadHardDrive(i);
                         hardDrives.Add(vmhd);
                     }
 
-                    DataTable netdt = data.DataSet.Tables["NetCards"];
+                    DataTable netdt = vmConfig.DataSet.Tables["NetCards"];
                     foreach (DataRow dr in netdt.Rows)
                         netCards.Add(dr);
 
@@ -421,7 +413,7 @@
                 Directory.CreateDirectory(DefDir);
                 FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write);
                 XmlTextWriter xtw = new XmlTextWriter(fs, System.Text.Encoding.Unicode);
-                data.DataSet.WriteXml(xtw, System.Data.XmlWriteMode.WriteSchema);
+                vmConfig.DataSet.WriteXml(xtw, System.Data.XmlWriteMode.WriteSchema);
                 xtw.Close();
             }
             catch (Exception e)
@@ -435,8 +427,8 @@
 
         public VirtualMachine()
         {
-            data = new Data();
-            if (!data.LoadVirtMachData())
+            vmConfig = new VMConfig();
+            if (!vmConfig.LoadVirtMachData())
                 MessageBox.Show("Failed to load VM Schema");
 
             hardDrives = new ArrayList(3);
@@ -498,7 +490,7 @@
                                        int sizeIn,
                                        bool bootImgIn)
         {
-            VMHardDrive vmhd = new VMHardDrive(data);
+            VMHardDrive vmhd = new VMHardDrive(vmConfig);
             if (vmhd.CreateHardDrive(nameIn, driveIn, pathIn, sizeIn, bootImgIn))
             {
                 hardDrives.Add(vmhd);

Modified: trunk/tools/RosTE/GUI/qemu.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosTE/GUI/qemu.cs?rev=31980&r1=31979&r2=31980&view=diff
==============================================================================
--- trunk/tools/RosTE/GUI/qemu.cs (original)
+++ trunk/tools/RosTE/GUI/qemu.cs Fri Jan 25 00:33:58 2008
@@ -12,8 +12,34 @@
 
 namespace RosTEGUI
 {
-    public class qemu
+    public class Qemu
+    {
+        public enum Platforms
+        {
+            x86 = 0,
+            x86_ISA = 1,
+            x64 = 2,
+            x64_ISA = 3,
+            ARM_integratorcp926 = 4,
+            ARM_integratorcp1026 = 5,
+            ARM_versatilepb = 6,
+            ARM_versatileab = 7,
+            PPC_g3bw = 8,
+            PPC_mac99 = 9,
+            PPC_prep = 10,
+            Sparc_sun4m = 11
+        }
+
+        public Qemu()
+        {
+        }
+
+    }
+
+    public class QemuImg
     {
 
     }
+
+
 }




More information about the Ros-diffs mailing list