static void logParser_OnMetaData(GameLogParser source, string metaData) { GameLogMetaData md = GameLogMetaData.Parse(metaData); if (md == null) { source.ErrorCount++; Console.Error.WriteLine(source.GetDefaultErrorText("Unknown metadata: " + metaData)); } if (md.Name == "OnSessionBegin") { if (!md.Properties.ContainsKey("Repetition") || int.Parse(md.Properties["Repetition"]) == 0) { // The very first repetition. if (_cmdLine.SessionResult && _sessionGamesCount > 0) { _sessionResult.Print(_output); } if (_cmdLine.SessionResult) { _sessionResult = CreateGameLogReport(md.Properties.ContainsKey("Name") ? md.Properties["Name"] : "Unnamed session"); } _sessionGamesCount = 0; } } }
public void Test_Parse() { string mdString = "OnSessionBegin Name='sp-vs-raiser' Repetition='0' RngSeed='-580223114'"; GameLogMetaData md = GameLogMetaData.Parse(mdString); Assert.AreEqual("OnSessionBegin", md.Name); Assert.AreEqual(3, md.Properties.Count); Assert.AreEqual("sp-vs-raiser", md.Properties["Name"]); Assert.AreEqual("0", md.Properties["Repetition"]); Assert.AreEqual("-580223114", md.Properties["RngSeed"]); }