コード例 #1
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);
        }
コード例 #2
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);
        }
コード例 #3
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);
        }
コード例 #4
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);
        }
コード例 #5
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);
        }
コード例 #6
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);
        }
コード例 #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);
        }