Example #1
0
        public bool TryAdd(ReadOnlySpan <char> logLine)
        {
            if (LevelLoad.TryParse(logLine, LogDate, out var ll))
            {
                Current = ll;
                LoadLevelList.Add(ll);
            }
            else if (TestDriveStart.TryParse(logLine, LogDate, out var std))
            {
                Current = std;
                StartTestDriveList.Add(std);
            }
            else if (TestDriveFinish.TryParse(logLine, LogDate, out var ftd))
            {
                Current = ftd;
                FinishTestDriveList.Add(ftd);
            }
            else if (GameStart.TryParse(logLine, LogDate, out var sg))
            {
                Current = sg;
                StartGameList.Add(sg);
            }
            else if (GameFinish.TryParse(logLine, LogDate, out var fg))
            {
                Current = fg;
                FinishGameList.Add(fg);
            }
            else if (GameRound.TryParse(logLine, LogDate, out var rg))
            {
                Current = rg;
                RoundGameList.Add(rg);
            }
            else if (ActiveBattleStart.TryParse(logLine, LogDate, out var sab))
            {
                Current = sab;
                StartActiveBattleList.Add(sab);
            }
            else if (PlayerLoad.TryParse(logLine, LogDate, out var pl))
            {
                Current = pl;
                PlayerLoadList.Add(pl);
            }
            else if (Damage.TryParse(logLine, LogDate, out var dmg))
            {
                Current = dmg;
                DamageList.Add(dmg);
            }
            else if (Killing.TryParse(logLine, LogDate, out var kill))
            {
                Current = kill;
                KillList.Add(kill);
            }
            else if (KillAssist.TryParse(logLine, LogDate, out var ka))
            {
                Current = ka;
                KillAssistList.Add(ka);
            }
            else if (Score.TryParse(logLine, LogDate, out var sc))
            {
                Current = sc;
                ScoreList.Add(sc);
            }
            else if (Decal.TryParse(logLine, LogDate, out var dec))
            {
                Current = dec;
                DecalList.Add(dec);
            }
            else
            {
                Current = null;
                return(false);
            }
            //update datetimes
            var currentDateTime = new DateTime(Current.TimeStamp);

            if (currentDateTime > Last)
            {
                Last = currentDateTime;
            }
            if (currentDateTime < First)
            {
                First = currentDateTime;
            }
            return(true);
        }