private bool UpdateFeature(Game game) { bool IsUpdated = false; List <GameFeature> gameFeatures = game.Features; if (gameFeatures != null && gameFeatures.Count > 0) { // Rename List <GameFeature> AllFeaturesOld = gameFeatures.FindAll(x => PluginSettings.ListFeatureEquivalences.Any(y => y.OldNames.Any(z => z.ToLower() == x.Name.ToLower()))); if (AllFeaturesOld.Count > 0) { // Remove all foreach (GameFeature feature in AllFeaturesOld) { game.FeatureIds.Remove(feature.Id); IsUpdated = true; } // Set all foreach (LmFeatureEquivalences item in PluginSettings.ListFeatureEquivalences.FindAll(x => x.OldNames.Any(y => AllFeaturesOld.Any(z => z.Name.ToLower() == y.ToLower())))) { if (item.Id != null) { game.FeatureIds.AddMissing((Guid)item.Id); IsUpdated = true; } } if (IsUpdated) { Application.Current.Dispatcher?.BeginInvoke((Action) delegate { PlayniteApi.Database.Games.Update(game); }).Wait(); } } // Exclusion if (PluginSettings.ListFeatureExclusion.Count > 0) { foreach (string FeatureName in PluginSettings.ListFeatureExclusion) { GameFeature featureDelete = game.Features.Find(x => x.Name.ToLower() == FeatureName.ToLower()); if (featureDelete != null) { game.FeatureIds.Remove(featureDelete.Id); IsUpdated = true; } } if (IsUpdated) { Application.Current.Dispatcher?.BeginInvoke((Action) delegate { PlayniteApi.Database.Games.Update(game); }).Wait(); } } } return(IsUpdated); }