Example #1
0
 public BText(uint fnum)
     : base(fnum, ResView.TextViewcs.get())
 {
     hftbl = HuffText.getHuffText();
     byte[] data = getData();
     prepare(data);
 }
 public void fillTable()
 {
     tb.Rows.Clear();
     int[,] huff = HuffText.getHuffText();
     for (int i = 0; i < huff.Length / 3; i++)
     {
         if (huff[i, 0] == 0 && huff[i, 1] == 0 && huff[i, 2] != 0)
         {
             string en      = HuffText.replaceChar((char)huff[i, 2]);
             string comment = "";
             string ru      = Config.get().getCharInfo(en, ref comment);
             tb.Rows.Add(new object[] { en, ru, comment });
         }
     }
 }
Example #3
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 #4
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);
        }
Example #5
0
        private string getChar(ref int ofs, ref int bit)
        {
            int pos = 0;

            while (true)
            {
                if (getBit(ref ofs, ref bit))
                {
                    pos = hftbl[pos, 1];
                }
                else
                {
                    pos = hftbl[pos, 0];
                }
                if (hftbl[pos, 0] == 0 && hftbl[pos, 1] == 0)
                {
                    return(HuffText.replaceChar((char)hftbl[pos, 2]));
                }
            }
        }
Example #6
0
 public BText(byte[] data) : base(0, null)
 {
     hftbl = HuffText.getHuffText();
     prepare(data);
 }