コード例 #1
0
        public void InitializeServerStats(Server sv)
        {
            int serverId = sv.GetHashCode();
            var statsSvc = ContextThreads[serverId];

            var serverStats = statsSvc.ServerStatsSvc.Find(s => s.ServerId == serverId).FirstOrDefault();

            if (serverStats == null)
            {
                Log.WriteDebug($"Initializing server stats for {sv}");
                // server stats have never been generated before
                serverStats = new EFServerStatistics()
                {
                    Active        = true,
                    ServerId      = serverId,
                    TotalKills    = 0,
                    TotalPlayTime = 0,
                };

                var ieClientStats = statsSvc.ClientStatSvc.Find(cs => cs.ServerId == serverId);

                // set these incase they've we've imported settings
                serverStats.TotalKills    = ieClientStats.Sum(cs => cs.Kills);
                serverStats.TotalPlayTime = Manager.GetClientService().GetTotalPlayTime().Result;

                statsSvc.ServerStatsSvc.Insert(serverStats);
            }
        }
コード例 #2
0
ファイル: ServerStats.cs プロジェクト: mldYM/IW4M-Admin
 public ServerStats(EFServer sv, EFServerStatistics st)
 {
     PlayerStats      = new ConcurrentDictionary <int, EFClientStatistics>();
     PlayerDetections = new ConcurrentDictionary <int, Detection>();
     ServerStatistics = st;
     Server           = sv;
 }
コード例 #3
0
 public ServerStats(EFServer sv, EFServerStatistics st, Server server)
 {
     HitCache         = new List <EFClientKill>();
     ServerStatistics = st;
     Server           = sv;
     _server          = server;
     OnSaving         = new SemaphoreSlim(1, 1);
 }