private void SetTreeCodes() { byte[] codeLengths1 = new byte[288]; byte[] codeLengths2 = new byte[32]; Array.Copy((Array)this.codeList, (Array)codeLengths1, this.literalLengthCodeCount); Array.Copy((Array)this.codeList, this.literalLengthCodeCount, (Array)codeLengths2, 0, this.distanceCodeCount); if (codeLengths1[256] == (byte)0) { DeflateDecompressor.ThrowInvalidDataGeneric(); } this.literalLengthTree = new InflateTree(codeLengths1); this.distanceTree = new InflateTree(codeLengths2); }
private bool DecodeDynamicCodes() { for (; this.loopCounter < this.codeLengthCodeCount; ++this.loopCounter) { int bits = this.input.GetBits(3); if (bits < 0) { return(false); } this.codeLengthTreeCodeLength[(int)Tree.BitLengthOrder[this.loopCounter]] = (byte)bits; } for (int codeLengthCodeCount = this.codeLengthCodeCount; codeLengthCodeCount < Tree.BitLengthOrder.Length; ++codeLengthCodeCount) { this.codeLengthTreeCodeLength[(int)Tree.BitLengthOrder[codeLengthCodeCount]] = (byte)0; } this.codeLengthTree = new InflateTree(this.codeLengthTreeCodeLength); this.codeArraySize = this.literalLengthCodeCount + this.distanceCodeCount; this.loopCounter = 0; return(true); }
private void ProcessBlockType() { this.blockType = (DeflateDecompressor.BlockType) this.input.GetBits(2); switch (this.blockType) { case DeflateDecompressor.BlockType.Stored: this.state = DeflateDecompressor.DecompressorState.UncompressedAligning; break; case DeflateDecompressor.BlockType.Static: this.literalLengthTree = InflateTree.StaticLiteralLengthTree; this.distanceTree = InflateTree.StaticDistanceTree; this.state = DeflateDecompressor.DecompressorState.DecodeTop; break; case DeflateDecompressor.BlockType.Dynamic: this.state = DeflateDecompressor.DecompressorState.ReadingNumLitCodes; break; default: DeflateDecompressor.ThrowUnknownBlockType(); break; } }