예제 #1
0
 // Token: 0x06000733 RID: 1843 RVA: 0x0002EEB4 File Offset: 0x0002D0B4
 internal Class_193(Class_212 codec, object checkfn, int w)
 {
     this._codec  = codec;
     this.hufts   = new int[4320];
     this.window  = new byte[w];
     this.end     = w;
     this.checkfn = checkfn;
     this.mode    = Class_193.InflateBlockMode.TYPE;
     this.Reset();
 }
예제 #2
0
 // Token: 0x06000746 RID: 1862 RVA: 0x00031438 File Offset: 0x0002F638
 internal int Initialize(Class_212 codec, int w)
 {
     this._codec         = codec;
     this._codec.Message = null;
     this.blocks         = null;
     if (w < 8 || w > 15)
     {
         this.End();
         throw new Class_205("Bad window size.");
     }
     this.wbits  = w;
     this.blocks = new Class_193(codec, this.HandleRfc1950HeaderBytes ? this : null, 1 << w);
     this.Reset();
     return(0);
 }
예제 #3
0
        // Token: 0x0600074D RID: 1869 RVA: 0x00032228 File Offset: 0x00030428
        internal int inflate_trees_bits(int[] c, int[] bb, int[] tb, int[] hp, Class_212 z)
        {
            this.initWorkArea(19);
            this.hn[0] = 0;
            int num = this.huft_build(c, 0, 19, 19, null, null, tb, bb, hp, this.hn, this.v);

            if (num == -3)
            {
                z.Message = "oversubscribed dynamic bit lengths tree";
            }
            else if (num == -5 || bb[0] == 0)
            {
                z.Message = "incomplete dynamic bit lengths tree";
                num       = -3;
            }
            return(num);
        }
예제 #4
0
        // Token: 0x0600076C RID: 1900 RVA: 0x00032EFC File Offset: 0x000310FC
        private bool tmethod_1302(Class_198 arg_0)
        {
            Class_212 class_ = arg_0.field_7;

            class_.ResetDeflate();
            class_.NextIn            = 0;
            class_.AvailableBytesIn  = arg_0.field_5;
            class_.NextOut           = 0;
            class_.AvailableBytesOut = arg_0.field_1.Length;
            do
            {
                class_.Deflate(Class_201.None);
            }while (class_.AvailableBytesIn > 0 || class_.AvailableBytesOut == 0);
            class_.Deflate(Class_201.Sync);
            arg_0.field_6 = (int)class_.TotalBytesOut;
            return(true);
        }
예제 #5
0
        // Token: 0x06000763 RID: 1891 RVA: 0x00032928 File Offset: 0x00030B28
        private void gmethod_1293()
        {
            byte[]    array  = new byte[128];
            Class_212 class_ = new Class_212();
            int       num    = class_.InitializeDeflate(this.field_22, false);

            class_.InputBuffer       = null;
            class_.NextIn            = 0;
            class_.AvailableBytesIn  = 0;
            class_.OutputBuffer      = array;
            class_.NextOut           = 0;
            class_.AvailableBytesOut = array.Length;
            num = class_.Deflate(Class_201.Finish);
            if (num != 1 && num != 0)
            {
                throw new Exception("deflating: " + class_.Message);
            }
            if (array.Length - class_.AvailableBytesOut > 0)
            {
                this.field_5.Write(array, 0, array.Length - class_.AvailableBytesOut);
            }
            class_.EndDeflate();
            this.field_16 = this.field_17.prop_1;
        }
예제 #6
0
 // Token: 0x0600074A RID: 1866 RVA: 0x00031DA1 File Offset: 0x0002FFA1
 internal int SyncPoint(Class_212 z)
 {
     return(this.blocks.SyncPoint());
 }
