/[EmuXPortal]/trunk/EmuXPortal/Api/ConfigLoader.cs
ViewVC logotype

Diff of /trunk/EmuXPortal/Api/ConfigLoader.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/EmuXPortal/Api/ConfigLoader.cs	2012/04/03 20:35:32	12
+++ trunk/EmuXPortal/Api/ConfigLoader.cs	2012/04/03 21:00:28	13
@@ -4,6 +4,8 @@
 using System.Linq;
 using System.Text;
 using System.Windows.Forms;
+using System.Xml;
+using System.IO;
 
 namespace EmuXPortal.Api
 {
@@ -35,6 +37,25 @@
             public bool LoadConfig(string path)
             {
                 bool loaded = false;
+                try
+                {
+                    using (FileStream fs = new FileStream(CONFIG_FILE_PATH, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+                    {
+                        using (XmlReader reader = XmlReader.Create(fs))
+                        {
+                            reader.ReadToFollowing("ROMPATH");
+                            RomPath = reader.ReadElementContentAsString();
+                            reader.ReadToFollowing("DISPLAYDEVICE");
+                            DisplayDevice = reader.ReadElementContentAsString();
+                        }
+                    }
+                    loaded = true;
+                }
+                catch (Exception ex)
+                {
+                    Console.WriteLine(ex.ToString());
+                    loaded = false;
+                }
                 return loaded;
             }
             #endregion
@@ -54,6 +75,13 @@
         public static string RomPath { get { return loader.RomPath; } }
         public static string DisplayDevice { get { return loader.DisplayDevice; } }
         #endregion
+        public static void InitializePresentationForm(Form frm)
+        {
+            DisplayHelper helper = new DisplayHelper(DisplayDevice);
+            Screen s = helper.PhysicalDisplayDevice;
+            frm.Location = new System.Drawing.Point(s.Bounds.X,s.Bounds.Y);
+            frm.Size = s.Bounds.Size;
+        }
     }
 
   

 

  ViewVC Help
Powered by ViewVC 1.1.22