예제 #1
0
        /// <summary>
        /// Returns the current user's contact list.
        /// </summary>
        /// <returns>Returns the current user's contact list.</returns>
        public async Task <ICollection <Models.Contact> > GetContactsAsync()
        {
            await ConnectAsync();

            ContactsContacts result = await _client.GetContacts();

            ContactsContactsConstructor userContacts = result.As <ContactsContactsConstructor>();

            _contacts = new List <Models.Contact>();
            foreach (User userContact in userContacts.users)
            {
                _contacts.Add((Models.Contact)userContact);
            }
            return(_contacts);
        }
예제 #2
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);
        }
예제 #3
0
 public override void OnResponse(BinaryReader reader)
 {
     contacts = TLObject.Read <ContactsContacts>(reader);
 }