Exemplo n.º 1
0
        public static EndOfRound ReadEndOfRound(string line)
        {
            var match = EndOfRoundPattern.Match(line);

            if (!match.Success)
            {
                return(null);
            }
            var    reader                = new MatchReader(match);
            var    time                  = ReadDate(reader);
            string triggeringTeam        = reader.String();
            string sfuiNotice            = reader.String();
            int    counterTerroristScore = reader.Int();
            int    terroristScore        = reader.Int();
            var    output                = new EndOfRound
            {
                Time                  = time,
                TriggeringTeam        = triggeringTeam,
                SfuiNotice            = sfuiNotice,
                TerroristScore        = terroristScore,
                CounterTerroristScore = counterTerroristScore,
            };

            return(output);
        }
Exemplo n.º 2
0
        static DateTime ReadDate(MatchReader reader)
        {
            int month  = reader.Int();
            int day    = reader.Int();
            int year   = reader.Int();
            int hour   = reader.Int();
            int minute = reader.Int();
            int second = reader.Int();
            var output = new DateTime(year, month, day, hour, minute, second);

            return(output);
        }
Exemplo n.º 3
0
        public static int?ReadMaxRounds(string line)
        {
            var match = MaxRoundsPattern.Match(line);

            if (!match.Success)
            {
                return(null);
            }
            var reader = new MatchReader(match);

            ReadDate(reader);
            int maxRounds = reader.Int();

            return(maxRounds);
        }
Exemplo n.º 4
0
        public static PlayerKill ReadPlayerKill(string line)
        {
            var match = KillPattern.Match(line);

            if (!match.Success)
            {
                return(null);
            }
            var    reader        = new MatchReader(match);
            var    time          = ReadDate(reader);
            string killerName    = reader.String();
            string killerSteamId = reader.String();
            string killerTeam    = reader.String();
            int    killerX       = reader.Int();
            int    killerY       = reader.Int();
            int    killerZ       = reader.Int();
            string victimName    = reader.String();
            string victimSteamId = reader.String();
            string victimTeam    = reader.String();
            int    victimX       = reader.Int();
            int    victimY       = reader.Int();
            int    victimZ       = reader.Int();
            string weapon        = reader.String();
            bool   headshot      = reader.String() != "";
            var    output        = new PlayerKill
            {
                Time           = time,
                Killer         = new PlayerIdentity(killerName, killerSteamId),
                KillerTeam     = killerTeam,
                KillerPosition = new Vector(killerX, killerY, killerZ),
                Victim         = new PlayerIdentity(victimName, victimSteamId),
                VictimTeam     = victimTeam,
                VictimPosition = new Vector(victimX, victimY, victimZ),
                Headshot       = headshot,
                Weapon         = weapon,
            };

            return(output);
        }
Exemplo n.º 5
0
        public static Purchase ReadPurchase(string line)
        {
            var match = PurchasePattern.Match(line);

            if (!match.Success)
            {
                return(null);
            }
            var    reader  = new MatchReader(match);
            var    time    = ReadDate(reader);
            string name    = reader.String();
            string steamId = reader.String();
            string team    = reader.String();
            string item    = reader.String();
            var    output  = new Purchase
            {
                Time   = time,
                Player = new PlayerIdentity(name, steamId),
                Team   = team,
                Item   = item
            };

            return(output);
        }
Exemplo n.º 6
0
        public static Disconnect ReadDisconnect(string line)
        {
            var match = DisconnectPattern.Match(line);

            if (!match.Success)
            {
                return(null);
            }
            var    reader  = new MatchReader(match);
            var    time    = ReadDate(reader);
            string name    = reader.String();
            string steamId = reader.String();
            string team    = reader.String();
            string reason  = reader.String();
            var    output  = new Disconnect
            {
                Time   = time,
                Player = new PlayerIdentity(name, steamId),
                Team   = team,
                Reason = reason,
            };

            return(output);
        }
Exemplo n.º 7
0
        public static TeamSwitch ReadTeamSwitch(string line)
        {
            var match = TeamSwitchPattern.Match(line);

            if (!match.Success)
            {
                return(null);
            }
            var    reader       = new MatchReader(match);
            var    time         = ReadDate(reader);
            string name         = reader.String();
            string steamId      = reader.String();
            string previousTeam = reader.String();
            string currentTeam  = reader.String();
            var    output       = new TeamSwitch
            {
                Time         = time,
                Player       = new PlayerIdentity(name, steamId),
                PreviousTeam = previousTeam,
                CurrentTeam  = currentTeam,
            };

            return(output);
        }