Exemple #1
0
        public override TLObject FromStream(Stream input)
        {
            Flags      = GetObject <TLInt>(input);
            Id         = GetObject <TLLong>(input);
            AccessHash = GetObject <TLLong>(input);
            Title      = GetObject <TLString>(input);
            ShortName  = GetObject <TLString>(input);
            Count      = GetObject <TLInt>(input);
            Hash       = GetObject <TLInt>(input);

            return(this);
        }
Exemple #2
0
 public virtual void Update(TLSecureValue result)
 {
     Flags       = new TLInt(0);
     Type        = result.Type;
     Data        = result.Data;
     FrontSide   = result.FrontSide;
     ReverseSide = result.ReverseSide;
     Selfie      = result.Selfie;
     Files       = result.Files;
     PlainData   = result.PlainData;
     Hash        = result.Hash;
 }
Exemple #3
0
        public override TLObject FromBytes(byte[] bytes, ref int position)
        {
            bytes.ThrowExceptionIfIncorrect(ref position, Signature);

            Pts         = GetObject <TLInt>(bytes, ref position);
            Qts         = GetObject <TLInt>(bytes, ref position);
            Date        = GetObject <TLInt>(bytes, ref position);
            Seq         = GetObject <TLInt>(bytes, ref position);
            UnreadCount = GetObject <TLInt>(bytes, ref position);

            return(this);
        }
Exemple #4
0
        protected static bool IsSet(TLInt flags, int flag)
        {
            var isSet = false;

            if (flags != null)
            {
                var intFlag = flag;
                isSet = (flags.Value & intFlag) == intFlag;
            }

            return(isSet);
        }
        public override TLObject FromBytes(byte[] bytes, ref int position)
        {
            bytes.ThrowExceptionIfIncorrect(ref position, Signature);

            Peer           = GetObject <TLPeerBase>(bytes, ref position);
            TopMessageId   = GetObject <TLInt>(bytes, ref position);
            ReadInboxMaxId = GetObject <TLInt>(bytes, ref position);
            UnreadCount    = GetObject <TLInt>(bytes, ref position);
            NotifySettings = GetObject <TLPeerNotifySettingsBase>(bytes, ref position);

            return(this);
        }
Exemple #6
0
        public override TLObject FromBytes(byte[] bytes, ref int position)
        {
            bytes.ThrowExceptionIfIncorrect(ref position, Signature);

            Updates = GetObject <TLVector <TLUpdateBase> >(bytes, ref position);
            Users   = GetObject <TLVector <TLUserBase> >(bytes, ref position);
            Chats   = GetObject <TLVector <TLChatBase> >(bytes, ref position);
            Date    = GetObject <TLInt>(bytes, ref position);
            Seq     = GetObject <TLInt>(bytes, ref position);

            return(this);
        }
Exemple #7
0
        public override TLObject FromBytes(byte[] bytes, ref int position)
        {
            bytes.ThrowExceptionIfIncorrect(ref position, Signature);

            Url         = GetObject <TLString>(bytes, ref position);
            ThumbUrl    = GetObject <TLString>(bytes, ref position);
            ContentUrl  = GetObject <TLString>(bytes, ref position);
            ContentType = GetObject <TLString>(bytes, ref position);
            W           = GetObject <TLInt>(bytes, ref position);
            H           = GetObject <TLInt>(bytes, ref position);

            return(this);
        }
        public override TLObject FromBytes(byte[] bytes, ref int position)
        {
            bytes.ThrowExceptionIfIncorrect(ref position, Signature);

            Flags      = GetObject <TLInt>(bytes, ref position);
            QueryId    = GetObject <TLLong>(bytes, ref position);
            NextOffset = GetObject <TLString>(Flags, (int)BotResultsFlags.NextOffset, null, bytes, ref position);
            SwitchPM   = GetObject <TLInlineBotSwitchPM>(Flags, (int)BotResultsFlags.SwitchPM, null, bytes, ref position);
            Results    = GetObject <TLVector <TLBotInlineResultBase> >(bytes, ref position);
            CacheTime  = GetObject <TLInt>(bytes, ref position);

            return(this);
        }
Exemple #9
0
        protected static void Set(ref TLInt flags, int flag)
        {
            var intFlag = flag;

            if (flags != null)
            {
                flags.Value |= intFlag;
            }
            else
            {
                flags = new TLInt(intFlag);
            }
        }
Exemple #10
0
 protected static void SetField <T>(out T field, T value, ref TLInt flags, int flag) where T : TLObject
 {
     if (value != null)
     {
         Set(ref flags, flag);
         field = value;
     }
     else
     {
         Unset(ref flags, flag);
         field = null;
     }
 }
