public static void AddAllTag(IPlayniteAPI PlayniteApi, Game game, string PluginUserDataPath)
        {
            RemoveAllTag(PlayniteApi, game);

            if (HaveData(game.Id, PluginUserDataPath))
            {
                try {
                    HowLongToBeatData howLongToBeatData = new HowLongToBeatData(game, PluginUserDataPath, PlayniteApi, false);
                    HltbDataUser      data   = howLongToBeatData.GetData();
                    List <Guid>       tagIds = SetListHltbTag(PlayniteApi, data);

                    if (tagIds.Count > 0)
                    {
                        game.TagIds = tagIds;
                        PlayniteApi.Database.Games.Update(game);
                    }
                }
                catch (Exception ex)
                {
#if DEBUG
                    Common.LogError(ex, "HowLongToBeat", $"Error on AddAllTag()");
#endif
                    logger.Error($"HowLongToBeat - Tag insert error with {game.Name}");
                    PlayniteApi.Notifications.Add(new NotificationMessage(
                                                      "HowLongToBeat-Tag-Errors",
                                                      "HowLongToBeat\r\n" + resources.GetString("LOCCommonNotificationTagError"),
                                                      NotificationType.Error
                                                      ));
                }
            }
        }
Exemplo n.º 2
0
        public static void AddAllTag(IPlayniteAPI PlayniteApi, Game game, string PluginUserDataPath)
        {
            RemoveAllTag(PlayniteApi, game);

            if (HaveData(game.Id, PluginUserDataPath))
            {
                try {
                    HowLongToBeatData howLongToBeatData = new HowLongToBeatData(game, PluginUserDataPath, PlayniteApi, false);
                    HltbDataUser      data   = howLongToBeatData.GetData();
                    List <Guid>       tagIds = SetListHltbTag(PlayniteApi, data);

                    if (tagIds.Count > 0)
                    {
                        game.TagIds = tagIds;
                        PlayniteApi.Database.Games.Update(game);
                    }
                }
                catch (Exception ex)
                {
                    Common.LogError(ex, "HowLongToBeat", $"Tag insert error with {game.Name}");
                }
            }
        }