private static Tuple <GetClientDetailedInfo, TS3Client> AnalyzeClientTuple(
            GetClientDetailedInfo tscl, TS3Client dbcl, TS3AnalyticsDbContext dbContext, DateTime timeStamp, DateTime endTime)
        {
            if (dbcl == null)
            {
                dbcl = new TS3Client
                {
                    Created              = timeStamp,
                    DatabaseId           = tscl.DatabaseId,
                    Id                   = Guid.NewGuid(),
                    UniqueIdentifier     = tscl.UniqueIdentifier,
                    TS3ClientConnections = new List <TS3ClientConnection>()
                };
                dbContext.TS3Clients.Add(dbcl);
            }

            dbcl.ChangeDate           = timeStamp;
            dbcl.LastConnected        = timeStamp;
            dbcl.NickName             = tscl.NickName;
            dbcl.TotalConnectionCount = tscl.TotalConnectionCount;
            dbcl.TS3Plattform         = tscl.Plattform;
            dbcl.TS3Version           = tscl.Version;

            dbContext.TS3ClientConnection.Add(new TS3ClientConnection
            {
                ChannelId      = tscl.ChannelId,
                ClientGuid     = dbcl.Id,
                Id             = Guid.NewGuid(),
                IncactiveSince = tscl.IdleTime,
                TimeStampStart = timeStamp,
                TimeStampEnd   = endTime
            });

            return(new Tuple <GetClientDetailedInfo, TS3Client>(tscl, dbcl));
        }
Exemplo n.º 2
0
        private static bool UpdateClientTime(DateTime lastRun, GetClientDetailedInfo clientInfo)
        {
            var client = ClientManager[clientInfo.DatabaseId.ToString()];

            if (client == null)
            {
                client = ClientManager.AddClient(new Client()
                {
                    ClientId    = clientInfo.DatabaseId.ToString(),
                    DisplayName = clientInfo.NickName,
                    ActiveTime  = TimeSpan.Zero
                });
            }

            var conditionAway  = (!clientInfo.Away && !ConfigManager.Config.LogAFK);
            var conditionMuted = (!clientInfo.IsOutputMuted() && !ConfigManager.Config.LogOutputMuted);

            if ((conditionAway && conditionMuted) && clientInfo.IdleTime < ConfigManager.Config.MaxIdleTime)
            {
                client.ActiveTime += (DateTime.Now - lastRun);
                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
 public static bool IsOutputMuted(this GetClientDetailedInfo clientInfo)
 {
     return(clientInfo.OutputMuted || clientInfo.OutputOnlyMuted);
 }