コード例 #1
0
ファイル: Puzzle.cs プロジェクト: a-kr/jsyoda
        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));
            }
        }
コード例 #2
0
ファイル: Script.cs プロジェクト: a-kr/jsyoda
        public void Deserialize(YodaReader stream)
        {
            this.Code = stream.ReadShort();
            this.Arg1 = stream.ReadShort();
            this.Arg2 = stream.ReadShort();
            this.Arg3 = stream.ReadShort();
            this.Arg4 = stream.ReadShort();
            this.Arg5 = stream.ReadShort();

            this.Str = stream.ReadLengthPrefixedString();
        }