/[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

revision 105 by william, Wed Aug 22 02:36:47 2012 UTC revision 107 by william, Thu Aug 23 02:10:16 2012 UTC
# Line 25  namespace EmuXPortal.Api Line 25  namespace EmuXPortal.Api
25              if (Config.HasExternalConfigs) { return GetRomsEX(); }              if (Config.HasExternalConfigs) { return GetRomsEX(); }
26              string path = Config.EmuRomPath; string searchPattern = Config.Extenstions;              string path = Config.EmuRomPath; string searchPattern = Config.Extenstions;
27              logger.WriteLine("Searching for Roms in Folder: {0}", path);              logger.WriteLine("Searching for Roms in Folder: {0}", path);
28              List<string> roms = (searchPattern == "*.*")              Predicate<string> rom_predicate = new Predicate<string>(delegate(string t)
29                  ? new List<string>(Directory.GetFiles(path, "*.*", SearchOption.AllDirectories))                  {
30                  : new List<string>(Directory.GetFiles(path, "*.*", SearchOption.AllDirectories).Where(s => searchPattern.Contains(Path.GetExtension(s).ToLower())));                      string search_exts = searchPattern.Replace("*", "");
31                        List<string> exts = new List<string>(search_exts.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries));            
32                        string ext = Path.GetExtension(t).ToLower();
33                        return exts.Contains(ext) && t.ToLower().EndsWith(ext);
34                    });
35                   List<string> roms = (searchPattern == "*.*")
36                       ? new List<string>(Directory.GetFiles(path, "*.*", SearchOption.AllDirectories))
37                       : new List<string>(Directory.GetFiles(path, "*.*", SearchOption.AllDirectories).Where(s => rom_predicate(s)));
38                
39              #region LIST_ADDED_ROMS              #region LIST_ADDED_ROMS
40  #if LIST_ADDED_ROMS  #if LIST_ADDED_ROMS
41              foreach (string rom in roms)              foreach (string rom in roms)

Legend:
Removed from v.105  
changed lines
  Added in v.107

  ViewVC Help
Powered by ViewVC 1.1.22