Author: cwittich Date: Wed Jun 21 21:36:39 2006 New Revision: 22475
URL: http://svn.reactos.ru/svn/reactos?rev=22475&view=rev Log: -added Platforms enum to prevent comparing strings
Modified: trunk/tools/Qemu GUI/QEmu.cs trunk/tools/Qemu GUI/Qemu GUI.suo trunk/tools/Qemu GUI/frmMain.cs
Modified: trunk/tools/Qemu GUI/QEmu.cs URL: http://svn.reactos.ru/svn/reactos/trunk/tools/Qemu%20GUI/QEmu.cs?rev=22475&a... ============================================================================== --- trunk/tools/Qemu GUI/QEmu.cs (original) +++ trunk/tools/Qemu GUI/QEmu.cs Wed Jun 21 21:36:39 2006 @@ -9,9 +9,20 @@ namespace Qemu_GUI {
+ public enum Platforms + { + x86 = 0, + x86_ISA, + x64, + x64_ISA + } + [XmlRoot("Settings")] public class QEmu : IDisposable { + + + private Misc m_Misc = new Misc(); private Floppies m_Floppies = new Floppies(); private Harddisks m_Harddisks = new Harddisks(); @@ -60,19 +71,26 @@ return m_LastError; }
- public bool Start(string platfrom) + public bool Start(Platforms Platform) { Process p = new Process();
- if (platfrom == "Standard PC 32Bit") - p.StartInfo.FileName = this.Paths.QEmu + "\qemu.exe"; - if (platfrom == "Standard PC 64Bit") - p.StartInfo.FileName = this.Paths.QEmu + "\qemu-system-x86_64.exe"; - if (platfrom == "ISA only PC 32Bit") - p.StartInfo.FileName = this.Paths.QEmu + "\qemu.exe"; - if (platfrom == "ISA only PC 64Bit") - p.StartInfo.FileName = this.Paths.QEmu + "\qemu-system-x86_64.exe"; - + switch (Platform) + { + case Platforms.x86: + p.StartInfo.FileName = this.Paths.QEmu + "\qemu.exe"; + break; + case Platforms.x86_ISA: + p.StartInfo.FileName = this.Paths.QEmu + "\qemu-system-x86_64.exe"; + break; + case Platforms.x64: + p.StartInfo.FileName = this.Paths.QEmu + "\qemu.exe"; + break; + case Platforms.x64_ISA: + p.StartInfo.FileName = this.Paths.QEmu + "\qemu-system-x86_64.exe"; + break; + } + p.StartInfo.WorkingDirectory = this.Paths.QEmu; p.StartInfo.Arguments = GetArgv(); p.StartInfo.RedirectStandardError = true; @@ -179,7 +197,6 @@ { if (this.HDD[i].Enabled && (this.HDD[i].Path.Length > 0)) buffer += "-hd" + Convert.ToChar('a' + i) + " "" + this.HDD[i].Path + "" "; - } return buffer; } @@ -254,7 +271,7 @@ public class Misc { [XmlElement("Machine")] - public string Machine; + public Platforms Machine; [XmlElement("Memory")] public int Memory; [XmlElement("CPUs")] @@ -295,15 +312,21 @@ buffer += "-no-kqemu ";
/* Machine settings */ - if (this.Machine == "Standard PC 32Bits") - buffer += "-M pc "; - if (this.Machine == "Standard PC 64Bits") - buffer += "-M pc "; - if (this.Machine == "ISA only PC 32Bits") - buffer += "-M isapc "; - if (this.Machine == "ISA only PC 64Bits") - buffer += "-M isapc "; - + switch (this.Machine) + { + case Platforms.x86: + buffer += "-M pc "; + break; + case Platforms.x86_ISA: + buffer += "-M isapc "; + break; + case Platforms.x64: + buffer += "-M pc "; + break; + case Platforms.x64_ISA: + buffer += "-M isapc "; + break; + }
/* Boot options */ switch (this.BootFrom)
Modified: trunk/tools/Qemu GUI/Qemu GUI.suo URL: http://svn.reactos.ru/svn/reactos/trunk/tools/Qemu%20GUI/Qemu%20GUI.suo?rev=... ============================================================================== Binary files - no diff available.
Modified: trunk/tools/Qemu GUI/frmMain.cs URL: http://svn.reactos.ru/svn/reactos/trunk/tools/Qemu%20GUI/frmMain.cs?rev=2247... ============================================================================== --- trunk/tools/Qemu GUI/frmMain.cs (original) +++ trunk/tools/Qemu GUI/frmMain.cs Wed Jun 21 21:36:39 2006 @@ -319,12 +319,13 @@ // cboMachine // this.cboMachine.DisplayMember = "1"; + this.cboMachine.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cboMachine.FormattingEnabled = true; this.cboMachine.Items.AddRange(new object[] { - "Standard PC 32Bits", - "ISA only PC 32Bits", - "Standard PC 64Bits", - "ISA only PC 64Bits"}); + "Standard PC 32Bit", + "ISA only PC 32Bit", + "Standard PC 64Bit", + "ISA only PC 64Bit"}); this.cboMachine.Location = new System.Drawing.Point(19, 19); this.cboMachine.Name = "cboMachine"; this.cboMachine.Size = new System.Drawing.Size(239, 21); @@ -1660,7 +1661,7 @@ private void btnLaunch_Click(object sender, System.EventArgs e) { SaveSettings(); - if (!qemu.Start(cboMachine.SelectedItem.ToString())) + if (!qemu.Start((Platforms)cboMachine.SelectedIndex)) { frmError fError = new frmError(); fError.txtError.Text = qemu.GetLastError(); @@ -1817,7 +1818,7 @@ private void LoadSettings() { /* Misc */ - cboMachine.Text = qemu.Misc.Machine; + cboMachine.SelectedIndex = (int) qemu.Misc.Machine; numMemory.Value = qemu.Misc.Memory; numSMP.Value = qemu.Misc.CPUs; cboBootFrom.Text = qemu.Misc.BootFrom; @@ -1871,7 +1872,7 @@ private void SaveSettings() { /* Misc */ - qemu.Misc.Machine = cboMachine.SelectedText; + qemu.Misc.Machine = (Platforms) cboMachine.SelectedIndex; qemu.Misc.Memory = (int) numMemory.Value; qemu.Misc.CPUs = (int) numSMP.Value; qemu.Misc.BootFrom = cboBootFrom.Text;