Example #1
0
 private void DecompressPosSlotProcess()
 {
     if (this.positionSlot >= 4U)
     {
         int numBitLevels = (int)(this.positionSlot >> 1) - 1;
         this.repeater = (uint)((2 | (int)this.positionSlot & 1) << numBitLevels);
         if (this.positionSlot < 14U)
         {
             uint num = LzmaBitTreeDecoder.ReverseDecode(this.positionDecoders, (uint)((int)this.repeater - (int)this.positionSlot - 1), this.rangeDecoder, numBitLevels);
             if (this.rangeDecoder.InputRequired)
             {
                 return;
             }
             this.repeater += num;
         }
         else
         {
             uint num = this.rangeDecoder.DecodeDirectBits(numBitLevels - 4) << 4;
             if (this.rangeDecoder.InputRequired)
             {
                 return;
             }
             this.repeater       += num;
             this.decompressState = LzmaDecompressor.LzmaDecompressorState.ReverseDecoder;
             return;
         }
     }
     else
     {
         this.repeater = this.positionSlot;
     }
     this.decompressState = LzmaDecompressor.LzmaDecompressorState.CopyBlock;
 }
Example #2
0
        private void DecompressMatchDecoder()
        {
            uint num           = this.matchDecoders[(IntPtr)((this.lzmaState.Index << 4) + this.positionState)].DecodeState(this.rangeDecoder);
            bool inputRequired = this.rangeDecoder.InputRequired;
            bool flag          = this.rangeDecoder.CheckInputRequired(1, true);

            if (!flag && !inputRequired && this.rangeDecoder.FinalBlock)
            {
                if (this.currentPosition < (ulong)this.Settings.InternalStreamLength)
                {
                    flag = this.rangeDecoder.CheckInputRequired(0, true);
                }
                else
                {
                    this.decompressState = LzmaDecompressor.LzmaDecompressorState.Done;
                }
            }
            if (!flag)
            {
                return;
            }
            this.decodedState = num;
            if (this.decodedState == 0U)
            {
                this.decompressState = LzmaDecompressor.LzmaDecompressorState.LiteralDecoder;
            }
            else
            {
                this.decompressState = LzmaDecompressor.LzmaDecompressorState.RepeaterDecoder;
            }
        }
Example #3
0
        private void DecompressRepeaterG2Decoder()
        {
            uint num1 = this.repeaterG2Decoders[(IntPtr)this.lzmaState.Index].DecodeState(this.rangeDecoder);

            if (this.rangeDecoder.InputRequired)
            {
                return;
            }
            this.decodedState = num1;
            uint num2;

            if (this.decodedState == 0U)
            {
                num2 = this.repeaterPosition2;
            }
            else
            {
                num2 = this.repeaterPosition3;
                this.repeaterPosition3 = this.repeaterPosition2;
            }
            this.repeaterPosition2 = this.repeaterPosition1;
            this.repeaterPosition1 = this.repeater;
            this.repeater          = num2;
            this.decompressState   = LzmaDecompressor.LzmaDecompressorState.RepeaterLengthDecoder;
        }
Example #4
0
 private void DecompressPosSlotDecoder()
 {
     this.positionSlot = this.positionSlotDecoder[(IntPtr)LzmaState.GetLenToPosState(this.decodedLength)].Decode(this.rangeDecoder);
     if (this.rangeDecoder.InputRequired)
     {
         return;
     }
     this.decompressState = LzmaDecompressor.LzmaDecompressorState.PosSlotProcess;
 }
Example #5
0
 private void DecompressRepeaterLengthDecoder()
 {
     this.decodedLength = this.repeaterLengthDecoder.Decode(this.rangeDecoder, this.positionState) + 2U;
     if (this.rangeDecoder.InputRequired)
     {
         return;
     }
     this.lzmaState.UpdateRep();
     this.decompressState = LzmaDecompressor.LzmaDecompressorState.CopyBlock;
 }
Example #6
0
        private void DecompressReverseDecoder()
        {
            uint num = this.positionAlignDecoder.ReverseDecode(this.rangeDecoder);

            if (this.rangeDecoder.InputRequired)
            {
                return;
            }
            this.repeater       += num;
            this.decompressState = LzmaDecompressor.LzmaDecompressorState.CopyBlock;
        }
