コード例 #1
0
ファイル: LogParser.cs プロジェクト: encratite/BeRated
        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);
        }
コード例 #2
0
ファイル: LogParser.cs プロジェクト: encratite/BeRated
        public Assist ReadPlayerAssist(string line)
        {
            var match = AssistPattern.Match(line);

            if (!match.Success)
            {
                return(null);
            }
            var    reader           = new MatchReader(match);
            var    time             = ReadDate(reader);
            string assistantName    = reader.String();
            string assistantSteamId = reader.String();
            var    assistantTeam    = reader.Team();
            string victimName       = reader.String();
            string victimSteamId    = reader.String();
            var    victimTeam       = reader.Team();
            var    assist           = new Assist
            {
                Time          = time,
                Assistant     = GetPlayer(assistantName, assistantSteamId, time),
                AssistantTeam = assistantTeam,
                Victim        = GetPlayer(victimName, victimSteamId, time),
                VictimTeam    = victimTeam,
            };

            return(assist);
        }
コード例 #3
0
ファイル: LogParser.cs プロジェクト: encratite/BeRated
        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);
        }
コード例 #4
0
ファイル: LogParser.cs プロジェクト: encratite/BeRated
        public string ReadMap(string line)
        {
            var match = MatchStartPattern.Match(line);

            if (!match.Success)
            {
                return(null);
            }
            var    reader = new MatchReader(match);
            var    time   = ReadDate(reader);
            string map    = reader.String();

            return(map);
        }
コード例 #5
0
ファイル: LogParser.cs プロジェクト: encratite/BeRated
        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);
        }
コード例 #6
0
ファイル: LogParser.cs プロジェクト: encratite/BeRated
        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);
        }
コード例 #7
0
ファイル: LogParser.cs プロジェクト: encratite/BeRated
        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);
        }
コード例 #8
0
ファイル: LogParser.cs プロジェクト: encratite/BeRated
        public 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();
            var    team    = reader.Team();
            string item    = reader.String();
            var    output  = new Purchase
            {
                Time   = time,
                Player = GetPlayer(name, steamId, time),
                Team   = team,
                Item   = item
            };

            return(output);
        }
コード例 #9
0
ファイル: LogParser.cs プロジェクト: encratite/BeRated
        public 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 = GetPlayer(name, steamId, time),
                Team   = team,
                Reason = reason,
            };

            return(output);
        }
コード例 #10
0
ファイル: LogParser.cs プロジェクト: encratite/BeRated
        public 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();
            var    previousTeam = reader.Team();
            var    currentTeam  = reader.Team();
            var    output       = new TeamSwitch
            {
                Time         = time,
                Player       = GetPlayer(name, steamId, time),
                PreviousTeam = previousTeam,
                CurrentTeam  = currentTeam,
            };

            return(output);
        }