public void Deserialize(YodaReader stream) { int n; stream.ExpectAtCurrentPos("IACT"); stream.ReadN(4); stream.ReadLong(); // length n = stream.ReadShort(); this.Conditions = stream.ReadObjectArray<ScriptCondition>(n); n = stream.ReadShort(); this.Actions = stream.ReadObjectArray<ScriptAction>(n); }
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)); } }
private void ReadIzaStuff(YodaReader stream) { //stream.ReadUntil("IZAX"); stream.ExpectAtCurrentPos("IZAX"); this.ReadIzax(stream); stream.ExpectAtCurrentPos("IZX2"); //IZAXTail = stream.ReadUntil("IZX2").Bytes; IZX2 = stream.ReadUntil("IZX3").Bytes; IZX3 = stream.ReadUntil("IZX4").Bytes; IZX4 = stream.ReadUntil("IACT", "IZON", "PUZ2").Bytes; }
public void Deserialize(YodaReader stream) { var puzzles = new List<Ipuz>(); stream.Seek(0x457048, System.IO.SeekOrigin.Begin); stream.ExpectAtCurrentPos("PUZ2"); stream.ReadLong(); // PUZ2 stream.ReadLong(); // skip length while (stream.CurrentPosContainsAtOffset("IPUZ", 2)) { var ipuz = new Ipuz(); ipuz.Deserialize(stream); puzzles.Add(ipuz); } this.Puzzles = puzzles.ToArray(); }