Example #7
0
 private void DecompressLengthDecoder()
 {
     this.decodedLength = 2U + this.lengthDecoder.Decode(this.rangeDecoder, this.positionState);
     if (this.rangeDecoder.InputRequired)
     {
         return;
     }
     this.repeaterPosition3 = this.repeaterPosition2;
     this.repeaterPosition2 = this.repeaterPosition1;
     this.repeaterPosition1 = this.repeater;
     this.lzmaState.UpdateMatch();
     this.decompressState = LzmaDecompressor.LzmaDecompressorState.PosSlotDecoder;
 }
Example #8
0
        private void DecompressLiteralDecoder()
        {
            byte previousByte = this.outputWindow.GetByte(0U);

            if (!this.rangeDecoder.CheckInputRequired(256, false))
            {
                return;
            }
            this.outputWindow.PutByte(!this.lzmaState.IsCharState() ? this.literalDecoder.DecodeWithMatchByte(this.rangeDecoder, (uint)this.currentPosition, previousByte, this.outputWindow.GetByte(this.repeater)) : this.literalDecoder.DecodeNormal(this.rangeDecoder, (uint)this.currentPosition, previousByte));
            this.lzmaState.UpdateChar();
            ++this.currentPosition;
            this.decompressState = LzmaDecompressor.LzmaDecompressorState.MatchDecoder;
        }
Example #9
0
 private void DecompressCopyBlock()
 {
     if ((ulong)this.repeater >= this.currentPosition || this.repeater >= this.dictionarySizeCheck)
     {
         if (this.repeater != uint.MaxValue)
         {
             throw new InvalidDataException();
         }
         this.decompressState = LzmaDecompressor.LzmaDecompressorState.Done;
     }
     else
     {
         this.outputWindow.CopyBlock(this.repeater, this.decodedLength);
         this.currentPosition += (ulong)this.decodedLength;
         this.decompressState  = LzmaDecompressor.LzmaDecompressorState.MatchDecoder;
     }
 }
Example #10
0
        private void DecompressRepeaterG0Decoder()
        {
            uint num = this.repeaterG0Decoders[(IntPtr)this.lzmaState.Index].DecodeState(this.rangeDecoder);

            if (this.rangeDecoder.InputRequired)
            {
                return;
            }
            this.decodedState = num;
            if (this.decodedState == 0U)
            {
                this.decompressState = LzmaDecompressor.LzmaDecompressorState.Repeater0LongDecoder;
            }
            else
            {
                this.decompressState = LzmaDecompressor.LzmaDecompressorState.RepeaterG1Decoder;
            }
        }
Example #11
0
 private void DecompressStart()
 {
     this.decodedState = this.matchDecoders[(IntPtr)(this.lzmaState.Index << 4)].DecodeState(this.rangeDecoder);
     if (this.decodedState != 0U)
     {
         if (this.currentPosition != 0UL || this.AvailableBytesIn != 0 && this.AvailableBytesIn != 5)
         {
             throw new InvalidDataException();
         }
         this.decompressState = LzmaDecompressor.LzmaDecompressorState.Done;
     }
     else
     {
         this.lzmaState.UpdateChar();
         this.outputWindow.PutByte(this.literalDecoder.DecodeNormal(this.rangeDecoder, 0U, (byte)0));
         ++this.currentPosition;
         this.decompressState = LzmaDecompressor.LzmaDecompressorState.MatchDecoder;
     }
 }
Example #12
0
        private void DecompressRepeater0LongDecoder()
        {
            uint num = this.repeaterLongDecoders[(IntPtr)((this.lzmaState.Index << 4) + this.positionState)].DecodeState(this.rangeDecoder);

            if (this.rangeDecoder.InputRequired)
            {
                return;
            }
            this.decodedState = num;
            if (this.decodedState == 0U)
            {
                this.lzmaState.UpdateShortRep();
                this.outputWindow.PutByte(this.outputWindow.GetByte(this.repeater));
                ++this.currentPosition;
                this.decompressState = LzmaDecompressor.LzmaDecompressorState.MatchDecoder;
            }
            else
            {
                this.decompressState = LzmaDecompressor.LzmaDecompressorState.RepeaterLengthDecoder;
            }
        }