Skip to content

Commit 1d40c3b

Browse files
committed
First part of comment processing
1 parent 2b016f5 commit 1d40c3b

3 files changed

Lines changed: 11 additions & 9 deletions

File tree

source/Generic/GameRelations/GameRelationsSettings.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,9 @@ public void UpgradeSettings()
205205
int currentVersion = 2;
206206

207207
if (settings.SettingsVersion < 2)
208+
{
208209
SetAdvancedSectionDefaults();
210+
}
209211

210212
Settings.SettingsVersion = currentVersion;
211213
}

source/Generic/GameRelations/PlayniteControls/GameRelationsBase.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ protected static T GetAnyCommonItem<T>(List<T> listToMatch, HashSet<T> hashSet)
275275
/// Returns false if the list is null or empty.</returns>
276276
protected static bool HashSetContainsAnyItem<T>(IEnumerable<T> listToMatch, HashSet<T> hashSet)
277277
{
278-
if (listToMatch is null)
278+
if (listToMatch is null || !listToMatch.Any())
279279
{
280280
return false;
281281
}

source/Generic/GameRelations/PlayniteControls/SimilarGamesControl.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,27 @@ public SimilarGamesControl(IPlayniteAPI playniteApi, GameRelationsSettings setti
3333

3434
public override IEnumerable<Game> GetMatchingGames(Game game)
3535
{
36-
var gtm = GetGameToMatchInfo(game);
36+
var gameToMatchInfo = GetGameToMatchInfo(game);
3737

3838
var similarityScores = new Dictionary<Game, double>();
3939
foreach (var otherGame in PlayniteApi.Database.Games)
4040
{
41-
if (otherGame.Id == gtm.Game.Id)
41+
if (otherGame.Id == gameToMatchInfo.Game.Id)
4242
{
4343
continue;
4444
}
4545

46-
if (!gtm.Game.Hidden && otherGame.Hidden)
46+
if (!gameToMatchInfo.Game.Hidden && otherGame.Hidden)
4747
{
4848
continue;
4949
}
5050

51-
if (_controlSettings.ExcludeGamesSameSeries && HashSetContainsAnyItem(otherGame.SeriesIds, gtm.SeriesIds))
51+
if (_controlSettings.ExcludeGamesSameSeries && HashSetContainsAnyItem(otherGame.SeriesIds, gameToMatchInfo.SeriesIds))
5252
{
5353
continue;
5454
}
5555

56-
if (GamesAreSimilar(gtm, otherGame, out double similarity))
56+
if (GamesAreSimilar(gameToMatchInfo, otherGame, out double similarity))
5757
{
5858
similarityScores.Add(otherGame, similarity);
5959
}
@@ -67,15 +67,15 @@ public override IEnumerable<Game> GetMatchingGames(Game game)
6767

6868
private GameToMatchInfo GetGameToMatchInfo(Game game)
6969
{
70-
var gtm = new GameToMatchInfo(game);
70+
var gameToMatchInfo = new GameToMatchInfo(game);
7171
foreach (var field in _controlSettings.FieldSettings)
7272
{
7373
if (field.Enabled)
7474
{
75-
gtm.FilteredValues[field.Field] = GetFilteredValue(game, field.Field).ToHashSet();
75+
gameToMatchInfo.FilteredValues[field.Field] = GetFilteredValue(game, field.Field).ToHashSet();
7676
}
7777
}
78-
return gtm;
78+
return gameToMatchInfo;
7979
}
8080

8181
protected HashSet<Guid> GetItemsToIgnore(GameField field)

0 commit comments

Comments
 (0)