public override bool Equals(object obj) { var g = obj as GameIndex; if (g == null) { return(false); } return(OpponentName.Equals(g.OpponentName) && OpponentClass.Equals(g.OpponentClass) && StartTime.Year == g.StartTime.Year && StartTime.Month == g.StartTime.Month && StartTime.Day == g.StartTime.Day && StartTime.Hour == g.StartTime.Hour && StartTime.Minute == g.StartTime.Minute && StartTime.Second == g.StartTime.Second); }
public List <Game> Apply(List <Game> games) { IEnumerable <Game> filtered = new List <Game>(games); // filter by deck first if needed if (DeckId != null) { if (DeckId == Deck.None.Id) { filtered = filtered.Where(g => g.Deck == null); } else { filtered = filtered.Where(g => g.Deck != null && DeckId.Equals(g.Deck.Id)); } } // player class filter (only useful if deck is null) if (!PlayerClass.Equals(PlayerClass.ALL)) { filtered = filtered.Where(g => g.PlayerClass == PlayerClass); } // opponent class filter if (!OpponentClass.Equals(PlayerClass.ALL)) { filtered = filtered.Where(g => g.OpponentClass == OpponentClass); } // format filter if (!Format.Equals(GameFormat.ANY)) { filtered = filtered.Where(g => g.Format == Format); } // region filter if (!Region.Equals(Region.ALL)) { filtered = filtered.Where(g => g.Region == Region); } // game mode filter if (!Mode.Equals(GameMode.ALL)) { // if Ranked filter is on, also check for Rank range filter if (Mode.Equals(GameMode.RANKED)) { // ignore rank if its invalid or equal to the default range if (RankIsValid(Rank) && (Rank.Item1 != RANK_LO || Rank.Item2 != RANK_HI)) { filtered = filtered.Where(g => g.Mode == GameMode.RANKED && g.Rank <= Rank.Item1 && g.Rank > Rank.Item2); } } else { filtered = filtered.Where(g => g.Mode == Mode); } } // time filter var range = ConvertTimeFrameToRange(TimeFrame); filtered = filtered.Where(g => g.StartTime >= range.Start && g.EndTime <= range.End); return(filtered.ToList()); }
public override string ToString() { return($"{OpponentName}_{OpponentClass.ToString()}.{StartTime.Ticks}"); }