Example #1
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;
            }
        }
Example #2
0
        private string makeRuString(string s)
        {
            string res = "";
            string cs  = "";
            string cmt = "";

            while ((cs = HuffText.replaceChar(HuffText.nextChar(ref s))) != string.Empty)
            {
                string st = Config.get().getCharInfo(cs, ref cmt);
                if (st == string.Empty)
                {
                    res += cs;
                }
                else
                {
                    res += st;
                }
            }
            return(res);
        }