public void ProcessTheRows(string line) { var action = _actionsRegex.Match(line); switch (action.Value) { case Consts.ShutdownGame: Game.Finished = true; break; case Consts.Exit: const string findText = " Exit: "; Game.EndReason = line.Substring(line.IndexOf(findText) + findText.Length); break; case Consts.Score: var matches = _scorecardRegex.Match(line); if (matches.Groups.Count == 3) { var s = int.Parse(matches.Groups[1].Value); var card = new Scorecard(s, matches.Groups[2].Value); Game.Scorecard.Add(card); } break; case Consts.InitGame: var nameMatch = _mapNameRegex.Match(line); Game.MapName = nameMatch.Groups[1].Value; break; default: break; } }
private void Score(string line) { var matches = _scorecardRegex.Match(line); if (matches.Groups.Count == 3) { var s = int.Parse(GetMatchValue(matches, 1)); var card = new Scorecard(s, GetMatchValue(matches, 2)); Game.Scorecard.Add(card); } }