/[EmuXPortal]/branches/mono/EmuXPortal/Form1.cs
ViewVC logotype

Diff of /branches/mono/EmuXPortal/Form1.cs

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

--- branches/mono/EmuXPortal/Form1.cs	2019/05/02 04:43:31	383
+++ branches/mono/EmuXPortal/Form1.cs	2019/05/02 05:15:37	385
@@ -30,6 +30,7 @@
 		static readonly System.Drawing.Color DEFAULT_TEXTFORECOLOR_LAUNCH = System.Drawing.Color.Blue;
 		static readonly System.Drawing.Color DEFAULT_TEXTFORECOLOR_MISSING = System.Drawing.Color.Red;
 
+		static readonly String FAVORITES_PLATFORM = "Favorites";
 
 		static bool bUserAbort = false;
 		static readonly Color SELECTED_CONTROL_BACKCOLOR = Color.SteelBlue;
@@ -403,14 +404,16 @@
 					gLog.Error.WriteLine ("Unable to add/remove from/to favorites (config) is null");
 				} else {
 					var isFavorite = RomFavorite.IsFavorite (config);
-					if (isFavorite) {
-						// add to favorites
-						//gLog.Debug.WriteLine("Removing from favorites: {0} [{1}]", config.RomTitle, config.RomFile);
-						if (!RomFavorite.RemoveFavorite (config)) {
-							gLog.Error.WriteLine ("Failed to remove from favorites: {0} [{1}]", config.RomTitle, config.RomFile);
-						} else {
-							gLog.Info.WriteLine ("Removed from favorites: {0} [{1}]", config.RomTitle, config.RomFile);
-							if (config.EmuConfig.PlatformNameShort == "Favorites") {
+					if (isFavorite) {
+						IEmuConfig cpc = CurrentPlatformControl.Tag as IEmuConfig;
+						string platform_long = cpc.PlatformNameLong;
+						if (platform_long == FAVORITES_PLATFORM) {
+							// add to favorites
+							//gLog.Debug.WriteLine("Removing from favorites: {0} [{1}]", config.RomTitle, config.RomFile);
+							if (!RomFavorite.RemoveFavorite (config)) {
+								gLog.Error.WriteLine ("Failed to remove from favorites: {0} [{1}]", config.RomTitle, config.RomFile);
+							} else {
+								gLog.Info.WriteLine ("Removed from favorites: {0} [{1}]", config.RomTitle, config.RomFile);
 								var parent = c.Parent;
 								if (parent != null) {
 									parent.Controls.Remove (c);
@@ -420,8 +423,11 @@
 											next_ctrl.Select ();
 										}
 									}
-								}
+								}
 							}
+						} else {
+							gLog.Info.WriteLine ("Already Favorited: {0} [{1}]", config.RomTitle, config.RomFile);
+							return;
 						}
 					} else {
 						// add to favorites
@@ -990,7 +996,7 @@
 					gLog.Verbose.Error.WriteLine (ex.ToString ());
 					throw ex;
 				}
-				if (CurrentSelectedRom.PlatformNameShort == "Favorites") {
+				if (CurrentSelectedRom.PlatformNameShort == FAVORITES_PLATFORM) {
 					//game_ctrl.GameName = config.RomTitle;
 					var favorite = RomFavorite.GetFavoriteInfoFromRom (config);
 					game_ctrl.GameName = favorite.RomConfig.RomExists ? favorite.RomConfig.RomTitle : string.Format ("{0} - (unavailable)", favorite.RomConfig.RomTitle);
@@ -1042,7 +1048,7 @@
 				game_ctrl.Dock = DockStyle.Top;
 				game_ctrl.Width = this.Width - 10;
 				IEmuConfig config = CurrentPlatformControl.Tag as IEmuConfig;
-				if (config.PlatformNameLong == "Favorites") {
+				if (config.PlatformNameLong == FAVORITES_PLATFORM) {
 					game_ctrl.GameName = "You haven't favorited any games, select a game and then press CTRL+F to favorite it";
 				} else {
 					game_ctrl.GameName = string.Format ("No {0} games were found", config.PlatformNameShort);

 

  ViewVC Help
Powered by ViewVC 1.1.22