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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 18 - (hide annotations) (download)
Wed Apr 4 01:32:58 2012 UTC (8 years, 7 months ago) by william
File size: 1336 byte(s)
add missing file from last commit

1 william 18 using System;
2     using System.Collections.Generic;
3     using System.Linq;
4     using System.Text;
5     using EmuXPortal.Logging;
6     using System.IO;
7    
8     namespace EmuXPortal.Api
9     {
10     public class RomParser
11     {
12     public RomParser(string path, string searchPattern)
13     {
14     List<string> roms = GetRoms(path, searchPattern);
15     logger.WriteLine("Found {0} Roms", roms.Count);
16     this.Roms = GenerateRomConfig(roms);
17     }
18     public List<IRomConfig> Roms { get; private set; }
19     private List<string> GetRoms(string path, string searchPattern)
20     {
21     logger.WriteLine("Searching for Roms in Folder: {0}", path);
22     List<string> roms = new List<string>(Directory.GetFiles(path, searchPattern));
23     foreach (string rom in roms)
24     {
25     FileInfo fi = new FileInfo(rom);
26     logger.WriteLine("\tAdding: {0}",fi.Name);
27     }
28     return roms;
29     }
30    
31     private List<IRomConfig> GenerateRomConfig(List<string> roms)
32     {
33     List<IRomConfig> romconfigs = new List<IRomConfig>();
34     logger.WriteLine("Generating Rom Configs");
35     foreach (string rom in roms) { romconfigs.Add(RomLoader.Load(rom)); }
36     return romconfigs;
37     }
38    
39     }
40     }

  ViewVC Help
Powered by ViewVC 1.1.22