예제 #1
0
 public BText(uint fnum, XmlElement ruch)
     : base(fnum)
 {
     hftbl = HuffText.getHuffText();
     byte[] data = SkyDisk.get().readFile((int)fnum);
     ruCharNode = ruch;
     prepare(data);
 }
예제 #2
0
        void appendText(ref List <UInt16> bs, ref List <UInt16> skp, ref List <byte> txtdata, ref uint bitbuf, ref int bitpos, int blk, int N, string val)
        {
            int  ppos = txtdata.Count;
            int  pbit = bitpos;
            char c    = (char)0;

            do
            {
                c = HuffText.nextChar(ref val);
                int  bits = 0;
                uint code = getCharCode(c, ref bits);
                addBits(ref txtdata, ref bitbuf, ref bitpos, code, bits);
            } while (c != (char)0);
            if (bitpos % 2 != 0)
            {
                addBits(ref txtdata, ref bitbuf, ref bitpos, 0, 1);
            }
            if (N == 31)
            {
                int bppos = 0;
                int pblk  = blk - 1;
                while (pblk >= 0)
                {
                    bppos += bs[pblk];
                    pblk--;
                }
                bs[blk] = (ushort)subOfs(bppos, 0, txtdata.Count, bitpos, true);
                bs.Add(0);
                for (int i = 0; i < 32; i++)
                {
                    skp.Add(0);
                }
            }
            else
            {
                ushort sofs = (ushort)subOfs(ppos, pbit, txtdata.Count, bitpos, false);
                if (sofs > 0x7F)
                {
                    while ((sofs & 0x07) != 0)
                    {
                        addBits(ref txtdata, ref bitbuf, ref bitpos, 0, 2);
                        sofs = (ushort)subOfs(ppos, pbit, txtdata.Count, bitpos, false);
                    }
                }
                skp[blk * 32 + N] = sofs;
            }
        }