[ros-diffs] [gedmurphy] 26694: - fix possible exceptions for incorrect paths - set Main as STA to allow debuging

gedmurphy at svn.reactos.org gedmurphy at svn.reactos.org
Fri May 11 13:18:21 CEST 2007


Author: gedmurphy
Date: Fri May 11 15:18:21 2007
New Revision: 26694

URL: http://svn.reactos.org/svn/reactos?rev=26694&view=rev
Log:
- fix possible exceptions for incorrect paths
- set Main as STA to allow debuging

Modified:
    trunk/tools/Qemu GUI/Runner.cs
    trunk/tools/Qemu GUI/program.cs

Modified: trunk/tools/Qemu GUI/Runner.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/Qemu%20GUI/Runner.cs?rev=26694&r1=26693&r2=26694&view=diff
==============================================================================
--- trunk/tools/Qemu GUI/Runner.cs (original)
+++ trunk/tools/Qemu GUI/Runner.cs Fri May 11 15:18:21 2007
@@ -117,22 +117,29 @@
             string argv = " create -f " + Format + " \"" + FileName + "\" " + d.ToString();
 
             p.StartInfo.FileName = data.Paths.Qemu + "\\qemu-img.exe";
-            p.StartInfo.WorkingDirectory = data.Paths.Qemu;
-            p.StartInfo.Arguments = argv;
-            try
-            {
-                p.Start();
-            }
-            catch(Exception e)
-            {
-                ErrBuffer += Environment.NewLine + "Error: " + e.Message;
-                ErrorForm error = new ErrorForm();
-                error.txtError.Text = ErrBuffer;
-                error.txtError.Text += p.StandardError.ReadToEnd();
-                error.ShowDialog();
-                return false;
-            }
-            return true;
+            if (Directory.Exists(data.Paths.Qemu))
+            {
+                p.StartInfo.WorkingDirectory = data.Paths.Qemu;
+                p.StartInfo.Arguments = argv;
+                try
+                {
+                    p.Start();
+                }
+                catch (Exception e)
+                {
+                    ErrBuffer += Environment.NewLine + "Error: " + e.Message;
+                    ErrorForm error = new ErrorForm();
+                    error.txtError.Text = ErrBuffer;
+                    //error.txtError.Text += p.StandardError.ReadToEnd();
+                    error.ShowDialog();
+                    return false;
+                }
+                return true;
+            }
+            else
+                MessageBox.Show("\"" + data.Paths.Qemu + "\"" + " does not exist");
+
+            return false;
         }
 
         public string GetErrorBuffer()
@@ -143,28 +150,36 @@
         public bool MountImage()
         {
             p.StartInfo.FileName = data.Paths.VDK + "\\vdk.exe";
-            p.StartInfo.WorkingDirectory = data.Paths.VDK;
-            p.StartInfo.Arguments = "open 0 " + "\"" + data.Tools.vdk.Image + "\" /RW /L:" + data.Tools.vdk.DriveLetter;
-
-            try
-            {
-                p.Start();
-                //frmError error = new frmError();
-                //error.txtError.Text = ErrBuffer;
-                //error.txtError.Text += p.StandardError.ReadToEnd();
-                //error.txtError.Text += p.StandardOutput.ReadToEnd();
-                //error.ShowDialog();
-            }
-            catch(Exception e)
-            {
-                ErrBuffer += Environment.NewLine + "Error: " + e.Message;
-                ErrorForm error = new ErrorForm();
-                error.txtError.Text = ErrBuffer;
-                error.txtError.Text += p.StandardError.ReadToEnd();
-                error.ShowDialog();
-                return false;
-            }
-            return true;
+
+            if (Directory.Exists(data.Paths.VDK))
+            {
+                p.StartInfo.WorkingDirectory = data.Paths.VDK;
+                p.StartInfo.Arguments = "open 0 " + "\"" + data.Tools.vdk.Image + "\" /RW /L:" + data.Tools.vdk.DriveLetter;
+
+                try
+                {
+                    p.Start();
+                    //frmError error = new frmError();
+                    //error.txtError.Text = ErrBuffer;
+                    //error.txtError.Text += p.StandardError.ReadToEnd();
+                    //error.txtError.Text += p.StandardOutput.ReadToEnd();
+                    //error.ShowDialog();
+                }
+                catch (Exception e)
+                {
+                    ErrBuffer += Environment.NewLine + "Error: " + e.Message;
+                    ErrorForm error = new ErrorForm();
+                    error.txtError.Text = ErrBuffer;
+                    error.txtError.Text += p.StandardError.ReadToEnd();
+                    error.ShowDialog();
+                    return false;
+                }
+                return true;
+            }
+            else
+                MessageBox.Show("\"" + data.Paths.VDK + "\"" + " does not exist");
+
+            return false;
         }
 
         public bool UnmountImage()

Modified: trunk/tools/Qemu GUI/program.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/Qemu%20GUI/program.cs?rev=26694&r1=26693&r2=26694&view=diff
==============================================================================
--- trunk/tools/Qemu GUI/program.cs (original)
+++ trunk/tools/Qemu GUI/program.cs Fri May 11 15:18:21 2007
@@ -9,7 +9,7 @@
         /// <summary>
         /// The main entry point for the application.
         /// </summary>
-        [MTAThread]
+        [STAThread]
         static void Main()
         {
             Application.Run(new MainForm());




More information about the Ros-diffs mailing list