Ejemplo n.º 1
0
        public Round ReadEndOfRound(string line)
        {
            var match = EndOfRoundPattern.Match(line);

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

            return(output);
        }
Ejemplo n.º 2
0
        public int?ReadServerVersion(string line)
        {
            var match = LogFileStartedPattern.Match(line);

            if (!match.Success)
            {
                return(null);
            }
            var reader  = new MatchReader(match);
            var time    = ReadDate(reader);
            int version = reader.Int();

            return(version);
        }
Ejemplo n.º 3
0
        public 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);
        }
Ejemplo n.º 4
0
        private 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);
        }
Ejemplo n.º 5
0
        public Kill 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();
            var    killerTeam    = reader.Team();
            int    killerX       = reader.Int();
            int    killerY       = reader.Int();
            int    killerZ       = reader.Int();
            string victimName    = reader.String();
            string victimSteamId = reader.String();
            var    victimTeam    = reader.Team();
            int    victimX       = reader.Int();
            int    victimY       = reader.Int();
            int    victimZ       = reader.Int();
            string weapon        = reader.String();
            string flags         = reader.String();
            bool   headshot      = flags.Contains("headshot");
            bool   penetrated    = flags.Contains("penetrated");
            var    kill          = new Kill
            {
                Time           = time,
                Killer         = GetPlayer(killerName, killerSteamId, time),
                KillerTeam     = killerTeam,
                KillerPosition = new Vector(killerX, killerY, killerZ),
                Victim         = GetPlayer(victimName, victimSteamId, time),
                VictimTeam     = victimTeam,
                VictimPosition = new Vector(victimX, victimY, victimZ),
                Headshot       = headshot,
                Penetrated     = penetrated,
                Weapon         = weapon,
            };

            return(kill);
        }