/// <summary> /// Update session and engine statistics /// </summary> /// <param name="data"></param> public void Restore(StatsDump data) { Sessions.Clear(); foreach (var session in data.Sessions) { Sessions.Add(session); } EngineStats.Clear(); foreach (var stat in data.Stats) { EngineStats.Add(stat.Id, stat); } }
/// <summary> /// Update game engine statistics /// </summary> /// <param name="s"></param> private void ProcessStat(EngineStat s) { if (EngineStats.ContainsKey(s.Id)) { EngineStats[s.Id].Sum += s.Sum; EngineStats[s.Id].Count += s.Count; Logger.LogDebug("updated stat {ChallengeId} {Sum} {Count} {Average}", EngineStats[s.Id].Id, EngineStats[s.Id].Sum, EngineStats[s.Id].Count, EngineStats[s.Id].Average); } else { EngineStats.Add(s.Id, s); } }