public virtual GlobalGeometryPointDataIndexBlock[] ReadVertexpointindices(BinaryReader binaryReader)
 {
     var elementSize = Marshal.SizeOf(typeof(GlobalGeometryPointDataIndexBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     var vertexPointIndices = new GlobalGeometryPointDataIndexBlock[blamPointer.Count];
     using (binaryReader.BaseStream.Pin())
     {
         for (int i = 0; i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             vertexPointIndices[i] = new GlobalGeometryPointDataIndexBlock(binaryReader);
         }
     }
     return vertexPointIndices;
 }
 public virtual void WritePermutations(BinaryWriter binaryWriter)
 {
     var binaryReader = new BinaryReader(binaryWriter.BaseStream);
     var elementSize = Marshal.SizeOf(typeof(RenderModelPermutationBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     using (binaryWriter.BaseStream.Pin())
     {
         for (int i = 0; i < this.permutations.Length && i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             this.permutations[i].Write(binaryWriter);
         }
     }
 }
 public virtual void WriteEmptystring(BinaryWriter binaryWriter)
 {
     var binaryReader = new BinaryReader(binaryWriter.BaseStream);
     var elementSize = Marshal.SizeOf(typeof(GlobalGeometryCompressionInfoBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     using (binaryWriter.BaseStream.Pin())
     {
         for (int i = 0; i < this.eMPTYSTRING.Length && i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             this.eMPTYSTRING[i].Write(binaryWriter);
         }
     }
 }
 public virtual SectionRenderLeavesBlock[] ReadSectionrenderleaves(BinaryReader binaryReader)
 {
     var elementSize = Marshal.SizeOf(typeof(SectionRenderLeavesBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     var sectionRenderLeaves = new SectionRenderLeavesBlock[blamPointer.Count];
     using (binaryReader.BaseStream.Pin())
     {
         for (int i = 0; i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             sectionRenderLeaves[i] = new SectionRenderLeavesBlock(binaryReader);
         }
     }
     return sectionRenderLeaves;
 }
 public virtual void WriteFiles(BinaryWriter binaryWriter)
 {
     var binaryReader = new BinaryReader(binaryWriter.BaseStream);
     var elementSize = Marshal.SizeOf(typeof(TagImportFileBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     using (binaryWriter.BaseStream.Pin())
     {
         for (int i = 0; i < this.files.Length && i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             this.files[i].Write(binaryWriter);
         }
     }
 }
 public virtual GlobalErrorReportCategoriesBlock[] ReadErrors(BinaryReader binaryReader)
 {
     var elementSize = Marshal.SizeOf(typeof(GlobalErrorReportCategoriesBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     var errors = new GlobalErrorReportCategoriesBlock[blamPointer.Count];
     using (binaryReader.BaseStream.Pin())
     {
         for (int i = 0; i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             errors[i] = new GlobalErrorReportCategoriesBlock(binaryReader);
         }
     }
     return errors;
 }
 public virtual PrtInfoBlock[] ReadPrtinfo(BinaryReader binaryReader)
 {
     var elementSize = Marshal.SizeOf(typeof(PrtInfoBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     var pRTInfo = new PrtInfoBlock[blamPointer.Count];
     using (binaryReader.BaseStream.Pin())
     {
         for (int i = 0; i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             pRTInfo[i] = new PrtInfoBlock(binaryReader);
         }
     }
     return pRTInfo;
 }
 public virtual ErrorReportsBlock[] ReadReports(BinaryReader binaryReader)
 {
     var elementSize = Marshal.SizeOf(typeof(ErrorReportsBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     var reports = new ErrorReportsBlock[blamPointer.Count];
     using (binaryReader.BaseStream.Pin())
     {
         for (int i = 0; i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             reports[i] = new ErrorReportsBlock(binaryReader);
         }
     }
     return reports;
 }
 public virtual RenderModelNodeMapBlockOLD[] ReadNodemapold(BinaryReader binaryReader)
 {
     var elementSize = Marshal.SizeOf(typeof(RenderModelNodeMapBlockOLD));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     var nodeMapOLD = new RenderModelNodeMapBlockOLD[blamPointer.Count];
     using (binaryReader.BaseStream.Pin())
     {
         for (int i = 0; i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             nodeMapOLD[i] = new RenderModelNodeMapBlockOLD(binaryReader);
         }
     }
     return nodeMapOLD;
 }
 public virtual RenderModelInvalidSectionPairsBlock[] ReadInvalidsectionpairbits(BinaryReader binaryReader)
 {
     var elementSize = Marshal.SizeOf(typeof(RenderModelInvalidSectionPairsBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     var invalidSectionPairBits = new RenderModelInvalidSectionPairsBlock[blamPointer.Count];
     using (binaryReader.BaseStream.Pin())
     {
         for (int i = 0; i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             invalidSectionPairBits[i] = new RenderModelInvalidSectionPairsBlock(binaryReader);
         }
     }
     return invalidSectionPairBits;
 }
 public virtual void WriteInvalidsectionpairbits(BinaryWriter binaryWriter)
 {
     var binaryReader = new BinaryReader(binaryWriter.BaseStream);
     var elementSize = Marshal.SizeOf(typeof(RenderModelInvalidSectionPairsBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     using (binaryWriter.BaseStream.Pin())
     {
         for (int i = 0; i < this.invalidSectionPairBits.Length && i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             this.invalidSectionPairBits[i].Write(binaryWriter);
         }
     }
 }
 public virtual RenderModelCompoundNodeBlock[] ReadCompoundnodes(BinaryReader binaryReader)
 {
     var elementSize = Marshal.SizeOf(typeof(RenderModelCompoundNodeBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     var compoundNodes = new RenderModelCompoundNodeBlock[blamPointer.Count];
     using (binaryReader.BaseStream.Pin())
     {
         for (int i = 0; i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             compoundNodes[i] = new RenderModelCompoundNodeBlock(binaryReader);
         }
     }
     return compoundNodes;
 }
 public virtual RenderModelSectionDataBlock[] ReadSectiondata(BinaryReader binaryReader)
 {
     var elementSize = Marshal.SizeOf(typeof(RenderModelSectionDataBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     var sectionData = new RenderModelSectionDataBlock[blamPointer.Count];
     using (binaryReader.BaseStream.Pin())
     {
         for (int i = 0; i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             sectionData[i] = new RenderModelSectionDataBlock(binaryReader);
         }
     }
     return sectionData;
 }
 public virtual void WriteVertexpointindices(BinaryWriter binaryWriter)
 {
     var binaryReader = new BinaryReader(binaryWriter.BaseStream);
     var elementSize = Marshal.SizeOf(typeof(GlobalGeometryPointDataIndexBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     using (binaryWriter.BaseStream.Pin())
     {
         for (int i = 0; i < this.vertexPointIndices.Length && i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             this.vertexPointIndices[i].Write(binaryWriter);
         }
     }
 }
 public virtual GlobalGeometryMaterialBlock[] ReadMaterials(BinaryReader binaryReader)
 {
     var elementSize = Marshal.SizeOf(typeof(GlobalGeometryMaterialBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     var materials = new GlobalGeometryMaterialBlock[blamPointer.Count];
     using (binaryReader.BaseStream.Pin())
     {
         for (int i = 0; i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             materials[i] = new GlobalGeometryMaterialBlock(binaryReader);
         }
     }
     return materials;
 }
 public virtual PrtClusterBasisBlock[] ReadClusterbasis(BinaryReader binaryReader)
 {
     var elementSize = Marshal.SizeOf(typeof(PrtClusterBasisBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     var clusterBasis = new PrtClusterBasisBlock[blamPointer.Count];
     using (binaryReader.BaseStream.Pin())
     {
         for (int i = 0; i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             clusterBasis[i] = new PrtClusterBasisBlock(binaryReader);
         }
     }
     return clusterBasis;
 }
 public virtual void WriteMaterials(BinaryWriter binaryWriter)
 {
     var binaryReader = new BinaryReader(binaryWriter.BaseStream);
     var elementSize = Marshal.SizeOf(typeof(GlobalGeometryMaterialBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     using (binaryWriter.BaseStream.Pin())
     {
         for (int i = 0; i < this.materials.Length && i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             this.materials[i].Write(binaryWriter);
         }
     }
 }
 public virtual PrtRawPcaDataBlock[] ReadRawpcadata(BinaryReader binaryReader)
 {
     var elementSize = Marshal.SizeOf(typeof(PrtRawPcaDataBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     var rawPcaData = new PrtRawPcaDataBlock[blamPointer.Count];
     using (binaryReader.BaseStream.Pin())
     {
         for (int i = 0; i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             rawPcaData[i] = new PrtRawPcaDataBlock(binaryReader);
         }
     }
     return rawPcaData;
 }
 public virtual void WriteErrors(BinaryWriter binaryWriter)
 {
     var binaryReader = new BinaryReader(binaryWriter.BaseStream);
     var elementSize = Marshal.SizeOf(typeof(GlobalErrorReportCategoriesBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     using (binaryWriter.BaseStream.Pin())
     {
         for (int i = 0; i < this.errors.Length && i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             this.errors[i].Write(binaryWriter);
         }
     }
 }
 public virtual void WriteNodemapold(BinaryWriter binaryWriter)
 {
     var binaryReader = new BinaryReader(binaryWriter.BaseStream);
     var elementSize = Marshal.SizeOf(typeof(RenderModelNodeMapBlockOLD));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     using (binaryWriter.BaseStream.Pin())
     {
         for (int i = 0; i < this.nodeMapOLD.Length && i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             this.nodeMapOLD[i].Write(binaryWriter);
         }
     }
 }
 public virtual void WritePrtinfo(BinaryWriter binaryWriter)
 {
     var binaryReader = new BinaryReader(binaryWriter.BaseStream);
     var elementSize = Marshal.SizeOf(typeof(PrtInfoBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     using (binaryWriter.BaseStream.Pin())
     {
         for (int i = 0; i < this.pRTInfo.Length && i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             this.pRTInfo[i].Write(binaryWriter);
         }
     }
 }
 public virtual PrtVertexBuffersBlock[] ReadVertexbuffers(BinaryReader binaryReader)
 {
     var elementSize = Marshal.SizeOf(typeof(PrtVertexBuffersBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     var vertexBuffers = new PrtVertexBuffersBlock[blamPointer.Count];
     using (binaryReader.BaseStream.Pin())
     {
         for (int i = 0; i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             vertexBuffers[i] = new PrtVertexBuffersBlock(binaryReader);
         }
     }
     return vertexBuffers;
 }
 public virtual TagImportFileBlock[] ReadFiles(BinaryReader binaryReader)
 {
     var elementSize = Marshal.SizeOf(typeof(TagImportFileBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     var files = new TagImportFileBlock[blamPointer.Count];
     using (binaryReader.BaseStream.Pin())
     {
         for (int i = 0; i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             files[i] = new TagImportFileBlock(binaryReader);
         }
     }
     return files;
 }
 public virtual BspLeafBlock[] ReadCollisionleaves(BinaryReader binaryReader)
 {
     var elementSize = Marshal.SizeOf(typeof(BspLeafBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     var collisionLeaves = new BspLeafBlock[blamPointer.Count];
     using (binaryReader.BaseStream.Pin())
     {
         for (int i = 0; i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             collisionLeaves[i] = new BspLeafBlock(binaryReader);
         }
     }
     return collisionLeaves;
 }
 public virtual RenderModelPermutationBlock[] ReadPermutations(BinaryReader binaryReader)
 {
     var elementSize = Marshal.SizeOf(typeof(RenderModelPermutationBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     var permutations = new RenderModelPermutationBlock[blamPointer.Count];
     using (binaryReader.BaseStream.Pin())
     {
         for (int i = 0; i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             permutations[i] = new RenderModelPermutationBlock(binaryReader);
         }
     }
     return permutations;
 }
 public virtual BspSurfaceReferenceBlock[] ReadSurfacereferences(BinaryReader binaryReader)
 {
     var elementSize = Marshal.SizeOf(typeof(BspSurfaceReferenceBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     var surfaceReferences = new BspSurfaceReferenceBlock[blamPointer.Count];
     using (binaryReader.BaseStream.Pin())
     {
         for (int i = 0; i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             surfaceReferences[i] = new BspSurfaceReferenceBlock(binaryReader);
         }
     }
     return surfaceReferences;
 }
 public virtual GlobalGeometryCompressionInfoBlock[] ReadEmptystring(BinaryReader binaryReader)
 {
     var elementSize = Marshal.SizeOf(typeof(GlobalGeometryCompressionInfoBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     var eMPTYSTRING = new GlobalGeometryCompressionInfoBlock[blamPointer.Count];
     using (binaryReader.BaseStream.Pin())
     {
         for (int i = 0; i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             eMPTYSTRING[i] = new GlobalGeometryCompressionInfoBlock(binaryReader);
         }
     }
     return eMPTYSTRING;
 }
 public virtual RenderModelMarkerGroupBlock[] ReadMarkergroups(BinaryReader binaryReader)
 {
     var elementSize = Marshal.SizeOf(typeof(RenderModelMarkerGroupBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     var markerGroups = new RenderModelMarkerGroupBlock[blamPointer.Count];
     using (binaryReader.BaseStream.Pin())
     {
         for (int i = 0; i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             markerGroups[i] = new RenderModelMarkerGroupBlock(binaryReader);
         }
     }
     return markerGroups;
 }
 private void ValidateChildren(ElementArray elementArray, BinaryReader binaryReader, ref int nextAddress)
 {
     var childrenArrayPointers = (from child in elementArray.Children
                                  select new
                                  {
                                      ElementArray = child,
                                      ArrayPointer = new Func<BlamPointer>(() =>
                                      {
                                          using (binaryReader.BaseStream.Pin())
                                          {
                                              binaryReader.BaseStream.Seek(child.Address, SeekOrigin.Current);
                                              var arrayPointer = binaryReader.ReadBlamPointer(child.ElementSize);
                                              child.VirtualAddress = arrayPointer.Address;
                                              child.Count = arrayPointer.Count;
                                              return arrayPointer;
                                          }
                                      })()
                                  }).ToList();
     foreach (var child in childrenArrayPointers)
     {
         if (!ValidateBlamPointer(child.ArrayPointer, child.ElementArray, binaryReader.BaseStream as MapStream))
             continue;
         if (!(child.ArrayPointer.Count == 0 && child.ArrayPointer.Address == 0))
         {
             ValidateTagBlock(child.ElementArray, child.ArrayPointer, binaryReader, ref nextAddress);
         }
     }
 }
 public virtual GlobalGeometryRigidPointGroupBlock[] ReadRigidpointgroups(BinaryReader binaryReader)
 {
     var elementSize = Marshal.SizeOf(typeof(GlobalGeometryRigidPointGroupBlock));
     var blamPointer = binaryReader.ReadBlamPointer(elementSize);
     var rigidPointGroups = new GlobalGeometryRigidPointGroupBlock[blamPointer.Count];
     using (binaryReader.BaseStream.Pin())
     {
         for (int i = 0; i < blamPointer.Count; ++i)
         {
             binaryReader.BaseStream.Position = blamPointer[i];
             rigidPointGroups[i] = new GlobalGeometryRigidPointGroupBlock(binaryReader);
         }
     }
     return rigidPointGroups;
 }