public static Formats.Materials.MatlEntry ParseMatlEntry(this SsbhParser parser) { var result = new Formats.Materials.MatlEntry(); result.MaterialLabel = parser.ReadOffsetReadString(); { // TODO: Extract this code to a method? long absoluteOffset = parser.ReadRelativeGetAbsoluteOffset(); long elementCount = parser.ReadInt64(); long previousPosition = parser.Position; parser.Seek(absoluteOffset); result.Attributes = new Formats.Materials.MatlAttribute[elementCount]; for (int i = 0; i < elementCount; i++) { result.Attributes[i] = parser.ParseMatlAttribute(); } parser.Seek(previousPosition); } result.ShaderLabel = parser.ReadOffsetReadString(); return(result); }