Exemplo n.º 1
0
 public void WriteTree(DeflaterHuffman.Tree blTree)
 {
     int code = -1;
     int index = 0;
     while (index < this.numCodes)
     {
         int num;
         int num2;
         int num3 = 1;
         int num6 = this.length[index];
         if (num6 == 0)
         {
             num = 0x8a;
             num2 = 3;
         }
         else
         {
             num = 6;
             num2 = 3;
             if (code != num6)
             {
                 blTree.WriteSymbol(num6);
                 num3 = 0;
             }
         }
         code = num6;
         index++;
         while ((index < this.numCodes) && (code == this.length[index]))
         {
             index++;
             if (++num3 >= num)
             {
                 break;
             }
         }
         if (num3 < num2)
         {
             while (num3-- > 0)
             {
                 blTree.WriteSymbol(code);
             }
         }
         else if (code != 0)
         {
             blTree.WriteSymbol(0x10);
             this.dh.pending.WriteBits(num3 - 3, 2);
         }
         else
         {
             if (num3 <= 10)
             {
                 blTree.WriteSymbol(0x11);
                 this.dh.pending.WriteBits(num3 - 3, 3);
                 continue;
             }
             blTree.WriteSymbol(0x12);
             this.dh.pending.WriteBits(num3 - 11, 7);
         }
     }
 }