Exemplo n.º 1
0
        public static GameState GetGameState(FileSystemEntry entry, Game game)
        {
            using (var stream = entry.Open())
            {
                var reader = new StateReader(stream, game);

                while (true)
                {
                    var chunkName = "";
                    reader.PersistAsciiString(ref chunkName);

                    reader.BeginSegment(chunkName);

                    if (chunkName == "CHUNK_GameState")
                    {
                        var gameState = new GameState();
                        gameState.Persist(reader);
                        return(gameState);
                    }

                    reader.EndSegment();
                }
            }

            throw new InvalidStateException();
        }
Exemplo n.º 2
0
 public override uint BeginSegment(string segmentName)
 {
     return(_comparisonReader.BeginSegment(segmentName));
 }