private void Analyze(string log) { var logLines = log.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); foreach (var rawLogLine in logLines) { var logLine = new string(rawLogLine.Skip(25).ToArray()); _gameState.CurrentOffset += logLine.Length + 1; if (logLine.StartsWith("[")) { GameV2.AddHSLogLine(logLine); API.LogEvents.OnLogLine.Execute(logLine); } if (logLine.StartsWith("[Power] GameState.")) { _powerGameStateLineHandler.Handle(logLine, _gameState, _game); } else if (logLine.StartsWith("[Power]")) { _powerLineHandler.Handle(logLine, _gameState, _game); } else if (logLine.StartsWith("[Asset]")) { _assetHandler.Handle(logLine, _gameState, _game); } else if (logLine.StartsWith("[Bob]")) { _bobHandler.Handle(logLine, _gameState, _game); } else if (logLine.StartsWith("[Rachelle]")) { _rachelleHandler.Handle(logLine, _gameState, _game); } else if (logLine.StartsWith("[Zone]")) { _zoneHandler.Handle(logLine, _gameState); } else if (logLine.StartsWith("[Arena]")) { _arenaHandler.Handle(logLine, _gameState, _game); } if (_gameState.First) { break; } } }
private static void ProcessNewLines() { foreach (var item in ToProcess.Where(item => item.Value != null)) { foreach (var line in item.Value.Where(line => line != null)) { _game.GameTime.Time = line.Time; switch (line.Namespace) { case "Power": GameV2.AddHSLogLine(line.Line); PowerLineHandler.Handle(line.Line, _gameState, _game); API.LogEvents.OnPowerLogLine.Execute(line.Line); break; case "Zone": ZoneHandler.Handle(line.Line, _gameState); API.LogEvents.OnZoneLogLine.Execute(line.Line); break; case "Asset": AssetHandler.Handle(line.Line, _gameState, _game); API.LogEvents.OnAssetLogLine.Execute(line.Line); break; case "Bob": BobHandler.Handle(line.Line, _gameState, _game); API.LogEvents.OnBobLogLine.Execute(line.Line); break; case "Rachelle": RachelleHandler.Handle(line.Line, _gameState, _game); API.LogEvents.OnRachelleLogLine.Execute(line.Line); break; case "Arena": ArenaHandler.Handle(line.Line, _gameState, _game); API.LogEvents.OnArenaLogLine.Execute(line.Line); break; case "LoadingScreen": LoadingScreenHandler.Handle(line.Line, _gameState, _game); break; } } } ToProcess.Clear(); Helper.UpdateEverything(_game); }