From 9aceb5fa67f49c74f06abde4c08fd828a3edc344 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Mon, 18 Nov 2024 14:14:56 +0000 Subject: [PATCH] fix: unknown sources are PC platform An unknown source is most likely a PC platform release. For this reason, default to PC platform when the source is not recognized as another preset source; i.e. PlayStation, Xbox, Nintendo, etc. Closes #633 --- apps/PlayniteWebPlugin/src/Models/Game.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/apps/PlayniteWebPlugin/src/Models/Game.cs b/apps/PlayniteWebPlugin/src/Models/Game.cs index e545c7526..8c6f5844e 100755 --- a/apps/PlayniteWebPlugin/src/Models/Game.cs +++ b/apps/PlayniteWebPlugin/src/Models/Game.cs @@ -13,7 +13,6 @@ public class Game : IIdentifiable { private readonly IEnumerable releases; private readonly PlatformSorter platformSorter; - private readonly List pcSourceNames; private readonly List pcPlatformNames; private readonly List xboxPlatformNames; private readonly List nintendoPlatformNames; @@ -32,7 +31,6 @@ public Game(IEnumerable playniteGames) { platformSorter = new PlatformSorter(); - pcSourceNames = new List { "Steam", "EA app", "Ubisoft Connect", "Epic", "GOG", "Origin", "UPlay", "Battle.net", "Amazon Games", "Fanatical", "GamersGate", "Humble", "itch.io", "Legacy Games", "Indiegala", "Rockstar Games", "Riot Games", "RomM" }; pcPlatformNames = new List { ".*PC.*", ".*Macintosh.*", ".*Linux.*" }; xboxPlatformNames = new List { ".*Xbox.*" }; nintendoPlatformNames = new List { ".*Nintendo.*", ".*Switch.*", ".*Wii.*", ".*Game ?Cube.*" }; @@ -76,12 +74,6 @@ private bool IsMatchingPlatform(GameSource source, Platform platform) } - if (pcSourceNames.Any(platformName => platformName.ToLower() == source.Name.ToLower())) - { - return pcPlatformNames.Any(platformName => Regex.IsMatch(platform.Name, platformName, RegexOptions.IgnoreCase)); - } - - if (Regex.IsMatch(source.Name, "xbox", RegexOptions.IgnoreCase)) { return xboxPlatformNames.Any(platformName => Regex.IsMatch(platform.Name, platformName, RegexOptions.IgnoreCase)); @@ -93,7 +85,7 @@ private bool IsMatchingPlatform(GameSource source, Platform platform) return nintendoPlatformNames.Any(platformName => Regex.IsMatch(platform.Name, platformName, RegexOptions.IgnoreCase)); } - return false; + return pcPlatformNames.Any(platformName => Regex.IsMatch(platform.Name, platformName, RegexOptions.IgnoreCase)); ; } }