Example #1
0
        public Map.Map ReadMap(int mapId)
        {
            D2pEntry            entry  = d2pEntries[mapId];
            FastBigEndianReader reader = new FastBigEndianReader(dataFile);

            reader.Seek(entry.BaseOffset + entry.Index, SeekOrigin.Begin);
            byte[]  data = reader.ReadBytes(entry.Size);
            Map.Map map  = new Map.Map(new FastBigEndianReader(data));
            return(map);
        }
Example #2
0
        private void Read(string path)
        {
            d2pEntries = new Dictionary <int, D2pEntry>();
            dataFile   = File.ReadAllBytes(path);
            FastBigEndianReader reader = new FastBigEndianReader(dataFile);

            if (!(reader.ReadByte() == 2) || !(reader.ReadByte() == 1))
            {
                //   log.Fatal("Erreur lecture map!");
            }
            else
            {
                reader.Seek(-24, SeekOrigin.End);

                var baseOffset = reader.ReadInt();
                var size       = reader.ReadInt();
                var mapsOffet  = reader.ReadInt();
                var mapsCount  = reader.ReadInt();
                var fileOffset = reader.ReadInt();
                var lenghtFile = reader.ReadInt();

                reader.Seek(fileOffset, SeekOrigin.Begin);
                for (int i = 0; i < lenghtFile; i++)
                {
                    string _loc15_ = reader.ReadUTF();
                    string _loc16_ = reader.ReadUTF();
                    //  _loc5_[_loc15_] = _loc16_;
                }

                reader.Seek(mapsOffet, SeekOrigin.Begin);
                for (int i = 0; i < mapsCount; i++)
                {
                    var mapId   = int.Parse(reader.ReadUTF().Remove(0, 2).Replace(".dlm", ""));
                    var index   = reader.ReadInt();
                    var sizeMap = reader.ReadInt();
                    d2pEntries[mapId] = new D2pEntry(index, sizeMap, baseOffset);
                }
            }
        }