public void Deserialize(YodaReader stream) { this.Id = stream.ReadShort(); stream.ExpectAtCurrentPos("IPUZ"); stream.ReadLong(); // skip IPUZ this.ByteLength = stream.ReadLong(); var endPosition = stream.S.Position + this.ByteLength; this.TailSize = 8;// GetTailSize(this.Id); var tailPosition = endPosition - this.TailSize; this.PuzzleType = stream.ReadUnsignedLong(); this.Head2_u32 = stream.ReadUnsignedLong(); this.Head3_u32 = stream.ReadUnsignedLong(); this.Head4_u16 = stream.ReadShort(); var strings = new List<string>(); while (stream.S.Position < tailPosition) { strings.Add(stream.ReadLengthPrefixedString().Replace("\r", "\\r").Replace("\n", "\\n").Replace(";", ",")); } this.Strings = strings.ToArray(); this.Tail1_u16 = stream.ReadShort(); this.Tail2_u16 = stream.ReadShort(); this.RewardItem = stream.ReadShort(); if (this.TailSize > 6) { this.Tail3_u16 = stream.ReadShort(); } if (stream.S.Position != endPosition) { this.SizeError = (int)(stream.S.Position - endPosition); stream.S.Seek(endPosition, System.IO.SeekOrigin.Begin); //throw new Exception(string.Format("Expected to end at {0}, actual position is {1}", endPosition, stream.S.Position)); } }