Beispiel #1
0
 public LzxDecoder(int window)
 {
   uint num1 = (uint) (1 << window);
   if (window < 15 || window > 21)
     throw new UnsupportedWindowSizeRange();
   this.m_state = new LzxDecoder.LzxState();
   this.m_state.actual_size = 0U;
   this.m_state.window = new byte[(IntPtr) num1];
   for (int index = 0; (long) index < (long) num1; ++index)
     this.m_state.window[index] = (byte) 220;
   this.m_state.actual_size = num1;
   this.m_state.window_size = num1;
   this.m_state.window_posn = 0U;
   if (LzxDecoder.extra_bits == null)
   {
     LzxDecoder.extra_bits = new byte[52];
     int index = 0;
     int num2 = 0;
     while (index <= 50)
     {
       LzxDecoder.extra_bits[index] = LzxDecoder.extra_bits[index + 1] = (byte) num2;
       if (index != 0 && num2 < 17)
         ++num2;
       index += 2;
     }
   }
   if (LzxDecoder.position_base == null)
   {
     LzxDecoder.position_base = new uint[51];
     int index = 0;
     int num2 = 0;
     for (; index <= 50; ++index)
     {
       LzxDecoder.position_base[index] = (uint) num2;
       num2 += 1 << (int) LzxDecoder.extra_bits[index];
     }
   }
   int num3 = window != 20 ? (window != 21 ? window << 1 : 50) : 42;
   this.m_state.R0 = this.m_state.R1 = this.m_state.R2 = 1U;
   this.m_state.main_elements = (ushort) (256 + (num3 << 3));
   this.m_state.header_read = 0;
   this.m_state.frames_read = 0U;
   this.m_state.block_remaining = 0U;
   this.m_state.block_type = LzxConstants.BLOCKTYPE.INVALID;
   this.m_state.intel_curpos = 0;
   this.m_state.intel_started = 0;
   this.m_state.PRETREE_table = new ushort[104];
   this.m_state.PRETREE_len = new byte[84];
   this.m_state.MAINTREE_table = new ushort[5408];
   this.m_state.MAINTREE_len = new byte[720];
   this.m_state.LENGTH_table = new ushort[4596];
   this.m_state.LENGTH_len = new byte[314];
   this.m_state.ALIGNED_table = new ushort[144];
   this.m_state.ALIGNED_len = new byte[72];
   for (int index = 0; index < 656; ++index)
     this.m_state.MAINTREE_len[index] = (byte) 0;
   for (int index = 0; index < 250; ++index)
     this.m_state.LENGTH_len[index] = (byte) 0;
 }
Beispiel #2
0
        public LzxDecoder(int window)
        {
            uint num1 = (uint)(1 << window);

            if (window < 15 || window > 21)
            {
                throw new UnsupportedWindowSizeRange();
            }
            this.m_state             = new LzxDecoder.LzxState();
            this.m_state.actual_size = 0U;
            this.m_state.window      = new byte[(IntPtr)num1];
            for (int index = 0; (long)index < (long)num1; ++index)
            {
                this.m_state.window[index] = (byte)220;
            }
            this.m_state.actual_size = num1;
            this.m_state.window_size = num1;
            this.m_state.window_posn = 0U;
            if (LzxDecoder.extra_bits == null)
            {
                LzxDecoder.extra_bits = new byte[52];
                int index = 0;
                int num2  = 0;
                while (index <= 50)
                {
                    LzxDecoder.extra_bits[index] = LzxDecoder.extra_bits[index + 1] = (byte)num2;
                    if (index != 0 && num2 < 17)
                    {
                        ++num2;
                    }
                    index += 2;
                }
            }
            if (LzxDecoder.position_base == null)
            {
                LzxDecoder.position_base = new uint[51];
                int index = 0;
                int num2  = 0;
                for (; index <= 50; ++index)
                {
                    LzxDecoder.position_base[index] = (uint)num2;
                    num2 += 1 << (int)LzxDecoder.extra_bits[index];
                }
            }
            int num3 = window != 20 ? (window != 21 ? window << 1 : 50) : 42;

            this.m_state.R0              = this.m_state.R1 = this.m_state.R2 = 1U;
            this.m_state.main_elements   = (ushort)(256 + (num3 << 3));
            this.m_state.header_read     = 0;
            this.m_state.frames_read     = 0U;
            this.m_state.block_remaining = 0U;
            this.m_state.block_type      = LzxConstants.BLOCKTYPE.INVALID;
            this.m_state.intel_curpos    = 0;
            this.m_state.intel_started   = 0;
            this.m_state.PRETREE_table   = new ushort[104];
            this.m_state.PRETREE_len     = new byte[84];
            this.m_state.MAINTREE_table  = new ushort[5408];
            this.m_state.MAINTREE_len    = new byte[720];
            this.m_state.LENGTH_table    = new ushort[4596];
            this.m_state.LENGTH_len      = new byte[314];
            this.m_state.ALIGNED_table   = new ushort[144];
            this.m_state.ALIGNED_len     = new byte[72];
            for (int index = 0; index < 656; ++index)
            {
                this.m_state.MAINTREE_len[index] = (byte)0;
            }
            for (int index = 0; index < 250; ++index)
            {
                this.m_state.LENGTH_len[index] = (byte)0;
            }
        }