public void UpdateDatabase(RPPDatabase _Database, DateTime _EarliestDateTime) { var realmDBs = _Database.GetRealms(); foreach (var realmDB in realmDBs) { foreach (var playerHistory in realmDB.Value.PlayersHistory) { try { if (playerHistory.Value.GuildHistory.Count < 1) { continue; } if (playerHistory.Value.GuildHistory.Last().Uploader.GetTime() >= _EarliestDateTime) { List <string> guildsAffected = new List <string>(); for (int i = playerHistory.Value.GuildHistory.Count - 1; i >= 0; --i) { if (playerHistory.Value.GuildHistory[i].Uploader.GetTime() < _EarliestDateTime) { break; } string guildName = playerHistory.Value.GuildHistory[i].Data.GuildName; if (guildsAffected.Contains(guildName) == false) { guildsAffected.Add(guildName); } } foreach (string guildName in guildsAffected) { if (guildName == "nil" || guildName == "None") { continue; } if (GetGuildSummary(realmDB.Value.Realm, guildName) == null) { var newGuildSummary = new GuildSummary(guildName, realmDB.Value.Realm); newGuildSummary.InitCache(); AddGuildSummary(newGuildSummary); } } foreach (var guild in m_Guilds) { if (guild.Value.Realm == realmDB.Value.Realm) { guild.Value.Update(playerHistory.Key, playerHistory.Value, _EarliestDateTime); } } } } catch (Exception ex) { VF_RealmPlayersDatabase.Logger.LogException(ex); } } } }
public GuildSummary GetGuildSummary(WowRealm _Realm, string _GuildName) { GuildSummary retValue = null; if (m_Guilds.TryGetValue(Utility.GetRealmPreString(_Realm) + _GuildName, out retValue) == false) { return(null); } return(retValue); }
public GuildPlayerStatus(GuildSummary _GuildSummary, PlayerData.GuildData _GuildData, DateTime _DateTime) { m_DateTime = _DateTime; if (_GuildData.GuildName == _GuildSummary.GuildName) { m_GuildRank = _GuildData.GuildRank; m_GuildRankNr = _GuildData.GuildRankNr; } else { m_GuildRankNr = -1337; m_GuildRank = ""; } }
public void Dispose() { m_CacheGuild = null; }
public void InitCache(GuildSummary _GuildSummary) { m_CacheGuild = _GuildSummary; }
private void AddGuildSummary(GuildSummary _GuildSummary) { m_Guilds.Add(Utility.GetRealmPreString(_GuildSummary.Realm) + _GuildSummary.GuildName, _GuildSummary); }