Ejemplo n.º 1
0
        public string CreateLoginApiRejected()
        {
            var message = new ApiMessage()
            {
                Date = _dateProvider.GetEpoch(),
                Type = ApiMessageTypes.LoginApiRejected
            };

            return(message.Serialize());
        }
Ejemplo n.º 2
0
        public string CreateKick(string reason, string sender)
        {
            var message = new ApiMessage()
            {
                Date = _dateProvider.GetEpoch(),
                Type = ApiMessageTypes.DoKickOrDisconnect,
                Text = reason,
                Name = sender
            };

            return(message.Serialize());
        }
Ejemplo n.º 3
0
        public string CreateFetchLog(string name, bool success)
        {
            var message = new ApiMessage()
            {
                Date  = _dateProvider.GetEpoch(),
                Type  = ApiMessageTypes.FetchLogs,
                Text  = name != null ? $"{name}.csv" : null,
                Flags = new float[] { success ? 1 : 0 }
            };

            return(message.Serialize());
        }
Ejemplo n.º 4
0
        public string CreateConsoleLog(string text, string source)
        {
            var message = new ApiMessage()
            {
                Date = _dateProvider.GetEpoch(),
                Name = source,
                Text = text,
                Type = ApiMessageTypes.ConsoleLogMessage
            };

            return(message.Serialize());
        }
Ejemplo n.º 5
0
        public string CreateLoginApiAccepted()
        {
            var message = new ApiMessage()
            {
                Date = _dateProvider.GetEpoch(),
                Type = ApiMessageTypes.LoginApiAccepted,
                Name = "welcome",
                Text = "You have successfully connected to ImpostorHQ!"
            };

            return(message.Serialize());
        }
Ejemplo n.º 6
0
        public string CreateHeartBeat(int games, int players, int cpuUsagePercent, int memoryUsageBytes)
        {
            var message = new ApiMessage()
            {
                Date  = _dateProvider.GetEpoch(),
                Flags = new float[]
                {
                    games, players, (DateTime.Now - _startTime).Minutes, cpuUsagePercent, memoryUsageBytes / 1048576
                },
                Type = ApiMessageTypes.HeartbeatMessage
            };

            return(message.Serialize());
        }