Esempio n. 1
0
        private bool ReadMAIN()
        {
            try
            {
                var dataHeader = new DataChunkHeader(this);
                if (dataHeader.Token != Tokens.MAIN)
                {
                    throw new Exception($"Invalid token, got [{dataHeader.Token}] expected {"[MAIN]"}");
                }

                var byteChunk = this.ReadBytes(dataHeader.Size);
                SMAreaChunks = SMAreaInfo.BuildFromChunk(byteChunk);

                if (Globals.Verbose)
                {
                    Console.WriteLine($"Loaded {SMAreaChunks.Length} MapAreaChunks");
                    Console.WriteLine($"[MAIN] Success.");
                }
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return(false);
        }
Esempio n. 2
0
        private bool ReadMAIN()
        {
            try
            {
                if (this.IsEOF())
                {
                    return(false);
                }

                DataChunkHeader.Fill(this);
                if (DataChunkHeader.Token != Tokens.MAIN)
                {
                    throw new Exception($"Invalid token, got [{DataChunkHeader.Token}] expected {"[MAIN]"}");
                }

                for (int x = 0; x < 64; x++)
                {
                    for (int y = 0; y < 64; y++)
                    {
                        TileBlocksInformation[x, y] = new SMAreaInfo(this);
                    }
                }

                if (Globals.Verbose)
                {
                    Logger.Info($"Loaded {TileBlocksInformation.Length * TileBlocksInformation.Length} MapAreaChunks");
                }

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

            return(false);
        }