public MaterialList_0008 Read(BinaryReader binaryReader) { sectionIdentifier = Section.MaterialList; sectionSize = binaryReader.ReadInt32(); renderWareVersion = binaryReader.ReadInt32(); Section materialListStructSection = (Section)binaryReader.ReadInt32(); if (materialListStructSection != Section.Struct) { throw new Exception(); } materialListStruct = new MaterialListStruct_0001().Read(binaryReader); materialList = new Material_0007[materialListStruct.materialCount]; for (int i = 0; i < materialListStruct.materialCount; i++) { Section materialSection = (Section)binaryReader.ReadInt32(); if (materialSection != Section.Material) { throw new Exception(); } materialList[i] = new Material_0007().Read(binaryReader); } return(this); }
public MaterialList_0008 Read(BinaryReader binaryReader) { sectionIdentifier = Section.MaterialList; sectionSize = binaryReader.ReadInt32(); renderWareVersion = binaryReader.ReadInt32(); int startOfSection = (int)binaryReader.BaseStream.Position; Section materialListStructSection = (Section)binaryReader.ReadInt32(); if (materialListStructSection != Section.Struct) { throw new Exception(); } materialListStruct = new MaterialListStruct_0001().Read(binaryReader); #if DEBUG List <Material_0007> materials = new List <Material_0007>(); for (int i = 0; binaryReader.BaseStream.Position < startOfSection + sectionSize; i++) { Section materialSection = (Section)binaryReader.ReadInt32(); if (materialSection != Section.Material) { throw new Exception(); } materials.Add(new Material_0007().Read(binaryReader)); } materialList = materials.ToArray(); materialListStruct.materialCount = materialList.Length; #else materialList = new Material_0007[materialListStruct.materialCount]; for (int i = 0; i < materialListStruct.materialCount; i++) { Section materialSection = (Section)binaryReader.ReadInt32(); if (materialSection != Section.Material) { throw new Exception(); } materialList[i] = new Material_0007().Read(binaryReader); } #endif return(this); }