public static Formats.Rendering.Shdr ParseShdr(this SsbhParser parser) { var result = new Formats.Rendering.Shdr(); result.Magic = parser.ReadUInt32(); result.MajorVersion = parser.ReadUInt16(); result.MinorVersion = parser.ReadUInt16(); { // TODO: Extract this code to a method? long absoluteOffset = parser.ReadRelativeGetAbsoluteOffset(); long elementCount = parser.ReadInt64(); long previousPosition = parser.Position; parser.Seek(absoluteOffset); result.Shaders = new Formats.Rendering.ShdrShader[elementCount]; for (int i = 0; i < elementCount; i++) { result.Shaders[i] = parser.ParseShdrShader(); } parser.Seek(previousPosition); } return(result); }