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

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

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

--- trunk/EmuXPortal/Api/RomParser.cs	2012/04/04 01:32:58	18
+++ trunk/EmuXPortal/Api/RomParser.cs	2012/04/04 03:37:37	26
@@ -18,16 +18,13 @@
         public List<IRomConfig> Roms { get; private set; }
         private List<string> GetRoms(string path, string searchPattern)
         {
-            logger.WriteLine("Searching for Roms in Folder: {0}", path);
-            List<string> roms = new List<string>(Directory.GetFiles(path, searchPattern));
-            foreach (string rom in roms)
-            {
-                FileInfo fi = new FileInfo(rom);
-                logger.WriteLine("\tAdding: {0}",fi.Name);
-            }
+            logger.WriteLine("Searching for Roms in Folder: {0}", path);            
+            List<string> roms = (searchPattern == "*.*") 
+                ? new List<string>(Directory.GetFiles(path, "*.*", SearchOption.AllDirectories)) 
+                : new List<string>(Directory.GetFiles(path, "*.*", SearchOption.AllDirectories).Where(s => searchPattern.Contains(Path.GetExtension(s).ToLower())));
+            foreach (string rom in roms) { FileInfo fi = new FileInfo(rom); logger.WriteLine("\tAdding: {0}", fi.Name); }
             return roms;
         }
-
         private List<IRomConfig> GenerateRomConfig(List<string> roms)
         {
             List<IRomConfig> romconfigs = new List<IRomConfig>();
@@ -35,6 +32,5 @@
             foreach (string rom in roms) { romconfigs.Add(RomLoader.Load(rom)); }
             return romconfigs;
         }
-
     }
 }

 

  ViewVC Help
Powered by ViewVC 1.1.22