public override void OnResponse(BinaryReader reader)
        {
            var dataCode = reader.ReadUInt32();             //0xf6b673a4
            var expires  = reader.ReadInt32();

            user = Tl.Parse <User>(reader);
        }
Exemple #2
0
        public override void OnResponse(BinaryReader reader)
        {
            var code = reader.ReadUInt32(); // upload.file#96a18d5

            type  = Tl.Parse <storage_FileType>(reader);
            mtime = reader.ReadInt32();
            bytes = Serializers.Bytes.read(reader); // reader.ReadBytes(_limit);
        }
Exemple #3
0
        public override void OnResponse(BinaryReader reader)
        {
            bool dialogsSlice = reader.ReadUInt32() == 0x71e094f3; // else dialogs#15ba6c40

            if (dialogsSlice)
            {
                reader.ReadInt32();               // count
            }
            // dialogs
            var result      = reader.ReadUInt32(); // vector#1cb5c415
            int dialogs_len = reader.ReadInt32();

            dialogs = new List <Dialog>(dialogs_len);
            for (int dialogs_index = 0; dialogs_index < dialogs_len; dialogs_index++)
            {
                Dialog dialog_element;
                dialog_element = Tl.Parse <Dialog>(reader);
                dialogs.Add(dialog_element);
            }
            // messages
            var count        = reader.ReadInt32();
            int messages_len = reader.ReadInt32();

            messages = new List <Message>(messages_len);
            for (int message_index = 0; message_index < messages_len; message_index++)
            {
                Message messages_element;
                messages_element = Tl.Parse <Message>(reader);
                messages.Add(messages_element);
            }
            // chats
            count = reader.ReadInt32();
            int chats_len = reader.ReadInt32();

            chats = new List <Chat>(chats_len);
            for (int chat_index = 0; chat_index < chats_len; chat_index++)
            {
                Chat chats_element;
                chats_element = Tl.Parse <Chat>(reader);
                chats.Add(chats_element);
            }
            // users
            count = reader.ReadInt32();
            int users_len = reader.ReadInt32();

            users = new List <User>(users_len);
            for (int users_index = 0; users_index < users_len; users_index++)
            {
                User users_element;
                users_element = Tl.Parse <User>(reader);
                users.Add(users_element);
            }
        }
Exemple #4
0
        public override void OnResponse(BinaryReader reader)
        {
            var code      = reader.ReadUInt32(); // vector#1cb5c415
            int users_len = reader.ReadInt32();  // vector length

            if (users_len != 0)
            {
                users = new List <User>(users_len);
                for (int i = 0; i < users_len; i++)
                {
                    users.Add(Tl.Parse <User>(reader));
                }
            }
        }
Exemple #5
0
        public ITlResponse Populate(BinaryReader reader)
        {
            var contactsContacts = new ContactsContacts();

            var combinator = new Combinator(reader.ReadUInt32());

            if (combinator.ToType != typeof(Contacts_contactsConstructor))
            {
                Debugger.Break();
            }

            // contacts
            var contactsCombinator = new Combinator(reader.ReadUInt32()); // vector #1cb5c415

            var count = reader.ReadInt32();

            contactsContacts.Contacts = new List <Contact>(count);

            for (var index = 0; index < count; index++)
            {
                var contact = Tl.Parse <Contact>(reader);

                contactsContacts.Contacts.Add(contact);
            }


            // users
            var usersCombinator = new Combinator(reader.ReadUInt32()); // vector #1cb5c415

            count = reader.ReadInt32();

            contactsContacts.Users = new List <User>(count);

            for (var index = 0; index < count; index++)
            {
                var user = Tl.Parse <User>(reader);

                contactsContacts.Users.Add(user);
            }

            return(contactsContacts);
        }
Exemple #6
0
        public static Session FromBytes(byte[] buffer, ISessionStore store, string sessionUserId)
        {
            using (var stream = new MemoryStream(buffer))
                using (var reader = new BinaryReader(stream))
                {
                    var id            = reader.ReadUInt64();
                    var sequence      = reader.ReadInt32();
                    var salt          = reader.ReadUInt64();
                    var lastMessageId = reader.ReadInt64();
                    var timeOffset    = reader.ReadInt32();
                    var serverAddress = Serializers.String.read(reader);
                    var port          = reader.ReadInt32();

                    var  isAuthExsist   = reader.ReadInt32() == 1;
                    int  sessionExpires = 0;
                    User user           = null;
                    if (isAuthExsist)
                    {
                        sessionExpires = reader.ReadInt32();
                        user           = Tl.Parse <User>(reader);
                    }

                    var authData = Serializers.Bytes.read(reader);

                    return(new Session(store)
                    {
                        AuthKey = new AuthKey(authData),
                        Id = id,
                        Salt = salt,
                        Sequence = sequence,
                        LastMessageId = lastMessageId,
                        TimeOffset = timeOffset,
                        SessionExpires = sessionExpires,
                        User = user,
                        SessionUserId = sessionUserId,
                        ServerAddress = serverAddress,
                        Port = port
                    });
                }
        }
Exemple #7
0
        public override void OnResponse(BinaryReader reader)
        {
            bool messagesSlice = reader.ReadUInt32() == 0xb446ae3;             // else messages#8c718e87

            if (messagesSlice)
            {
                reader.ReadInt32();                            // count
            }
            // messages
            var result       = reader.ReadUInt32();       // vector#1cb5c415
            int messages_len = reader.ReadInt32();

            messages = new List <Message>(messages_len);
            for (var i = 0; i < messages_len; i++)
            {
                var msgEl = Tl.Parse <Message>(reader);

                messages.Add(msgEl);
            }

            // chats
            reader.ReadUInt32();
            int chats_len = reader.ReadInt32();

            chats = new List <Chat>(chats_len);
            for (int i = 0; i < chats_len; i++)
            {
                chats.Add(Tl.Parse <Chat>(reader));
            }

            /*
             * // users
             * reader.ReadUInt32();
             * int users_len = reader.ReadInt32();
             * users = new List<User>(users_len);
             * for (int i = 0; i < users_len; i++)
             *      users.Add(TL.Parse<User>(reader));
             */
        }
        public override void OnResponse(BinaryReader reader)
        {
            var code         = reader.ReadUInt32();
            var result       = reader.ReadInt32();       // vector code
            int imported_len = reader.ReadInt32();

            this.imported = new List <ImportedContact>(imported_len);
            for (int imported_index = 0; imported_index < imported_len; imported_index++)
            {
                ImportedContact imported_element;
                imported_element = Tl.Parse <ImportedContact>(reader);
                this.imported.Add(imported_element);
            }
            reader.ReadInt32();             // vector code
            int users_len = reader.ReadInt32();

            this.users = new List <User>(users_len);
            for (int users_index = 0; users_index < users_len; users_index++)
            {
                User users_element;
                users_element = Tl.Parse <User>(reader);
                this.users.Add(users_element);
            }
        }
 public override void OnResponse(BinaryReader reader)
 {
     message = Tl.Parse <Messages_statedMessageConstructor>(reader);
 }