예제 #7
0
        // Token: 0x0600073F RID: 1855 RVA: 0x00030D0C File Offset: 0x0002EF0C
        internal int InflateFast(int bl, int bd, int[] tl, int tl_index, int[] td, int td_index, Class_193 s, Class_212 z)
        {
            int num  = z.NextIn;
            int num2 = z.AvailableBytesIn;
            int num3 = s.bitb;
            int i    = s.bitk;
            int num4 = s.writeAt;
            int num5 = (num4 < s.readAt) ? (s.readAt - num4 - 1) : (s.end - num4);
            int num6 = Class_194.InflateMask[bl];
            int num7 = Class_194.InflateMask[bd];
            int num10;
            int num11;

            for (;;)
            {
                if (i >= 20)
                {
                    int num8 = num3 & num6;
                    int num9 = (tl_index + num8) * 3;
                    if ((num10 = tl[num9]) == 0)
                    {
                        num3           >>= tl[num9 + 1];
                        i               -= tl[num9 + 1];
                        s.window[num4++] = (byte)tl[num9 + 2];
                        num5--;
                    }
                    else
                    {
                        for (;;)
                        {
                            num3 >>= tl[num9 + 1];
                            i     -= tl[num9 + 1];
                            if ((num10 & 16) != 0)
                            {
                                break;
                            }
                            if ((num10 & 64) != 0)
                            {
                                goto IL_4E2;
                            }
                            num8 += tl[num9 + 2];
                            num8 += (num3 & Class_194.InflateMask[num10]);
                            num9  = (tl_index + num8) * 3;
                            if ((num10 = tl[num9]) == 0)
                            {
                                goto Block_20;
                            }
                        }
                        num10 &= 15;
                        num11  = tl[num9 + 2] + (num3 & Class_194.InflateMask[num10]);
                        num3 >>= num10;
                        for (i -= num10; i < 15; i += 8)
                        {
                            num2--;
                            num3 |= (int)(z.InputBuffer[num++] & byte.MaxValue) << i;
                        }
                        num8  = (num3 & num7);
                        num9  = (td_index + num8) * 3;
                        num10 = td[num9];
                        for (;;)
                        {
                            num3 >>= td[num9 + 1];
                            i     -= td[num9 + 1];
                            if ((num10 & 16) != 0)
                            {
                                break;
                            }
                            if ((num10 & 64) != 0)
                            {
                                goto IL_3EC;
                            }
                            num8 += td[num9 + 2];
                            num8 += (num3 & Class_194.InflateMask[num10]);
                            num9  = (td_index + num8) * 3;
                            num10 = td[num9];
                        }
                        num10 &= 15;
                        while (i < num10)
                        {
                            num2--;
                            num3 |= (int)(z.InputBuffer[num++] & byte.MaxValue) << i;
                            i    += 8;
                        }
                        int num12 = td[num9 + 2] + (num3 & Class_194.InflateMask[num10]);
                        num3 >>= num10;
                        i     -= num10;
                        num5  -= num11;
                        int num13;
                        if (num4 >= num12)
                        {
                            num13 = num4 - num12;
                            if (num4 - num13 > 0 && 2 > num4 - num13)
                            {
                                s.window[num4++] = s.window[num13++];
                                s.window[num4++] = s.window[num13++];
                                num11           -= 2;
                            }
                            else
                            {
                                Array.Copy(s.window, num13, s.window, num4, 2);
                                num4  += 2;
                                num13 += 2;
                                num11 -= 2;
                            }
                        }
                        else
                        {
                            num13 = num4 - num12;
                            do
                            {
                                num13 += s.end;
                            }while (num13 < 0);
                            num10 = s.end - num13;
                            if (num11 > num10)
                            {
                                num11 -= num10;
                                if (num4 - num13 > 0 && num10 > num4 - num13)
                                {
                                    do
                                    {
                                        s.window[num4++] = s.window[num13++];
                                    }while (--num10 != 0);
                                }
                                else
                                {
                                    Array.Copy(s.window, num13, s.window, num4, num10);
                                    num4  += num10;
                                    num13 += num10;
                                }
                                num13 = 0;
                            }
                        }
                        if (num4 - num13 > 0 && num11 > num4 - num13)
                        {
                            do
                            {
                                s.window[num4++] = s.window[num13++];
                            }while (--num11 != 0);
                            goto IL_5E3;
                        }
                        Array.Copy(s.window, num13, s.window, num4, num11);
                        num4  += num11;
                        num13 += num11;
                        goto IL_5E3;
Block_20:
                        num3           >>= tl[num9 + 1];
                        i               -= tl[num9 + 1];
                        s.window[num4++] = (byte)tl[num9 + 2];
                        num5--;
                    }
IL_5E3:
                    if (num5 < 258 || num2 < 10)
                    {
                        goto IL_5F7;
                    }
                }
                else
                {
                    num2--;
                    num3 |= (int)(z.InputBuffer[num++] & byte.MaxValue) << i;
                    i    += 8;
                }
            }
IL_3EC:
            z.Message          = "invalid distance code";
            num11              = z.AvailableBytesIn - num2;
            num11              = ((i >> 3 < num11) ? (i >> 3) : num11);
            num2              += num11;
            num               -= num11;
            i                 -= num11 << 3;
            s.bitb             = num3;
            s.bitk             = i;
            z.AvailableBytesIn = num2;
            z.TotalBytesIn    += (long)(num - z.NextIn);
            z.NextIn           = num;
            s.writeAt          = num4;
            return(-3);

IL_4E2:
            if ((num10 & 32) != 0)
            {
                num11              = z.AvailableBytesIn - num2;
                num11              = ((i >> 3 < num11) ? (i >> 3) : num11);
                num2              += num11;
                num               -= num11;
                i                 -= num11 << 3;
                s.bitb             = num3;
                s.bitk             = i;
                z.AvailableBytesIn = num2;
                z.TotalBytesIn    += (long)(num - z.NextIn);
                z.NextIn           = num;
                s.writeAt          = num4;
                return(1);
            }
            z.Message          = "invalid literal/length code";
            num11              = z.AvailableBytesIn - num2;
            num11              = ((i >> 3 < num11) ? (i >> 3) : num11);
            num2              += num11;
            num               -= num11;
            i                 -= num11 << 3;
            s.bitb             = num3;
            s.bitk             = i;
            z.AvailableBytesIn = num2;
            z.TotalBytesIn    += (long)(num - z.NextIn);
            z.NextIn           = num;
            s.writeAt          = num4;
            return(-3);

IL_5F7:
            num11              = z.AvailableBytesIn - num2;
            num11              = ((i >> 3 < num11) ? (i >> 3) : num11);
            num2              += num11;
            num               -= num11;
            i                 -= num11 << 3;
            s.bitb             = num3;
            s.bitk             = i;
            z.AvailableBytesIn = num2;
            z.TotalBytesIn    += (long)(num - z.NextIn);
            z.NextIn           = num;
            s.writeAt          = num4;
            return(0);
        }
