/[EmuXPortal]/branches/mono/EmuXPortal.Api/Api/IEmuPlatform.cs
ViewVC logotype

Diff of /branches/mono/EmuXPortal.Api/Api/IEmuPlatform.cs

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

--- branches/mono/EmuXPortal.Api/Api/IEmuPlatform.cs	2019/05/06 02:26:16	395
+++ branches/mono/EmuXPortal.Api/Api/IEmuPlatform.cs	2019/06/23 23:32:26	396
@@ -118,8 +118,8 @@
 
 		bool HasExternalConfigs { get; }
 
-		List<IExternalEmuConfig> ExternalConfigs { get; }
-		List<IEmuRom> Roms { get; set;}
+		HashSet<IExternalEmuConfig> ExternalConfigs { get; }
+		HashSet<IEmuRom> Roms { get; set;}
 
 		string ToString();
 	}
@@ -197,15 +197,15 @@
 
 		private bool m_HasExternalConfigs = false;
 		public bool HasExternalConfigs  { get { return m_HasExternalConfigs; } set { this.m_HasExternalConfigs = value; } }
-		private List<IEmuRom> m_Roms = new List<IEmuRom> ();
+		private HashSet<IEmuRom> m_Roms = new HashSet<IEmuRom> ();
 
-		public List<IEmuRom> Roms {
+		public HashSet<IEmuRom> Roms {
 			get { return m_Roms; }
 			set { m_Roms = value; }
 		}
 
-		private List<IExternalEmuConfig> m_ExternalConfigs = new List<IExternalEmuConfig>();
-		public List<IExternalEmuConfig> ExternalConfigs { get { return m_ExternalConfigs; } set { this.m_ExternalConfigs = value; } }
+		private HashSet<IExternalEmuConfig> m_ExternalConfigs = new HashSet<IExternalEmuConfig>();
+		public HashSet<IExternalEmuConfig> ExternalConfigs { get { return m_ExternalConfigs; } set { this.m_ExternalConfigs = value; } }
 		#endregion
 
 		private bool ParseConfig ()
@@ -293,13 +293,13 @@
 			string path = OSInfo.FormatPath (string.Format ("{0}/{1}", this.PlatformPath, external_config_path));
 			Predicate<string> config_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));             
+				HashSet<string> exts = new HashSet<string> (search_exts.Split (new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries));             
 				string ext = Path.GetExtension (t).ToLower ();
 				return exts.Contains (ext) && t.ToLower ().EndsWith (ext);
 			});
-			List<string> configs = (searchPattern == "*.*")
-				? new List<string> (Directory.GetFiles (path, "*.*", SearchOption.AllDirectories))
-				: new List<string> (Directory.GetFiles (path, "*.*", SearchOption.AllDirectories).Where (s => config_predicate (s)));
+			HashSet<string> configs = (searchPattern == "*.*")
+				? new HashSet<string> (Directory.GetFiles (path, "*.*", SearchOption.AllDirectories))
+				: new HashSet<string> (Directory.GetFiles (path, "*.*", SearchOption.AllDirectories).Where (s => config_predicate (s)));
 
 			if (configs.Count > 0) {
 				foreach (var config in configs) {
@@ -311,7 +311,7 @@
 					}
 				}
 			}
-			this.ExternalConfigs.Sort();
+			this.ExternalConfigs = new HashSet<IExternalEmuConfig> (this.ExternalConfigs.OrderBy (s => s.ConfigFile.ToLower ()));
 			return true;
 		}
 		private bool EnumerateRoms ()
@@ -321,8 +321,8 @@
 			}
 			string searchPattern = this.Extenstions;
 			string path = this.EmulatorRomPath;
-			List<IEmuRom> roms = new List<IEmuRom>();
-			List<string> images = EmuRom.GetImagesInPath(this.EmulatorRomPath);
+			HashSet<IEmuRom> roms = new HashSet<IEmuRom>();
+			HashSet<string> images = EmuRom.GetImagesInPath(this.EmulatorRomPath);
 			bool result = EmuRom.EnumerateRoms(this, images,this.abort_event, path,searchPattern, out roms);
 			images.Clear();
 			images=null;

 

  ViewVC Help
Powered by ViewVC 1.1.22