private Sequence(Stream inputStream) { inputStream.MustReadAndSeek(); if (inputStream.Length < MinimumLength) { throw new InvalidDataException("Invalid header length"); } var stream = new SubStream(inputStream, inputStream.Position, inputStream.Length - inputStream.Position); var header = BinaryMapping.ReadObject <Header>(stream); if (header.MagicCode != MagicCodeValidator) { throw new InvalidDataException("Invalid header"); } Unknown04 = header.Unknown04; Sprites = stream.ReadList <RawSprite>(header.SpriteDesc.Offset, header.SpriteDesc.Count) .Select(x => new Sprite { Left = x.Left, Top = x.Top, Right = x.Right, Bottom = x.Bottom, UTranslation = x.UTranslation, VTranslation = x.VTranslation, ColorLeft = x.ColorLeft, ColorTop = x.ColorTop, ColorRight = x.ColorRight, ColorBottom = x.ColorBottom, }).ToList(); var spritePart = stream.ReadList <SpritePart>(header.SpritePartDesc.Offset, header.SpritePartDesc.Count); SpriteGroups = stream.ReadList <RawSpriteGroup>(header.SpriteGroupDesc.Offset, header.SpriteGroupDesc.Count) .Select(x => spritePart.Skip(x.Start).Take(x.Count).ToList()).ToList(); var animations = stream.ReadList <Animation>(header.AnimationDesc.Offset, header.AnimationDesc.Count); AnimationGroups = stream.ReadList <RawAnimationGroup>(header.AnimationGroupDesc.Offset, header.AnimationGroupDesc.Count) .Select(x => new AnimationGroup { Animations = animations.Skip(x.AnimationIndex).Take(x.Count).ToList(), DoNotLoop = x.DoNotLoop, Unknown06 = x.Unknown06, LoopStart = x.LoopStart, LoopEnd = x.LoopEnd, LightPositionX = x.Unknown10, TextPositionY = x.Unknown14, TextScale = x.Unknown18, UiPadding = x.Unknown1C, TextPositionX = x.Unknown20, }).ToList(); }