/[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/08/22 02:36:47	105
+++ trunk/EmuXPortal/Api/RomParser.cs	2012/08/23 02:10:16	107
@@ -25,9 +25,17 @@
             if (Config.HasExternalConfigs) { return GetRomsEX(); }
             string path = Config.EmuRomPath; string searchPattern = Config.Extenstions;
             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())));
+            Predicate<string> rom_predicate = new Predicate<string>(delegate(string t)
+                {
+                    string search_exts = searchPattern.Replace("*", "");
+                    List<string> exts = new List<string>(search_exts.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries));             
+                    string ext = Path.GetExtension(t).ToLower();
+                    return exts.Contains(ext) && t.ToLower().EndsWith(ext);
+                });
+               List<string> roms = (searchPattern == "*.*")
+                   ? new List<string>(Directory.GetFiles(path, "*.*", SearchOption.AllDirectories))
+                   : new List<string>(Directory.GetFiles(path, "*.*", SearchOption.AllDirectories).Where(s => rom_predicate(s)));
+            
             #region LIST_ADDED_ROMS
 #if LIST_ADDED_ROMS
             foreach (string rom in roms)

 

  ViewVC Help
Powered by ViewVC 1.1.22