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

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

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

--- branches/mono/EmuXPortal.Api/Api/EmuConfig.cs	2019/05/06 02:26:16	395
+++ branches/mono/EmuXPortal.Api/Api/EmuConfig.cs	2019/06/23 23:32:26	396
@@ -28,7 +28,7 @@
 
 
 		bool HasExternalConfigs { get; }
-		List<IEmuConfig> ExternalConfigs { get; }
+		HashSet<IEmuConfig> ExternalConfigs { get; }
 
 
 		string GameTitle { get; }
@@ -175,14 +175,15 @@
 							ext_path = new DirectoryInfo (ext_rom_path);
 						}
 						if (ext_path.Exists) {
-							List<IEmuConfig> externalconfigs = new List<IEmuConfig> ();
-							//			                List<string> external_config_files = (searchPattern == "*.*")
-							//			                     ? new List<string>(Directory.GetFiles(ext_path.FullName, "*.*", SearchOption.TopDirectoryOnly))
-							//			                     : new List<string>(Directory.GetFiles(ext_path.FullName, "*.*", SearchOption.TopDirectoryOnly).Where(s => searchPattern.Contains(Path.GetExtension(s).ToLower())));
-
-							List<string> external_config_files = new List<string> (Directory.GetFiles (ext_path.FullName, "*.config", SearchOption.TopDirectoryOnly));
-							if (external_config_files.Count > 0)
-								external_config_files.Sort (); // sort the files (they should already be sorted alphabetically by GetFiles())
+							HashSet<IEmuConfig> externalconfigs = new HashSet<IEmuConfig> ();
+							//			                HashSet<string> external_config_files = (searchPattern == "*.*")
+							//			                     ? new HashSet<string>(Directory.GetFiles(ext_path.FullName, "*.*", SearchOption.TopDirectoryOnly))
+							//			                     : new HashSet<string>(Directory.GetFiles(ext_path.FullName, "*.*", SearchOption.TopDirectoryOnly).Where(s => searchPattern.Contains(Path.GetExtension(s).ToLower())));
+
+							HashSet<string> external_config_files = new HashSet<string> (Directory.GetFiles (ext_path.FullName, "*.config", SearchOption.TopDirectoryOnly));
+							if (external_config_files.Count > 0) {
+								external_config_files = new HashSet<string> (external_config_files.OrderBy (s => s));
+							}
 							foreach (string file in external_config_files) {
 								IEmuConfig config = EmuConfigLoader.Load (file, EmuRomPath);
 								if (config != null)
@@ -230,7 +231,7 @@
 				this.GameExe = "";
 				this.GameExeArgs = "";
 
-				this.ExternalConfigs = new List<IEmuConfig> ();
+				this.ExternalConfigs = new HashSet<IEmuConfig> ();
 				if (iep.HasExternalConfigs) {
 					foreach (var ieec in iep.ExternalConfigs) {
 						IEmuConfig iec = new EmuConfig (ieec);
@@ -262,7 +263,7 @@
 				this.Extenstions = (Extenstions == "") ? "*.*" : Extenstions;
 				this.EmuBinaryPath = EmuPath;
 				this.EmuOptions = EmuOptions;
-				this.ExternalConfigs = new List<IEmuConfig> ();
+				this.ExternalConfigs = new HashSet<IEmuConfig> ();
 				this.GameTitle = "";
 				this.GameImage = "";
 				this.GameExe = "";
@@ -332,7 +333,7 @@
 			public string EmuOptions { get; set; }
 			public string EmuRomPath { get; set; }
 			public bool HasExternalConfigs { get { return ExternalConfigs.Count > 0; } }
-			public List<IEmuConfig> ExternalConfigs { get; private set; }
+			public HashSet<IEmuConfig> ExternalConfigs { get; private set; }
 
 			public string GameTitle { get; set; }
 			public string GameImage { get; set; }

 

  ViewVC Help
Powered by ViewVC 1.1.22