コード例 #1
0
ファイル: ListLevel.cs プロジェクト: ztahlis/b2xtranslator
        /// <summary>
        /// Parses the given StreamReader to retrieve a LVL struct
        /// </summary>
        /// <param name="bytes"></param>
        public ListLevel(VirtualStreamReader reader, int length)
            : base(reader, length)
        {
            long startPos = this._reader.BaseStream.Position;

            //parse the fix part
            this.iStartAt = this._reader.ReadInt32();
            this.nfc      = this._reader.ReadByte();
            int flag = this._reader.ReadByte();

            this.jc         = (byte)(flag & 0x03);
            this.fLegal     = Utils.BitmaskToBool(flag, 0x04);
            this.fNoRestart = Utils.BitmaskToBool(flag, 0x08);
            this.fPrev      = Utils.BitmaskToBool(flag, 0x10);
            this.fPrevSpace = Utils.BitmaskToBool(flag, 0x20);
            this.fWord6     = Utils.BitmaskToBool(flag, 0x40);
            this.rgbxchNums = new byte[9];
            for (int i = 0; i < 9; i++)
            {
                this.rgbxchNums[i] = this._reader.ReadByte();
            }
            this.ixchFollow = (FollowingChar)this._reader.ReadByte();

            this.dxaSpace  = this._reader.ReadInt32();
            this.dxaIndent = this._reader.ReadInt32();

            this.cbGrpprlChpx = this._reader.ReadByte();
            this.cbGrpprlPapx = this._reader.ReadByte();

            this.ilvlRestartLim = this._reader.ReadByte();
            this.grfhic         = this._reader.ReadByte();

            //parse the variable part

            //read the group of papx sprms
            //this papx has no istd, so use PX to parse it
            var px = new PropertyExceptions(this._reader.ReadBytes(this.cbGrpprlPapx));

            this.grpprlPapx = new ParagraphPropertyExceptions
            {
                grpprl = px.grpprl
            };

            //read the group of chpx sprms
            this.grpprlChpx = new CharacterPropertyExceptions(this._reader.ReadBytes(this.cbGrpprlChpx));

            //read the number text
            short strLen = this._reader.ReadInt16();

            this.xst = Encoding.Unicode.GetString(this._reader.ReadBytes(strLen * 2));

            long endPos = this._reader.BaseStream.Position;

            this._reader.BaseStream.Seek(startPos, System.IO.SeekOrigin.Begin);
            this._rawBytes = this._reader.ReadBytes((int)(endPos - startPos));
        }
コード例 #2
0
 public override string ToString()
 {
     return("{MarkovPair: FollowingChar = \'" + FollowingChar.ToEscapeString() + "\', Count = " + Count.ToString() + "}");
 }