HaloMap.RawData.Model.ReadH2ModelRaw C# (CSharp) Method

ReadH2ModelRaw() public method

The read h 2 model raw.
public ReadH2ModelRaw ( 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 ReadH2ModelRaw(int TagIndex, Map map, bool dontreadraw)
        {
            map.BR.BaseStream.Position = map.MetaInfo.Offset[TagIndex] + 36;
            int tempc = map.BR.ReadInt32();
            int tempr = map.BR.ReadInt32() - map.SecondaryMagic;
            for (int x = 0; x < tempc; x++)
            {
                RawDataChunk Raw = new RawDataChunk();
                Raw.pointerMetaOffset = tempr + (x * 92) + 56 - map.MetaInfo.Offset[TagIndex];
                map.BR.BaseStream.Position = map.MetaInfo.Offset[TagIndex] + Raw.pointerMetaOffset;
                Raw.rawDataType = RawDataType.mode1;
                Raw.offset = map.BR.ReadInt32();
                Raw.size = map.BR.ReadInt32();
                map.Functions.ParsePointer(ref Raw.offset, ref Raw.rawLocation);
                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);
            }

            map.BR.BaseStream.Position = map.MetaInfo.Offset[TagIndex] + 116;
            tempc = map.BR.ReadInt32();
            tempr = map.BR.ReadInt32() - map.SecondaryMagic;
            for (int x = 0; x < tempc; x++)
            {
                RawDataChunk Raw = new RawDataChunk();
                Raw.pointerMetaOffset = tempr + (x * 88) + 52 - map.MetaInfo.Offset[TagIndex];
                map.BR.BaseStream.Position = map.MetaInfo.Offset[TagIndex] + Raw.pointerMetaOffset;
                Raw.rawDataType = RawDataType.mode2;
                Raw.offset = map.BR.ReadInt32();
                Raw.size = map.BR.ReadInt32();
                map.Functions.ParsePointer(ref Raw.offset, ref Raw.rawLocation);
                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);
            }
        }