Пример #1
0
        private unsafe bool TokenizeInstanceId()
        {
            if (this.length <= this.position)
            {
                return(false);
            }
            int num = 9;

            if (num <= this.headerOffset)
            {
                return(true);
            }
            int num2 = System.Math.Min(num - this.headerOffset, this.length - this.position);

            Buffer.BlockCopy(this.buffer, this.position, this.header, this.headerOffset, num2);
            this.headerOffset += num2;
            this.position     += num2;
            if (this.headerOffset < num)
            {
                return(false);
            }
            if (this.CryptoTransform != null && this.CryptoTransform.Decrypt(new ArraySegment <byte>(this.header, 0, num), IPAddress.NetworkToHostOrder(BitConverter.ToInt64(this.header, 0))))
            {
                fixed(byte *ptr = &this.header[0])
                {
                    *(long *)ptr = 0L;
                }
            }
            this.categoryBytesCount = Packet.GetBytesCount(this.header, 8);
            return(true);
        }
Пример #2
0
        private bool TokenizeCategoryId()
        {
            if (this.length <= this.position)
            {
                return(false);
            }
            int num = 8 + this.categoryBytesCount + 1;

            if (num <= this.headerOffset)
            {
                return(true);
            }
            int num2 = System.Math.Min(num - this.headerOffset, this.length - this.position);

            Buffer.BlockCopy(this.buffer, this.position, this.header, this.headerOffset, num2);
            this.headerOffset += num2;
            this.position     += num2;
            if (this.headerOffset < num)
            {
                return(false);
            }
            if (this.CryptoTransform != null)
            {
                this.CryptoTransform.Decrypt(new ArraySegment <byte>(this.header, 9, this.categoryBytesCount));
            }
            this.lengthBytesCount = Packet.GetBytesCount(this.header, 8 + this.categoryBytesCount);
            return(true);
        }
Пример #3
0
 internal Packet(int length, int categoryId)
 {
     this            = new Packet(ChunkSegment <byte> .Get(8 + Packet.GetBytesCount(categoryId) + Packet.GetBytesCount(length) + length));
     this.CategoryId = categoryId;
     this.Length     = length;
 }