Exemple #11
0
        public override TLObject FromStream(Stream input)
        {
            Flags         = GetObject <TLInt>(input);
            Id            = GetObject <TLLong>(input);
            AccessHash    = GetObject <TLLong>(input);
            Date          = GetObject <TLInt>(input);
            AdminId       = GetObject <TLInt>(input);
            ParticipantId = GetObject <TLInt>(input);
            Protocol      = GetObject <TLPhoneCallProtocol>(input);
            ReceiveDate   = GetObject <TLInt>(Flags, (int)PhoneCallWaitingFlags.ReceiveDate, null, input);

            return(this);
        }
        public override TLObject FromBytes(byte[] bytes, ref int position)
        {
            bytes.ThrowExceptionIfIncorrect(ref position, Signature);

            _flags           = GetObject <TLInt>(bytes, ref position);
            _newlyJoinedFeed = GetObject <TLInt>(Flags, (int)FeedSourcesFlags.NewlyJoinedFeed, null, bytes, ref position);

            Feeds = GetObject <TLVector <TLFeedBroadcastsBase> >(bytes, ref position);
            Chats = GetObject <TLVector <TLChatBase> >(bytes, ref position);
            Users = GetObject <TLVector <TLUserBase> >(bytes, ref position);

            return(this);
        }
Exemple #13
0
 private static void SetFlagValue <T>(T value, out T field, ref TLInt flags, int flag) where T : TLObject
 {
     if (value != null)
     {
         Set(ref flags, flag);
         field = value;
     }
     else
     {
         Unset(ref flags, flag);
         field = default(T);
     }
 }
Exemple #14
0
        public override TLObject FromBytes(byte[] bytes, ref int position)
        {
            bytes.ThrowExceptionIfIncorrect(ref position, Signature);

            _flags            = GetObject <TLInt>(bytes, ref position);
            RequiredTypes     = GetObject <TLVector <TLSecureValueTypeBase> >(bytes, ref position);
            Values            = GetObject <TLVector <TLSecureValue> >(bytes, ref position);
            Errors            = GetObject <TLVector <TLSecureValueErrorBase> >(bytes, ref position);
            Users             = GetObject <TLVector <TLUserBase> >(bytes, ref position);
            _privacyPolicyUrl = GetObject <TLString>(Flags, (int)AuthorizationFormFlags.PrivacyPolicyUrl, null, bytes, ref position);

            return(this);
        }
Exemple #15
0
        protected static void Unset(ref TLInt flags, int flag)
        {
            var intFlag = flag;

            if (flags != null)
            {
                flags.Value &= ~intFlag;
            }
            else
            {
                flags = new TLInt(0);
            }
        }
        public override TLObject FromStream(Stream input)
        {
            Flags          = GetObject <TLInt>(input);
            FromId         = GetObject <TLInt>(Flags, (int)MessageFwdHeaderFlags.From, null, input);
            Date           = GetObject <TLInt>(input);
            ChannelId      = GetObject <TLInt>(Flags, (int)MessageFwdHeaderFlags.Channel, null, input);
            ChannelPost    = GetObject <TLInt>(Flags, (int)MessageFwdHeaderFlags.ChannelPost, null, input);
            PostAuthor     = GetObject <TLString>(Flags, (int)MessageFwdHeaderFlags.PostAuthor, null, input);
            SavedFromPeer  = GetObject <TLPeerBase>(Flags, (int)MessageFwdHeaderFlags.Saved, null, input);
            SavedFromMsgId = GetObject <TLInt>(Flags, (int)MessageFwdHeaderFlags.Saved, null, input);

            return(this);
        }
Exemple #17
0
        public override TLObject FromStream(Stream input)
        {
            Id         = GetObject <TLLong>(input);
            AccessHash = GetObject <TLLong>(input);
            UserId     = GetObject <TLInt>(input);
            Date       = GetObject <TLInt>(input);
            Duration   = GetObject <TLInt>(input);
            MimeType   = GetObject <TLString>(input);
            Size       = GetObject <TLInt>(input);
            DCId       = GetObject <TLInt>(input);

            return(this);
        }
Exemple #18
0
        public override TLObject FromBytes(byte[] bytes, ref int position)
        {
            bytes.ThrowExceptionIfIncorrect(ref position, Signature);

            Id       = GetObject <TLInt>(bytes, ref position);
            UserId   = GetObject <TLInt>(bytes, ref position);
            Message  = GetObject <TLString>(bytes, ref position);
            Pts      = GetObject <TLInt>(bytes, ref position);
            PtsCount = GetObject <TLInt>(bytes, ref position);
            Date     = GetObject <TLInt>(bytes, ref position);

            return(this);
        }
