HaloMap.RawData.BitmapRaw.ReadCEBitmapRaw C# (CSharp) Method

ReadCEBitmapRaw() public method

The read ce bitmap raw.
public ReadCEBitmapRaw ( int TagIndex, Map map, bool dontreadraw ) : void
TagIndex int The TagIndex.
map HaloMap.Map.Map The map.
dontreadraw bool The dontreadraw.
return void
        public void ReadCEBitmapRaw(int TagIndex, Map map, bool dontreadraw)
        {
            if (map.MetaInfo.external[TagIndex])
            {
                map.BR.BaseStream.Position = map.MetaInfo.Offset[TagIndex] + 84;
                int rawcount = map.BR.ReadInt32();
                map.BR.BaseStream.Position = map.MetaInfo.Offset[TagIndex] + 100;
                int translation = map.BR.ReadInt32();
                for (int x = 0; x < rawcount; x++)
                {
                    BitmapRawDataChunk Raw = new BitmapRawDataChunk();
                    Raw.inchunk = x;
                    Raw.num = 0;
                    Raw.rawDataType = RawDataType.bitm;
                    Raw.pointerMetaOffset = (x * 48) + translation + 24;
                    map.BR.BaseStream.Position = map.MetaInfo.Offset[TagIndex] + Raw.pointerMetaOffset;
                    Raw.offset = map.BR.ReadInt32();
                    Raw.size = map.BR.ReadInt32();
                    Raw.rawLocation = MapTypes.Bitmaps;

                    try
                    {
                        if (dontreadraw == false)
                        {
                            // map.OpenMap(Raw.rawLocation);
                            map.BR.BaseStream.Position = Raw.offset;
                            Raw.MS = new MemoryStream(Raw.size);
                            Raw.MS.Write(map.BR.ReadBytes(Raw.size), 0, Raw.size);

                            // map.OpenMap(MapTypes.Internal);
                        }

                        this.rawChunks.Add(Raw);
                    }
                    catch
                    {
                    }
                }

                // m.CloseMap();
            }
            else
            {
                map.BR.BaseStream.Position = map.MetaInfo.Offset[TagIndex] + 96;
                int tempc = map.BR.ReadInt32();
                int tempr = map.BR.ReadInt32() - map.PrimaryMagic - map.MetaInfo.Offset[TagIndex];
                for (int x = 0; x < tempc; x++)
                {
                    BitmapRawDataChunk Raw = new BitmapRawDataChunk();
                    Raw.inchunk = x;
                    Raw.num = 0;
                    Raw.pointerMetaOffset = tempr + (x * 48) + 24;
                    map.BR.BaseStream.Position = Raw.pointerMetaOffset + map.MetaInfo.Offset[TagIndex];
                    Raw.rawDataType = RawDataType.bitm;
                    Raw.offset = map.BR.ReadInt32();
                    Raw.size = map.BR.ReadInt32();
                    Raw.rawLocation = MapTypes.Internal;

                    if (dontreadraw == false)
                    {
                        // map.OpenMap(Raw.rawLocation);
                        map.BR.BaseStream.Position = Raw.offset;
                        Raw.MS = new MemoryStream(Raw.size);
                        Raw.MS.Write(map.BR.ReadBytes(Raw.size), 0, Raw.size);

                        // map.OpenMap(MapTypes.Internal);
                    }

                    this.rawChunks.Add(Raw);
                }
            }
        }