public void RemoveTag(Game game) { if (game != null && game.TagIds != null) { if (game.TagIds.Where(x => PluginTags.Any(y => x == y.Id)).Count() > 0) { game.TagIds = game.TagIds.Where(x => !PluginTags.Any(y => x == y.Id)).ToList(); #if DEBUG logger.Debug($"{PluginName} - PluginTags: {JsonConvert.SerializeObject(PluginTags)}"); logger.Debug($"{PluginName} - game.TagIds: {JsonConvert.SerializeObject(game.TagIds)}"); #endif _PlayniteApi.Database.Games.Update(game); } } }
private Guid?FindGoodPluginTags(HltbDataUser hltbDataUser) { long hltbTime = hltbDataUser.GameHltbData.TimeToBeat; // Add tag if (hltbTime != 0) { if (hltbTime < 3600) { return((PluginTags.Find(x => x.Name == $"[HLTB] {resources.GetString("LOCPLaytimeLessThenAnHour")}")).Id); } if (hltbTime < 18000) { return((PluginTags.Find(x => x.Name == $"[HLTB] {resources.GetString("LOCHowLongToBeat1to5")}")).Id); } if (hltbTime < 36000) { return((PluginTags.Find(x => x.Name == $"[HLTB] {resources.GetString("LOCHowLongToBeat5to10")}")).Id); } if (hltbTime < 72000) { return((PluginTags.Find(x => x.Name == $"[HLTB] {resources.GetString("LOCHowLongToBeat10to20")}")).Id); } if (hltbTime < 108000) { return((PluginTags.Find(x => x.Name == $"[HLTB] {resources.GetString("LOCHowLongToBeat20to30")}")).Id); } if (hltbTime < 144000) { return((PluginTags.Find(x => x.Name == $"[HLTB] {resources.GetString("LOCHowLongToBeat30to40")}")).Id); } if (hltbTime < 180000) { return((PluginTags.Find(x => x.Name == $"[HLTB] {resources.GetString("LOCHowLongToBeat40to50")}")).Id); } if (hltbTime < 216000) { return((PluginTags.Find(x => x.Name == $"[HLTB] {resources.GetString("LOCHowLongToBeat50to60")}")).Id); } if (hltbTime < 252000) { return((PluginTags.Find(x => x.Name == $"[HLTB] {resources.GetString("LOCHowLongToBeat60to70")}")).Id); } if (hltbTime < 288000) { return((PluginTags.Find(x => x.Name == $"[HLTB] {resources.GetString("LOCHowLongToBeat70to80")}")).Id); } if (hltbTime < 324000) { return((PluginTags.Find(x => x.Name == $"[HLTB] {resources.GetString("LOCHowLongToBeat80to90")}")).Id); } if (hltbTime < 360000) { return((PluginTags.Find(x => x.Name == $"[HLTB] {resources.GetString("LOCHowLongToBeat90to100")}")).Id); } if (hltbTime >= 360000) { return((PluginTags.Find(x => x.Name == $"[HLTB] {resources.GetString("LOCHowLongToBeat100plus")}")).Id); } } return(null); }
public virtual Guid?FindGoodPluginTags(string TagName) { return(PluginTags.Find(x => x.Name.ToLower() == TagName.ToLower()).Id); }