Example #1
0
 public override void deserializeBody(InputStream stream, TLContext context)
 {
     this.permAuthKeyId    = StreamingUtils.readLong(stream);
     this.nonce            = StreamingUtils.readLong(stream);
     this.expiresAt        = StreamingUtils.readInt(stream);
     this.encryptedMessage = StreamingUtils.readTLBytes(stream, context);
 }
 public override void deserializeBody(InputStream stream, TLContext context)
 {
     this.fileId         = StreamingUtils.readLong(stream);
     this.filePart       = StreamingUtils.readInt(stream);
     this.fileTotalParts = StreamingUtils.readInt(stream);
     this.bytes          = StreamingUtils.readTLBytes(stream, context);
 }
        public override object Deserialize(List<byte> byteList, TLPropertyAttribute attribute)
        {
            int count = byteList.ReadByte();
            int startOffset = 1;

            if (count >= 254)
            {
                count = byteList.ReadByte();
                count += byteList.ReadByte() << 8;
                count += byteList.ReadByte() << 16;
                startOffset = 4;
            }

            TLBytes bytes = new TLBytes(byteList.Take(count).ToArray());
            byteList.RemoveRange(0, count);

            int offset = (count + startOffset) % 4;
            if (offset != 0)
            {
                int offsetCount = 4 - offset;
                for (int i = 0; i < offsetCount; i++)
                    byteList.ReadByte();
            }

            return bytes;
        }
Example #4
0
        public override object Deserialize(List <byte> byteList, TLPropertyAttribute attribute)
        {
            int count       = byteList.ReadByte();
            int startOffset = 1;

            if (count >= 254)
            {
                count       = byteList.ReadByte();
                count      += byteList.ReadByte() << 8;
                count      += byteList.ReadByte() << 16;
                startOffset = 4;
            }

            TLBytes bytes = new TLBytes(byteList.Take(count).ToArray());

            byteList.RemoveRange(0, count);

            int offset = (count + startOffset) % 4;

            if (offset != 0)
            {
                int offsetCount = 4 - offset;
                for (int i = 0; i < offsetCount; i++)
                {
                    byteList.ReadByte();
                }
            }

            return(bytes);
        }
Example #5
0
        public override byte[] Serialize(object input, TLPropertyAttribute attribute)
        {
            TLBytes bytes       = (TLBytes)input;
            int     len         = bytes.Content.Length;
            int     startOffset = 1;

            List <byte> list = new List <byte>();

            if (len >= 254)
            {
                list.Add(254);
                list.Add((byte)(len & 0xFF));
                list.Add((byte)((len >> 8) & 0xFF));
                list.Add((byte)((len >> 16) & 0xFF));
                startOffset = 4;
            }
            else
            {
                list.Add((byte)len);
            }

            list.AddRange(bytes.Content);

            int offset = (len + startOffset) % 4;

            if (offset != 0)
            {
                int offsetCount = 4 - offset;
                list.AddRange(Enumerable.Repeat((byte)0x00, offsetCount));
            }

            return(list.ToArray());
        }
Example #6
0
 public override void deserializeBody(InputStream stream, TLContext context)
 {
     this.dcId          = StreamingUtils.readInt(stream);
     this.fileToken     = StreamingUtils.readTLBytes(stream, context);
     this.encryptionKey = StreamingUtils.readTLBytes(stream, context);
     this.encryptionIv  = StreamingUtils.readTLBytes(stream, context);
 }
 public override void deserializeBody(InputStream stream, TLContext context)
 {
     this.peer     = StreamingUtils.readTLObject(stream, context);
     this.randomId = StreamingUtils.readLong(stream);
     this.data     = StreamingUtils.readTLBytes(stream, context);
     this.file     = StreamingUtils.readTLObject(stream, context);
 }
Example #8
0
 public override void deserializeBody(InputStream stream, TLContext context)
 {
     this.randomBytes = StreamingUtils.readTLBytes(stream, context);
     this.layer       = StreamingUtils.readInt(stream);
     this.inSeqNo     = StreamingUtils.readInt(stream);
     this.outSeqNo    = StreamingUtils.readInt(stream);
     this.message     = StreamingUtils.readTLObject(stream, context);
 }
Example #9
0
 public override void deserializeBody(InputStream stream, TLContext context)
 {
     this.type     = StreamingUtils.readTLString(stream);
     this.location = StreamingUtils.readTLObject(stream, context);
     this.w        = StreamingUtils.readInt(stream);
     this.h        = StreamingUtils.readInt(stream);
     this.bytes    = StreamingUtils.readTLBytes(stream, context);
 }
Example #10
0
 public override void deserializeBody(InputStream stream, TLContext context)
 {
     this.currentSalt             = StreamingUtils.readTLBytes(stream, context);
     base.newSalt                 = StreamingUtils.readTLBytes(stream, context);
     this.hint                    = StreamingUtils.readTLString(stream);
     this.hasRecovery             = StreamingUtils.readTLBool(stream);
     base.emailUnconfirmedPattern = StreamingUtils.readTLString(stream);
 }
Example #11
0
 public override void deserializeBody(InputStream stream, TLContext context)
 {
     this.id      = StreamingUtils.readLong(stream);
     this.ip      = StreamingUtils.readTLString(stream);
     this.ipv6    = StreamingUtils.readTLString(stream);
     this.port    = StreamingUtils.readInt(stream);
     this.peerTag = StreamingUtils.readTLBytes(stream, context);
 }
 public override void deserializeBody(InputStream stream, TLContext context)
 {
     this.duration = StreamingUtils.readInt(stream);
     this.mimeType = StreamingUtils.readTLString(stream);
     this.size     = StreamingUtils.readInt(stream);
     this.key      = StreamingUtils.readTLBytes(stream, context);
     this.iv       = StreamingUtils.readTLBytes(stream, context);
 }
