Пример #1
0
 protected void DecompressTokenSequence(DecompressedBuffer buffer, DecompressionState state, IEnumerable <TokenSequence> tokenSequence)
 {
     foreach (var t in tokenSequence)
     {
         t.Decompress(buffer, state);
     }
 }
Пример #2
0
        public void Decompress(DecompressedBuffer buffer, DecompressionState state)
        {
            state.DecompressedChunkStart = state.DecompressedCurrent;
            //var CompressedEnd = Math.Min(state.CompressionRecordEnd, state.CompressedChunkStart + this.CompressedHeader.CompressedChunkSize);
            state.CompressedCurrent += 2;

            this.CompressedData.Decompress(buffer, state);
        }
Пример #3
0
        public override void Decompress(DecompressedBuffer buffer, DecompressionState state)
        {
            var decompressedChunk = new DecompressedChunk(new byte[] { Data });

            buffer.Add(decompressedChunk);

            ++state.DecompressedCurrent;
            ++state.CompressedCurrent;
        }
Пример #4
0
        /*
         * public Byte[] GetDataInRawBytes()
         * {
         *  IEnumerable<Byte> result = new Byte[] { this.FlagByte };
         *  foreach(var token in _Tokens)
         *  {
         *      result = result.Concat(token.GetDataInRawBytes());
         *  }
         *
         *  return result.ToArray();
         * }*/

        public void Decompress(DecompressedBuffer buffer, DecompressionState state)
        {
            ++state.CompressedCurrent;

            foreach (var token in this._Tokens)
            {
                token.Decompress(buffer, state);
            }
        }
Пример #5
0
        public override void Decompress(DecompressedBuffer buffer, DecompressionState state)
        {
            var info = UnpackCopyToken(this.Token, state.DecompressedCurrent, state.DecompressedChunkStart);

            var copySource = state.DecompressedCurrent - info.Offset;

            // Call Byte Copy (section 2.4.1.3.11) with CopySource, DecompressedCurrent, and Length
            ByteCopy(buffer, copySource, state.DecompressedCurrent, info.Length);

            state.DecompressedCurrent += info.Length;
            state.CompressedCurrent   += 2;
        }
Пример #6
0
        public void DecompressRawChunk(DecompressedBuffer buffer, DecompressionState state, Byte[] Data)
        {
            throw new NotImplementedException();

            Byte[] append = new Byte[4096];
            //Array.Copy(state.OriginalData, state.CompressedCurrent, append, 0, header.CompressedChunkSize);

            //int nCopy = Math.Min(4096, state.OriginalData.Length-state.CompressedCurrent);
            //Array.Copy(state.OriginalData, state.CompressedCurrent, append, 0, nCopy);
            Array.Copy(this.Data, 0, append, 0, 4096); // todo: maybe copy from original data?
            state.DecompressedCurrent += 4096;
            state.CompressedCurrent   += 4096;

            var x = new DecompressedChunk(append);

            buffer.Add(x);
        }
Пример #7
0
        public void Decompress(DecompressedBuffer buffer)
        {
            var state = new DecompressionState();

            if (this.SignatureByte == (Byte)0x01)
            {
                ++state.CompressedCurrent;

                foreach (var chunk in _Chunks)
                {
                    state.CompressedChunkStart = state.CompressedCurrent;
                    chunk.Decompress(buffer, state);
                }
            }
            else
            {
                throw new Exception();
            }
        }
Пример #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="OriginalData"></param>
        /// <param name="CopySource">Specifies the location, in the DecompressedBuffer, of the first byte of the source sequence</param>
        /// <param name="DestinationSource">Specifies the location, in the DecompressedBuffer, of the first byte of the destination sequence</param>
        /// <param name="ByteCount">Specifies the number of bytes to copy. MUST be greater than 0.</param>
        protected void ByteCopy(DecompressedBuffer buffer, int CopySource, int DestinationSource, int ByteCount)
        {
            if (ByteCount <= 0)
            {
                throw new ArgumentOutOfRangeException("ByteCount", ByteCount, "ByteCount must be greater than 0");
            }

            var SrcCurrent = CopySource;
            var DstCurrent = DestinationSource;

            for (int i = 1; i <= ByteCount; i++)
            {
                var byteToCopy = buffer.GetByteAt(SrcCurrent);
                //var byteToCopy = OriginalData.ReadByteAt(SrcCurrent);
                buffer.SetByte(DstCurrent, byteToCopy);
                ++SrcCurrent;
                ++DstCurrent;
            }
        }
Пример #9
0
 public static void Decompress(DecompressedBuffer outputBuffer, CompressedContainer container)
 {
 }
Пример #10
0
 public abstract void Decompress(DecompressedBuffer buffer, DecompressionState state);