Exemple #19
0
        public override TLObject FromBytes(byte[] bytes, ref int position)
        {
            bytes.ThrowExceptionIfIncorrect(ref position, Signature);

            Url        = GetObject <TLString>(bytes, ref position);
            AccessHash = GetObject <TLLong>(bytes, ref position);
            Size       = GetObject <TLInt>(bytes, ref position);
            MimeType   = GetObject <TLString>(bytes, ref position);
            Attributes = GetObject <TLVector <TLDocumentAttributeBase> >(bytes, ref position);
            DCId       = GetObject <TLInt>(bytes, ref position);

            return(this);
        }
Exemple #20
0
        public override TLObject FromBytes(byte[] bytes, ref int position)
        {
            bytes.ThrowExceptionIfIncorrect(ref position, Signature);

            Flags      = GetObject <TLInt>(bytes, ref position);
            Id         = GetObject <TLLong>(bytes, ref position);
            AccessHash = GetObject <TLLong>(bytes, ref position);
            Title      = GetObject <TLString>(bytes, ref position);
            ShortName  = GetObject <TLString>(bytes, ref position);
            Count      = GetObject <TLInt>(bytes, ref position);
            Hash       = GetObject <TLInt>(bytes, ref position);

            return(this);
        }
Exemple #21
0
        public override TLObject FromBytes(byte[] bytes, ref int position)
        {
            bytes.ThrowExceptionIfIncorrect(ref position, Signature);

            _flags                  = GetObject <TLInt>(bytes, ref position);
            CurrentSalt             = GetObject <TLString>(bytes, ref position);
            NewSalt                 = GetObject <TLString>(bytes, ref position);
            NewSecureSalt           = GetObject <TLString>(bytes, ref position);
            SecretRandom            = GetObject <TLString>(bytes, ref position);
            Hint                    = GetObject <TLString>(bytes, ref position);
            EmailUnconfirmedPattern = GetObject <TLString>(bytes, ref position);

            return(this);
        }
Exemple #22
0
        public override TLObject FromBytes(byte[] bytes, ref int position)
        {
            bytes.ThrowExceptionIfIncorrect(ref position, Signature);

            Id                = GetObject <TLInt>(bytes, ref position);
            _title            = GetObject <TLString>(bytes, ref position);
            _photo            = GetObject <TLPhotoBase>(bytes, ref position);
            ParticipantsCount = GetObject <TLInt>(bytes, ref position);
            Date              = GetObject <TLInt>(bytes, ref position);
            Left              = GetObject <TLBool>(bytes, ref position);
            Version           = GetObject <TLInt>(bytes, ref position);

            return(this);
        }
        public override void Update(TLEncryptedChatBase chat)
        {
            base.Update(chat);

            var chatCommon = chat as TLEncryptedChatCommon;

            if (chatCommon != null)
            {
                AccessHash    = chatCommon.AccessHash;
                Date          = chatCommon.Date;
                AdminId       = chatCommon.AdminId;
                ParticipantId = chatCommon.ParticipantId;
            }
        }
Exemple #24
0
        public override TLObject FromStream(Stream input)
        {
            Id         = GetObject <TLLong>(input);
            AccessHash = GetObject <TLLong>(input);
            Date       = GetObject <TLInt>(input);
            MimeType   = GetObject <TLString>(input);
            Size       = GetObject <TLInt>(input);
            Thumb      = GetObject <TLPhotoSizeBase>(input);
            DCId       = GetObject <TLInt>(input);
            Version    = GetObject <TLInt>(input);
            Attributes = GetObject <TLVector <TLDocumentAttributeBase> >(input);

            return(this);
        }
Exemple #25
0
        public override TLObject FromBytes(byte[] bytes, ref int position)
        {
            bytes.ThrowExceptionIfIncorrect(ref position, Signature);

            Flags = GetObject <TLInt>(bytes, ref position);
            Id    = GetObject <TLString>(bytes, ref position);
            Type  = GetObject <TLString>(bytes, ref position);

            if (IsSet(Flags, (int)BotInlineResultFlags.Title))
            {
                Title = GetObject <TLString>(bytes, ref position);
            }

            if (IsSet(Flags, (int)BotInlineResultFlags.Description))
            {
                Description = GetObject <TLString>(bytes, ref position);
            }

            if (IsSet(Flags, (int)BotInlineResultFlags.Url))
            {
                Url = GetObject <TLString>(bytes, ref position);
            }

            if (IsSet(Flags, (int)BotInlineResultFlags.Thumb))
            {
                ThumbUrl = GetObject <TLString>(bytes, ref position);
            }

            if (IsSet(Flags, (int)BotInlineResultFlags.Content))
            {
                ContentUrl  = GetObject <TLString>(bytes, ref position);
                ContentType = GetObject <TLString>(bytes, ref position);
            }

            if (IsSet(Flags, (int)BotInlineResultFlags.Size))
            {
                W = GetObject <TLInt>(bytes, ref position);
                H = GetObject <TLInt>(bytes, ref position);
            }

            if (IsSet(Flags, (int)BotInlineResultFlags.Duration))
            {
                Duration = GetObject <TLInt>(bytes, ref position);
            }

            SendMessage = GetObject <TLBotInlineMessageBase>(bytes, ref position);

            return(this);
        }
