Ejemplo n.º 1
0
        public override TLObject FromBytes(byte[] bytes, ref int position)
        {
            bytes.ThrowExceptionIfIncorrect(ref position, Signature);

            Expires = GetObject <TLInt>(bytes, ref position);
            User    = GetObject <TLUserBase>(bytes, ref position);

            return(this);
        }
Ejemplo n.º 2
0
        public override void Update(TLUserBase userBase)
        {
            base.Update(userBase);

            try
            {
                var user = userBase as TLUser;
                if (user != null)
                {
                    if (user.IsMin)
                    {
                        // TODO: ???
                        return;
                    }

                    // TODO: check if dirty?

                    this.Flags                = user.Flags;
                    this.AccessHash           = user.AccessHash;
                    this.FirstName            = user.FirstName;
                    this.LastName             = user.LastName;
                    this.Username             = user.Username;
                    this.Phone                = user.Phone;
                    this.Photo                = user.Photo;
                    this.Status               = user.Status;
                    this.BotInfoVersion       = user.BotInfoVersion;
                    this.RestrictionReason    = user.RestrictionReason;
                    this.BotInlinePlaceholder = user.BotInlinePlaceholder;
                    this.LangCode             = user.LangCode;

                    //FirstName = user.FirstName;
                    //LastName = user.LastName;
                    //Phone = user.Phone;

                    //if (Photo != null && user.Photo != null && Photo.GetType() != user.Photo.GetType())
                    //{
                    //    Photo.Update(user.Photo);
                    //}
                    //else
                    //{
                    //    Photo = user.Photo;
                    //}

                    //Status = user.Status;
                }
            }
            catch (Exception e)
            {
            }
        }
Ejemplo n.º 3
0
        //#region UserFull information

        //public TLContactsLink Link { get; set; }

        //public TLPhotoBase ProfilePhoto { get; set; }

        //public TLPeerNotifySettingsBase NotifySettings { get; set; }

        //public virtual bool IsBlocked { get; set; }

        //public TLBotInfo BotInfo { get; set; }

        //#endregion

        public virtual void Update(TLUserBase user)
        {
            try
            {
                if (user.Contact != null)
                {
                    Contact = user.Contact;
                }

                //if (user.Link != null)
                //{
                //    Link = user.Link;
                //}

                //if (user.ProfilePhoto != null)
                //{
                //    ProfilePhoto = user.ProfilePhoto;
                //}

                //if (user.NotifySettings != null)
                //{
                //    NotifySettings = user.NotifySettings;
                //}
                if (user.ReadInboxMaxId != 0 && (ReadInboxMaxId == 0 || ReadInboxMaxId < user.ReadInboxMaxId))
                {
                    ReadInboxMaxId = user.ReadInboxMaxId;
                }
                if (user.ReadOutboxMaxId != 0 && (ReadOutboxMaxId == 0 || ReadOutboxMaxId < user.ReadOutboxMaxId))
                {
                    ReadOutboxMaxId = user.ReadOutboxMaxId;
                }

                //if (user.ExtendedInfo != null)
                //{
                //    ExtendedInfo = user.ExtendedInfo;
                //}

                //if (user.IsBlocked != null)
                //{
                //    IsBlocked = user.IsBlocked;
                //}
            }
            catch (Exception e)
            {
            }
        }