Skip to content

Commit

Permalink
fix: unknown sources are PC platform
Browse files Browse the repository at this point in the history
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
  • Loading branch information
andrew-codes committed Nov 18, 2024
1 parent e0b6921 commit 9aceb5f
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions apps/PlayniteWebPlugin/src/Models/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public class Game : IIdentifiable
{
private readonly IEnumerable<Release> releases;
private readonly PlatformSorter platformSorter;
private readonly List<string> pcSourceNames;
private readonly List<string> pcPlatformNames;
private readonly List<string> xboxPlatformNames;
private readonly List<string> nintendoPlatformNames;
Expand All @@ -32,7 +31,6 @@ public Game(IEnumerable<Playnite.SDK.Models.Game> playniteGames)
{

platformSorter = new PlatformSorter();
pcSourceNames = new List<string> { "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<string> { ".*PC.*", ".*Macintosh.*", ".*Linux.*" };
xboxPlatformNames = new List<string> { ".*Xbox.*" };
nintendoPlatformNames = new List<string> { ".*Nintendo.*", ".*Switch.*", ".*Wii.*", ".*Game ?Cube.*" };
Expand Down Expand Up @@ -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));
Expand All @@ -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)); ;
}
}

Expand Down

0 comments on commit 9aceb5f

Please sign in to comment.