예제 #8
0
        // Token: 0x0600073E RID: 1854 RVA: 0x00030224 File Offset: 0x0002E424
        internal int Process(Class_193 blocks, int r)
        {
            Class_212 codec = blocks._codec;
            int       num   = codec.NextIn;
            int       num2  = codec.AvailableBytesIn;
            int       num3  = blocks.bitb;
            int       i     = blocks.bitk;
            int       num4  = blocks.writeAt;
            int       num5  = (num4 < blocks.readAt) ? (blocks.readAt - num4 - 1) : (blocks.end - num4);

            for (;;)
            {
                int num6;
                switch (this.mode)
                {
                case 0:
                    if (num5 >= 258 && num2 >= 10)
                    {
                        blocks.bitb            = num3;
                        blocks.bitk            = i;
                        codec.AvailableBytesIn = num2;
                        codec.TotalBytesIn    += (long)(num - codec.NextIn);
                        codec.NextIn           = num;
                        blocks.writeAt         = num4;
                        r    = this.InflateFast((int)this.lbits, (int)this.dbits, this.ltree, this.ltree_index, this.dtree, this.dtree_index, blocks, codec);
                        num  = codec.NextIn;
                        num2 = codec.AvailableBytesIn;
                        num3 = blocks.bitb;
                        i    = blocks.bitk;
                        num4 = blocks.writeAt;
                        num5 = ((num4 < blocks.readAt) ? (blocks.readAt - num4 - 1) : (blocks.end - num4));
                        if (r != 0)
                        {
                            this.mode = ((r == 1) ? 7 : 9);
                            continue;
                        }
                    }
                    this.need       = (int)this.lbits;
                    this.tree       = this.ltree;
                    this.tree_index = this.ltree_index;
                    this.mode       = 1;
                    goto IL_1AC;

                case 1:
                    goto IL_1AC;

                case 2:
                    num6 = this.bitsToGet;
                    while (i < num6)
                    {
                        if (num2 == 0)
                        {
                            goto IL_382;
                        }
                        r = 0;
                        num2--;
                        num3 |= (int)(codec.InputBuffer[num++] & byte.MaxValue) << i;
                        i    += 8;
                    }
                    this.len       += (num3 & Class_194.InflateMask[num6]);
                    num3          >>= num6;
                    i              -= num6;
                    this.need       = (int)this.dbits;
                    this.tree       = this.dtree;
                    this.tree_index = this.dtree_index;
                    this.mode       = 3;
                    goto IL_43D;

                case 3:
                    goto IL_43D;

                case 4:
                    num6 = this.bitsToGet;
                    while (i < num6)
                    {
                        if (num2 == 0)
                        {
                            goto IL_5D9;
                        }
                        r = 0;
                        num2--;
                        num3 |= (int)(codec.InputBuffer[num++] & byte.MaxValue) << i;
                        i    += 8;
                    }
                    this.dist += (num3 & Class_194.InflateMask[num6]);
                    num3     >>= num6;
                    i         -= num6;
                    this.mode  = 5;
                    goto IL_670;

                case 5:
                    goto IL_670;

                case 6:
                    if (num5 == 0)
                    {
                        if (num4 == blocks.end && blocks.readAt != 0)
                        {
                            num4 = 0;
                            num5 = ((num4 < blocks.readAt) ? (blocks.readAt - num4 - 1) : (blocks.end - num4));
                        }
                        if (num5 == 0)
                        {
                            blocks.writeAt = num4;
                            r    = blocks.Flush(r);
                            num4 = blocks.writeAt;
                            num5 = ((num4 < blocks.readAt) ? (blocks.readAt - num4 - 1) : (blocks.end - num4));
                            if (num4 == blocks.end && blocks.readAt != 0)
                            {
                                num4 = 0;
                                num5 = ((num4 < blocks.readAt) ? (blocks.readAt - num4 - 1) : (blocks.end - num4));
                            }
                            if (num5 == 0)
                            {
                                goto Block_44;
                            }
                        }
                    }
                    r = 0;
                    blocks.window[num4++] = (byte)this.lit;
                    num5--;
                    this.mode = 0;
                    continue;

                case 7:
                    goto IL_954;

                case 8:
                    goto IL_A05;

                case 9:
                    goto IL_A4B;
                }
                break;
IL_1AC:
                num6 = this.need;
                while (i < num6)
                {
                    if (num2 == 0)
                    {
                        goto IL_1C8;
                    }
                    r = 0;
                    num2--;
                    num3 |= (int)(codec.InputBuffer[num++] & byte.MaxValue) << i;
                    i    += 8;
                }
                int num7 = (this.tree_index + (num3 & Class_194.InflateMask[num6])) * 3;
                num3 >>= this.tree[num7 + 1];
                i     -= this.tree[num7 + 1];
                int num8 = this.tree[num7];
                if (num8 == 0)
                {
                    this.lit  = this.tree[num7 + 2];
                    this.mode = 6;
                    continue;
                }
                if ((num8 & 16) != 0)
                {
                    this.bitsToGet = (num8 & 15);
                    this.len       = this.tree[num7 + 2];
                    this.mode      = 2;
                    continue;
                }
                if ((num8 & 64) == 0)
                {
                    this.need       = num8;
                    this.tree_index = num7 / 3 + this.tree[num7 + 2];
                    continue;
                }
                if ((num8 & 32) != 0)
                {
                    this.mode = 7;
                    continue;
                }
                goto IL_30C;
IL_43D:
                num6 = this.need;
                while (i < num6)
                {
                    if (num2 == 0)
                    {
                        goto IL_459;
                    }
                    r = 0;
                    num2--;
                    num3 |= (int)(codec.InputBuffer[num++] & byte.MaxValue) << i;
                    i    += 8;
                }
                num7   = (this.tree_index + (num3 & Class_194.InflateMask[num6])) * 3;
                num3 >>= this.tree[num7 + 1];
                i     -= this.tree[num7 + 1];
                num8   = this.tree[num7];
                if ((num8 & 16) != 0)
                {
                    this.bitsToGet = (num8 & 15);
                    this.dist      = this.tree[num7 + 2];
                    this.mode      = 4;
                    continue;
                }
                if ((num8 & 64) == 0)
                {
                    this.need       = num8;
                    this.tree_index = num7 / 3 + this.tree[num7 + 2];
                    continue;
                }
                goto IL_563;
IL_670:
                int j;
                for (j = num4 - this.dist; j < 0; j += blocks.end)
                {
                }
                while (this.len != 0)
                {
                    if (num5 == 0)
                    {
                        if (num4 == blocks.end && blocks.readAt != 0)
                        {
                            num4 = 0;
                            num5 = ((num4 < blocks.readAt) ? (blocks.readAt - num4 - 1) : (blocks.end - num4));
                        }
                        if (num5 == 0)
                        {
                            blocks.writeAt = num4;
                            r    = blocks.Flush(r);
                            num4 = blocks.writeAt;
                            num5 = ((num4 < blocks.readAt) ? (blocks.readAt - num4 - 1) : (blocks.end - num4));
                            if (num4 == blocks.end && blocks.readAt != 0)
                            {
                                num4 = 0;
                                num5 = ((num4 < blocks.readAt) ? (blocks.readAt - num4 - 1) : (blocks.end - num4));
                            }
                            if (num5 == 0)
                            {
                                goto Block_32;
                            }
                        }
                    }
                    blocks.window[num4++] = blocks.window[j++];
                    num5--;
                    if (j == blocks.end)
                    {
                        j = 0;
                    }
                    this.len--;
                }
                this.mode = 0;
            }
            r                      = -2;
            blocks.bitb            = num3;
            blocks.bitk            = i;
            codec.AvailableBytesIn = num2;
            codec.TotalBytesIn    += (long)(num - codec.NextIn);
            codec.NextIn           = num;
            blocks.writeAt         = num4;
            return(blocks.Flush(r));

IL_1C8:
            blocks.bitb            = num3;
            blocks.bitk            = i;
            codec.AvailableBytesIn = num2;
            codec.TotalBytesIn    += (long)(num - codec.NextIn);
            codec.NextIn           = num;
            blocks.writeAt         = num4;
            return(blocks.Flush(r));

IL_30C:
            this.mode              = 9;
            codec.Message          = "invalid literal/length code";
            r                      = -3;
            blocks.bitb            = num3;
            blocks.bitk            = i;
            codec.AvailableBytesIn = num2;
            codec.TotalBytesIn    += (long)(num - codec.NextIn);
            codec.NextIn           = num;
            blocks.writeAt         = num4;
            return(blocks.Flush(r));

IL_382:
            blocks.bitb            = num3;
            blocks.bitk            = i;
            codec.AvailableBytesIn = num2;
            codec.TotalBytesIn    += (long)(num - codec.NextIn);
            codec.NextIn           = num;
            blocks.writeAt         = num4;
            return(blocks.Flush(r));

IL_459:
            blocks.bitb            = num3;
            blocks.bitk            = i;
            codec.AvailableBytesIn = num2;
            codec.TotalBytesIn    += (long)(num - codec.NextIn);
            codec.NextIn           = num;
            blocks.writeAt         = num4;
            return(blocks.Flush(r));

IL_563:
            this.mode              = 9;
            codec.Message          = "invalid distance code";
            r                      = -3;
            blocks.bitb            = num3;
            blocks.bitk            = i;
            codec.AvailableBytesIn = num2;
            codec.TotalBytesIn    += (long)(num - codec.NextIn);
            codec.NextIn           = num;
            blocks.writeAt         = num4;
            return(blocks.Flush(r));

IL_5D9:
            blocks.bitb            = num3;
            blocks.bitk            = i;
            codec.AvailableBytesIn = num2;
            codec.TotalBytesIn    += (long)(num - codec.NextIn);
            codec.NextIn           = num;
            blocks.writeAt         = num4;
            return(blocks.Flush(r));

Block_32:
            blocks.bitb            = num3;
            blocks.bitk            = i;
            codec.AvailableBytesIn = num2;
            codec.TotalBytesIn    += (long)(num - codec.NextIn);
            codec.NextIn           = num;
            blocks.writeAt         = num4;
            return(blocks.Flush(r));

Block_44:
            blocks.bitb            = num3;
            blocks.bitk            = i;
            codec.AvailableBytesIn = num2;
            codec.TotalBytesIn    += (long)(num - codec.NextIn);
            codec.NextIn           = num;
            blocks.writeAt         = num4;
            return(blocks.Flush(r));

IL_954:
            if (i > 7)
            {
                i -= 8;
                num2++;
                num--;
            }
            blocks.writeAt = num4;
            r    = blocks.Flush(r);
            num4 = blocks.writeAt;
            int num9 = (num4 < blocks.readAt) ? (blocks.readAt - num4 - 1) : (blocks.end - num4);

            if (blocks.readAt != blocks.writeAt)
            {
                blocks.bitb            = num3;
                blocks.bitk            = i;
                codec.AvailableBytesIn = num2;
                codec.TotalBytesIn    += (long)(num - codec.NextIn);
                codec.NextIn           = num;
                blocks.writeAt         = num4;
                return(blocks.Flush(r));
            }
            this.mode = 8;
IL_A05:
            r                      = 1;
            blocks.bitb            = num3;
            blocks.bitk            = i;
            codec.AvailableBytesIn = num2;
            codec.TotalBytesIn    += (long)(num - codec.NextIn);
            codec.NextIn           = num;
            blocks.writeAt         = num4;
            return(blocks.Flush(r));

IL_A4B:
            r                      = -3;
            blocks.bitb            = num3;
            blocks.bitk            = i;
            codec.AvailableBytesIn = num2;
            codec.TotalBytesIn    += (long)(num - codec.NextIn);
            codec.NextIn           = num;
            blocks.writeAt         = num4;
            return(blocks.Flush(r));
        }
