public static void Dump(Options options) { using (var streamProvider = new PipBoyStreamProvider(options.RawFile)) { Stream stream; if (options.Host != null) { stream = streamProvider.Connect(options.Host, options.Port); } else if (options.InputFile != null) { stream = streamProvider.ReadFile(options.InputFile); } else { throw new ArgumentException(); } using (stream) { var dumper = new Dumper(options.GameobjectsFile); var dumpThread = new Thread(_ => dumper.Dump(stream)); dumpThread.Start(); Console.WriteLine("Dump running... press key to exit"); while (dumpThread.IsAlive && !Console.KeyAvailable) { Thread.Sleep(100); } dumper.SignalStop(); dumpThread.Join(); } } }
static void MainSimple(string[] args) { using (var streamProvider = new PipBoyStreamProvider()) using (var stream = streamProvider.ReadFile("data.dump")) { var gameStateReader = new GameStateReader(stream); while (gameStateReader.NextState()) { Console.WriteLine("Player X position: " + (float)gameStateReader.GameState.Map.World.Player.X); } } }
static void Main(string[] args) { using (var streamProvider = new PipBoyStreamProvider(DebugSettings.DumpTcpStream ? DebugSettings.TcpDumpFile : null)) { var stream = DebugSettings.UseTcp ? streamProvider.Connect(DebugSettings.Host, DebugSettings.Port) : streamProvider.ReadFile(DebugSettings.InputFile); using (stream) { ReadStream(stream); } } if (Debugger.IsAttached) { Console.WriteLine("finished"); Console.ReadLine(); } }