Example #13
0
 public override void deserializeBody(InputStream stream, TLContext context)
 {
     base.id            = StreamingUtils.readInt(stream);
     this.accessHash    = StreamingUtils.readLong(stream);
     this.date          = StreamingUtils.readInt(stream);
     this.adminId       = StreamingUtils.readInt(stream);
     this.participantId = StreamingUtils.readInt(stream);
     this.gA            = StreamingUtils.readTLBytes(stream, context);
 }
 public override void deserializeBody(InputStream stream, TLContext context)
 {
     this.thumb  = StreamingUtils.readTLBytes(stream, context);
     this.thumbW = StreamingUtils.readInt(stream);
     this.thumbH = StreamingUtils.readInt(stream);
     this.w      = StreamingUtils.readInt(stream);
     this.h      = StreamingUtils.readInt(stream);
     this.size   = StreamingUtils.readInt(stream);
     this.key    = StreamingUtils.readTLBytes(stream, context);
     this.iv     = StreamingUtils.readTLBytes(stream, context);
 }
Example #15
0
        public void Serialize_ThenBytesReturned()
        {
            // arrange
            byte[]  expected = { 0x02, 0xEF, 0x3F, 0x00 };
            TLBytes bytes    = new TLBytes(new byte[] { 0xEF, 0x3F });

            // act
            byte[] result = _testee.Serialize(bytes, null);

            // assert
            result.ShouldBeEquivalentTo(expected);
        }
Example #16
0
 public override void deserializeBody(InputStream stream, TLContext context)
 {
     this.flags = StreamingUtils.readInt(stream);
     if ((this.flags & 1) != 0)
     {
         this.newSalt         = StreamingUtils.readTLBytes(stream, context);
         this.newPasswordHash = StreamingUtils.readTLBytes(stream, context);
         this.hint            = StreamingUtils.readTLString(stream);
     }
     if ((this.flags & 2) != 0)
     {
         this.email = StreamingUtils.readTLString(stream);
     }
 }
Example #17
0
 public override void deserializeBody(InputStream stream, TLContext context)
 {
     this.flags        = StreamingUtils.readInt(stream);
     this.queryId      = StreamingUtils.readLong(stream);
     this.userId       = StreamingUtils.readInt(stream);
     this.msgId        = StreamingUtils.readTLObject(stream, context);
     this.chatInstance = StreamingUtils.readInt(stream);
     if ((this.flags & 1) != 0)
     {
         this.data = StreamingUtils.readTLBytes(stream, context);
     }
     if ((this.flags & 2) != 0)
     {
         this.gameShortName = StreamingUtils.readTLString(stream);
     }
 }
Example #18
0
 public override void deserializeBody(InputStream stream, TLContext context)
 {
     this.flags    = StreamingUtils.readInt(stream);
     this.duration = StreamingUtils.readInt(stream);
     if ((this.flags & 1) != 0)
     {
         this.title = StreamingUtils.readTLString(stream);
     }
     if ((this.flags & 2) != 0)
     {
         this.performer = StreamingUtils.readTLString(stream);
     }
     if ((this.flags & 4) != 0)
     {
         this.waveform = StreamingUtils.readTLBytes(stream, context);
     }
 }
Example #19
0
        public void Deserialize_ThenBytesDeserialized()
        {
            // arrange
            byte[]      expected = { 0xEF, 0x3F };
            List <byte> byteList = new List <byte>
            {
                0x02,
                0xEF,
                0x3F,
                0x00
            };

            // act
            TLBytes result = (TLBytes)_testee.Deserialize(byteList, null);

            // assert
            result.Content.ShouldBeEquivalentTo(expected);
            byteList.Count.ShouldBeEquivalentTo(0);
        }
 public virtual void setIv(TLBytes iv)
 {
     this.iv = iv;
 }
Example #21
0
 public override void deserializeBody(InputStream stream, TLContext context)
 {
     this.requestToken = StreamingUtils.readTLBytes(stream, context);
 }
 public virtual void setThumb(TLBytes thumb)
 {
     this.thumb = thumb;
 }
Example #23
0
 public virtual void setNewSalt(TLBytes newSalt)
 {
     this.newSalt = newSalt;
 }
Example #24
0
 public virtual void setBytes(TLBytes value)
 {
     this.bytes = value;
 }
Example #25
0
 public virtual void setPasswordHash(TLBytes passwordHash)
 {
     this.passwordHash = passwordHash;
 }
Example #26
0
 public override void deserializeBody(InputStream stream, TLContext context)
 {
     this.passwordHash = StreamingUtils.readTLBytes(stream, context);
 }
Example #27
0
 public virtual void setgAOrB(TLBytes gAOrB)
 {
     this.gAOrB = gAOrB;
 }
 public virtual void setG_a(TLBytes g_a)
 {
     this.g_a = g_a;
 }
 public override void deserializeBody(InputStream stream, TLContext context)
 {
     this.exchangeId     = StreamingUtils.readLong(stream);
     this.g_a            = StreamingUtils.readTLBytes(stream, context);
     this.KeyFingerprint = StreamingUtils.readLong(stream);
 }
 public TLDecryptedMessageActionAcceptKey(long exchangeId, TLBytes g_a, long KeyFingerprint)
 {
     this.exchangeId     = exchangeId;
     this.g_a            = g_a;
     this.KeyFingerprint = KeyFingerprint;
 }
 public virtual void setKey(TLBytes key)
 {
     this.key = key;
 }