Exemple #26
0
        public override TLObject FromBytes(byte[] bytes, ref int position)
        {
            bytes.ThrowExceptionIfIncorrect(ref position, Signature);

            Id         = GetObject <TLLong>(bytes, ref position);
            AccessHash = GetObject <TLLong>(bytes, ref position);
            UserId     = GetObject <TLInt>(bytes, ref position);
            Date       = GetObject <TLInt>(bytes, ref position);
            Duration   = GetObject <TLInt>(bytes, ref position);
            MimeType   = GetObject <TLString>(bytes, ref position);
            Size       = GetObject <TLInt>(bytes, ref position);
            DCId       = GetObject <TLInt>(bytes, ref position);

            return(this);
        }
Exemple #27
0
        public override TLObject FromBytes(byte[] bytes, ref int position)
        {
            bytes.ThrowExceptionIfIncorrect(ref position, Signature);

            _flags           = GetObject <TLInt>(bytes, ref position);
            _maxPosition     = GetObject <TLFeedPosition>(Flags, (int)FeedMessagesFlags.MaxPosition, null, bytes, ref position);
            _minPosition     = GetObject <TLFeedPosition>(Flags, (int)FeedMessagesFlags.MinPosition, null, bytes, ref position);
            _readMaxPosition = GetObject <TLFeedPosition>(Flags, (int)FeedMessagesFlags.ReadMaxPosition, null, bytes, ref position);

            Messages = GetObject <TLVector <TLMessageBase> >(bytes, ref position);
            Chats    = GetObject <TLVector <TLChatBase> >(bytes, ref position);
            Users    = GetObject <TLVector <TLUserBase> >(bytes, ref position);

            return(this);
        }
        public override TLObject FromBytes(byte[] bytes, ref int position)
        {
            bytes.ThrowExceptionIfIncorrect(ref position, Signature);

            Flags          = GetObject <TLInt>(bytes, ref position);
            FromId         = GetObject <TLInt>(Flags, (int)MessageFwdHeaderFlags.From, null, bytes, ref position);
            Date           = GetObject <TLInt>(bytes, ref position);
            ChannelId      = GetObject <TLInt>(Flags, (int)MessageFwdHeaderFlags.Channel, null, bytes, ref position);
            ChannelPost    = GetObject <TLInt>(Flags, (int)MessageFwdHeaderFlags.ChannelPost, null, bytes, ref position);
            PostAuthor     = GetObject <TLString>(Flags, (int)MessageFwdHeaderFlags.PostAuthor, null, bytes, ref position);
            SavedFromPeer  = GetObject <TLPeerBase>(Flags, (int)MessageFwdHeaderFlags.Saved, null, bytes, ref position);
            SavedFromMsgId = GetObject <TLInt>(Flags, (int)MessageFwdHeaderFlags.Saved, null, bytes, ref position);

            return(this);
        }
        public static bool IsVoice(IAttributes attributes, TLInt size)
        {
#if WP8
            if (size == null || size.Value > 0)
            {
                var audioAttribute = attributes.Attributes.FirstOrDefault(x => x is TLDocumentAttributeAudio46) as TLDocumentAttributeAudio46;
                if (audioAttribute != null && audioAttribute.Voice)
                {
                    return(true);
                }
            }
#endif

            return(false);
        }
Exemple #30
0
        public override TLObject FromBytes(byte[] bytes, ref int position)
        {
            bytes.ThrowExceptionIfIncorrect(ref position, Signature);

            Flags         = GetObject <TLInt>(bytes, ref position);
            Id            = GetObject <TLLong>(bytes, ref position);
            AccessHash    = GetObject <TLLong>(bytes, ref position);
            Date          = GetObject <TLInt>(bytes, ref position);
            AdminId       = GetObject <TLInt>(bytes, ref position);
            ParticipantId = GetObject <TLInt>(bytes, ref position);
            Protocol      = GetObject <TLPhoneCallProtocol>(bytes, ref position);
            ReceiveDate   = GetObject <TLInt>(Flags, (int)PhoneCallWaitingFlags.ReceiveDate, null, bytes, ref position);

            return(this);
        }