예제 #9
0
 // Token: 0x0600074F RID: 1871 RVA: 0x000323C8 File Offset: 0x000305C8
 internal static int inflate_trees_fixed(int[] bl, int[] bd, int[][] tl, int[][] td, Class_212 z)
 {
     bl[0] = 9;
     bd[0] = 5;
     tl[0] = Class_197.fixed_tl;
     td[0] = Class_197.fixed_td;
     return(0);
 }
예제 #10
0
        // Token: 0x0600074E RID: 1870 RVA: 0x000322A0 File Offset: 0x000304A0
        internal int inflate_trees_dynamic(int nl, int nd, int[] c, int[] bl, int[] bd, int[] tl, int[] td, int[] hp, Class_212 z)
        {
            this.initWorkArea(288);
            this.hn[0] = 0;
            int num = this.huft_build(c, 0, nl, 257, Class_197.cplens, Class_197.cplext, tl, bl, hp, this.hn, this.v);

            if (num != 0 || bl[0] == 0)
            {
                if (num == -3)
                {
                    z.Message = "oversubscribed literal/length tree";
                }
                else if (num != -4)
                {
                    z.Message = "incomplete literal/length tree";
                    num       = -3;
                }
                return(num);
            }
            this.initWorkArea(288);
            num = this.huft_build(c, nl, nd, 0, Class_197.cpdist, Class_197.cpdext, td, bd, hp, this.hn, this.v);
            if (num != 0 || (bd[0] == 0 && nl > 257))
            {
                if (num == -3)
                {
                    z.Message = "oversubscribed distance tree";
                }
                else if (num == -5)
                {
                    z.Message = "incomplete distance tree";
                    num       = -3;
                }
                else if (num != -4)
                {
                    z.Message = "empty distance tree with lengths";
                    num       = -3;
                }
                return(num);
            }
            return(0);
        }