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

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

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

--- trunk/EmuXPortal/Api/RomParser.cs	2012/04/03 21:54:58	16
+++ trunk/EmuXPortal/Api/PlatformParser.cs	2012/04/04 01:32:37	17
@@ -7,27 +7,26 @@
 
 namespace EmuXPortal.Api
 {
-    public class RomParser
+    public class PlatformParser
     {
-        /* Rom Parser format:
-         * 
-         */
-
         private const string EMU_IGNORE_FILE = "emu_ignore.txt"; // if this file is present, that folder is ignored
-
-        public RomParser(string path)
+        
+        public PlatformParser(string path)
         {
-           List<string> dirs = GetRomDirectories(path);
-           logger.WriteLine("Found {0} EMU Folders", dirs.Count);
+            List<string> romdirs = GetRomDirectories(path);
+            logger.WriteLine("Found {0} EMU Folders", romdirs.Count);
+            this.Platforms = GetEMUConfigFiles(romdirs);
         }
 
+        public List<IEmuConfig> Platforms { get; private set; }
+
         private List<string> GetRomDirectories(string path)
         {
             logger.WriteLine("Searching for EMU Folders in: {0}", path);
             List<string> dirs = new List<string>();
             foreach (string dir in Directory.GetDirectories(path))
             {
-                              bool ignore = false;
+                bool ignore = false;
                 foreach (string file in Directory.GetFiles(dir))
                 {
                     FileInfo fi = new FileInfo(file);
@@ -47,6 +46,20 @@
             return dirs;
         }
 
+        private List<IEmuConfig> GetEMUConfigFiles(List<string> romdirs)
+        {
+            List<IEmuConfig> emuconfigs = new List<IEmuConfig>();
+            logger.WriteLine("Reading EMU Config files");
+            foreach (string dir in romdirs)
+            {
+                IEmuConfig emuconfig = null;
+                emuconfig = EmuConfigLoader.Load(dir);
+                emuconfigs.Add(emuconfig);
+            }
+            logger.WriteLine("Finished Reading EMU Config files");
+            return emuconfigs;
+        }
+
     }
 }
 

 

  ViewVC Help
Powered by ViewVC 1.1.22