Ejemplo n.º 1
0
        private byte MoveBit(byte code_num)
        {
            if (this.oBitInd == 0)
            {
                Sdd1.SetByte(Sdd1.OutBufferPosition, 0);
            }

            byte bit = Convert.ToByte(((this.codewBuffer[code_num][this.bytePtr[code_num]] & (0x80 >> this.bitInd[code_num])) << this.bitInd[code_num]) & 0xFF);

            Sdd1.SetByteOr(Sdd1.OutBufferPosition, Convert.ToByte((bit >> this.oBitInd) & 0xFF));
            this.logMessage.Append(string.Format(CultureInfo.InvariantCulture, "{0:X02} ", Convert.ToByte((bit >> this.oBitInd) & 0xFF)));

            if ((++this.bitInd[code_num] & 0x08) > 0)
            {
                this.bitInd[code_num] = 0;
                this.bytePtr[code_num]++;
            }

            if ((++this.oBitInd & 0x08) > 0)
            {
                this.logMessage.Append(string.Format(CultureInfo.InvariantCulture, "-> {0:X02}", Sdd1.GetByte(Sdd1.OutBufferPosition)));
                Logger.Debug(this.logMessage.ToString());
                this.logMessage.Clear();
                this.oBitInd = 0;
                Sdd1.OutBufferPosition++;
                ++Sdd1.OutBufferLength;
            }

            return(bit);
        }
Ejemplo n.º 2
0
        public void PrepareComp(byte header)
        {
            Sdd1.OutBufferLength = 0;
            Sdd1.SetByte(Sdd1.OutBufferPosition, Convert.ToByte((header << 4) & 0xFF));

            this.oBitInd = 4;

            for (byte i = 0; i < 8; i++)
            {
                this.bytePtr[i] = 0;
                this.bitInd[i]  = 0;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Execute the process of this action.
        /// </summary>
        public override void Execute()
        {
            if (this.Title != null)
            {
                Logger.Info(this.Title);
            }

            var msSource = this.Context.Buffers.Get <MemoryStream>(this.From.Value);

            ISdd1Comp sdd1 = new Sdd1();

            var msDestination = sdd1.Compress(msSource);

            this.Context.Buffers.Add(this.To.Value, msDestination);
        }