예제 #1
0
        private bool BuildMCIN(BinaryReader reader)
        {
            try
            {
                DataChunkHeader.Fill(reader);
                if (DataChunkHeader.Token != Tokens.MCIN)
                {
                    throw new Exception($"Invalid token, got [{DataChunkHeader.Token}] expected {"[MCIN]"}");
                }

                // All tiles should be used, meaming we should have valid offset and size for each tile.
                for (int x = 0; x < Constants.TileSize; x++)
                {
                    for (int y = 0; y < Constants.TileSize; y++)
                    {
                        TilesInformation[x, y] = new SMChunkInfo(reader);
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message);
            }

            return(false);
        }
예제 #2
0
        private bool BuildMCIN(BinaryReader reader)
        {
            try
            {
                var dataHeader = new DataChunkHeader(reader);
                if (dataHeader.Token != Tokens.MCIN)
                {
                    throw new Exception($"Invalid token, got [{dataHeader.Token}] expected {"[MCIN]"}");
                }

                var dataChunk = reader.ReadBytes(dataHeader.Size);
                ChunkInformation = SMChunkInfo.BuildFromChunk(dataChunk);
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return(false);
        }