Esempio n. 1
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);
            Date          = GetObject <TLInt>(bytes, ref position);
            AdminId       = GetObject <TLInt>(bytes, ref position);
            ParticipantId = GetObject <TLInt>(bytes, ref position);
            GB            = GetObject <TLString>(bytes, ref position);
            Protocol      = GetObject <TLPhoneCallProtocol>(bytes, ref position);

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

            User           = GetObject <TLUserBase>(bytes, ref position);
            Link           = GetObject <TLLinkBase>(bytes, ref position);
            ProfilePhoto   = GetObject <TLPhotoBase>(bytes, ref position);
            NotifySettings = GetObject <TLPeerNotifySettingsBase>(bytes, ref position);
            Blocked        = GetObject <TLBool>(bytes, ref position);
            RealFirstName  = GetObject <TLString>(bytes, ref position);
            RealLastName   = GetObject <TLString>(bytes, ref position);

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

            _flags                   = GetObject <TLInt>(bytes, ref position);
            _currentAlgo             = GetObject <TLPasswordKdfAlgoBase>(Flags, (int)PasswordFlags.HasPassword, null, bytes, ref position);
            _hint                    = GetObject <TLString>(Flags, (int)PasswordFlags.Hint, null, bytes, ref position);
            _emailUnconfirmedPattern = GetObject <TLString>(Flags, (int)PasswordFlags.EmailUnconfirmedPattern, null, bytes, ref position);
            NewAlgo                  = GetObject <TLPasswordKdfAlgoBase>(bytes, ref position);
            NewSecureAlgo            = GetObject <TLSecurePasswordKdfAlgoBase>(bytes, ref position);
            SecretRandom             = GetObject <TLString>(bytes, ref position);

            return(this);
        }
Esempio n. 4
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);
        }
Esempio n. 5
0
        public override TLObject FromBytes(byte[] bytes, ref int position)
        {
            bytes.ThrowExceptionIfIncorrect(ref position, Signature);

            Flags          = GetObject <TLInt>(bytes, ref position);
            User           = GetObject <TLUserBase>(bytes, ref position);
            About          = GetObject(Flags, (int)UserFullFlags.About, TLString.Empty, bytes, ref position);
            Link           = GetObject <TLLinkBase>(bytes, ref position);
            ProfilePhoto   = GetObject <TLPhotoBase>(Flags, (int)UserFullFlags.ProfilePhoto, null, bytes, ref position);
            NotifySettings = GetObject <TLPeerNotifySettingsBase>(bytes, ref position);
            BotInfo        = GetObject <TLBotInfoBase>(Flags, (int)UserFullFlags.BotInfo, new TLBotInfoEmpty(), bytes, ref position);

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

            Flags      = GetObject <TLInt>(bytes, ref position);
            Key        = GetObject <TLString>(bytes, ref position);
            ZeroValue  = GetObject <TLString>(Flags, (int)LangPackStringPluralizedFlags.ZeroValue, null, bytes, ref position);
            OneValue   = GetObject <TLString>(Flags, (int)LangPackStringPluralizedFlags.OneValue, null, bytes, ref position);
            TwoValue   = GetObject <TLString>(Flags, (int)LangPackStringPluralizedFlags.TwoValue, null, bytes, ref position);
            FewValue   = GetObject <TLString>(Flags, (int)LangPackStringPluralizedFlags.FewValue, null, bytes, ref position);
            ManyValue  = GetObject <TLString>(Flags, (int)LangPackStringPluralizedFlags.ManyValue, null, bytes, ref position);
            OtherValue = GetObject <TLString>(Flags, (int)LangPackStringPluralizedFlags.OtherValue, null, bytes, ref position);

            return(this);
        }
Esempio n. 7
0
        public override bool ProxyEquals(TLProxyBase proxy)
        {
            var socks5Proxy = proxy as TLSocks5Proxy;

            if (socks5Proxy == null)
            {
                return(false);
            }

            return
                (TLString.Equals(Server, socks5Proxy.Server, StringComparison.OrdinalIgnoreCase) &&
                 Port.Value == socks5Proxy.Port.Value &&
                 TLString.Equals(Username, socks5Proxy.Username, StringComparison.Ordinal) &&
                 TLString.Equals(Password, socks5Proxy.Password, StringComparison.Ordinal));
        }
        public override TLObject FromBytes(byte[] bytes, ref int position)
        {
            bytes.ThrowExceptionIfIncorrect(ref position, Signature);

            Flags       = GetObject <TLInt>(bytes, ref position);
            Geo         = GetObject <TLGeoPointBase>(bytes, ref position);
            Title       = GetObject <TLString>(bytes, ref position);
            Address     = GetObject <TLString>(bytes, ref position);
            Provider    = GetObject <TLString>(bytes, ref position);
            VenueId     = GetObject <TLString>(bytes, ref position);
            VenueType   = GetObject <TLString>(bytes, ref position);
            ReplyMarkup = GetObject <TLReplyKeyboardBase>(Flags, (int)BotInlineMessageFlags.ReplyMarkup, null, bytes, ref position);

            return(this);
        }
Esempio n. 9
0
        public override TLObject FromStream(Stream input)
        {
            Id                = GetObject <TLInt>(input);
            _title            = GetObject <TLString>(input);
            _photo            = GetObject <TLPhotoBase>(input);
            ParticipantsCount = GetObject <TLInt>(input);
            Date              = GetObject <TLInt>(input);
            Left              = GetObject <TLBool>(input);
            Version           = GetObject <TLInt>(input);

            Participants   = GetObject <TLObject>(input) as TLChatParticipantsBase;
            NotifySettings = GetObject <TLObject>(input) as TLPeerNotifySettingsBase;

            return(this);
        }
Esempio n. 10
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);
            FileName   = GetObject <TLString>(bytes, ref position);
            MimeType   = GetObject <TLString>(bytes, ref position);
            Size       = GetObject <TLInt>(bytes, ref position);
            Thumb      = GetObject <TLPhotoSizeBase>(bytes, ref position);
            DCId       = GetObject <TLInt>(bytes, ref position);

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

            Thumb    = GetObject <TLString>(bytes, ref position);
            ThumbW   = GetObject <TLInt>(bytes, ref position);
            ThumbH   = GetObject <TLInt>(bytes, ref position);
            Duration = GetObject <TLInt>(bytes, ref position);
            MimeType = GetObject <TLString>(bytes, ref position);
            W        = GetObject <TLInt>(bytes, ref position);
            H        = GetObject <TLInt>(bytes, ref position);
            Size     = GetObject <TLInt>(bytes, ref position);
            Key      = GetObject <TLString>(bytes, ref position);
            IV       = GetObject <TLString>(bytes, ref position);

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

            Flags             = GetObject <TLInt>(bytes, ref position);
            BotId             = GetObject <TLInt>(bytes, ref position);
            Invoice           = GetObject <TLInvoice>(bytes, ref position);
            ProviderId        = GetObject <TLInt>(bytes, ref position);
            Url               = GetObject <TLString>(bytes, ref position);
            _nativeProvider   = GetObject <TLString>(Flags, (int)PaymentFormFlags.Native, null, bytes, ref position);
            _nativeParams     = GetObject <TLDataJSON>(Flags, (int)PaymentFormFlags.Native, null, bytes, ref position);
            _savedInfo        = GetObject <TLPaymentRequestedInfo>(Flags, (int)PaymentFormFlags.SavedInfo, null, bytes, ref position);
            _savedCredentials = GetObject <TLPaymentSavedCredentials>(Flags, (int)PaymentFormFlags.SavedCredentials, null, bytes, ref position);
            Users             = GetObject <TLVector <TLUserBase> >(bytes, ref position);

            return(this);
        }
Esempio n. 13
0
        public override TLObject FromStream(Stream input)
        {
            Thumb    = GetObject <TLString>(input);
            ThumbW   = GetObject <TLInt>(input);
            ThumbH   = GetObject <TLInt>(input);
            Duration = GetObject <TLInt>(input);
            MimeType = GetObject <TLString>(input);
            W        = GetObject <TLInt>(input);
            H        = GetObject <TLInt>(input);
            Size     = GetObject <TLInt>(input);
            Key      = GetObject <TLString>(input);
            IV       = GetObject <TLString>(input);

            File = GetNullableObject <TLEncryptedFileBase>(input);

            return(this);
        }
Esempio n. 14
0
        public override void Update(TLChatBase chat)
        {
            base.Update(chat);
            var c = chat as TLChannelForbidden;

            if (c != null)
            {
                Id         = c.Id;
                AccessHash = c.AccessHash;
                Title      = c.Title;

                if (c.CustomFlags != null)
                {
                    CustomFlags = c.CustomFlags;
                }
            }
        }
Esempio n. 15
0
        public override void Update(TLChatBase chat)
        {
            base.Update(chat);
            var c = chat as TLBroadcastChat;

            if (c != null)
            {
                _title = c.Title;
                if (Photo.GetType() != c.Photo.GetType())
                {
                    _photo = c.Photo;
                }
                else
                {
                    Photo.Update(c.Photo);
                }
                ParticipantIds = c.ParticipantIds;
            }
        }
        public override TLObject FromStream(Stream input)
        {
            Id            = GetObject <TLInt>(input);
            AccessHash    = GetObject <TLLong>(input);
            Date          = GetObject <TLInt>(input);
            AdminId       = GetObject <TLInt>(input);
            ParticipantId = GetObject <TLInt>(input);
            GAorB         = GetObject <TLString>(input);

            Key            = GetNullableObject <TLString>(input);
            KeyFingerprint = GetNullableObject <TLLong>(input);
            P          = GetNullableObject <TLString>(input);
            G          = GetNullableObject <TLInt>(input);
            A          = GetNullableObject <TLString>(input);
            MessageTTL = GetNullableObject <TLInt>(input);
            FileName   = GetNullableObject <TLString>(input);

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

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

            if (IsSet(Flags, (int)PasswordFlags.Password))
            {
                NewSalt         = GetObject <TLString>(bytes, ref position);
                NewPasswordHash = GetObject <TLString>(bytes, ref position);
                Hint            = GetObject <TLString>(bytes, ref position);
            }
            if (IsSet(Flags, (int)PasswordFlags.Email))
            {
                Email = GetObject <TLString>(bytes, ref position);
            }

            return(this);
        }
Esempio n. 18
0
        public static bool Equals(TLString str1, TLString str2, StringComparison comparison)
        {
            if (str1 == null && str2 == null)
            {
                return(true);
            }

            if (str1 != null && str2 == null)
            {
                return(false);
            }

            if (str1 == null)
            {
                return(false);
            }

            return(string.Equals(str1.ToString(), str2.ToString(), comparison));
        }
Esempio n. 19
0
        public static TLMessage40 GetShortMessage(
            TLInt id,
            TLInt fromId,
            TLPeerBase toId,
            TLInt date,
            TLString message)
        {
#if LAYER_40
            var m = new TLMessage40
            {
                Flags   = new TLInt(0),
                Id      = id,
                FromId  = fromId,
                ToId    = toId,
                Out     = TLBool.False,
                _date   = date,
                Message = message,
                _media  = new TLMessageMediaEmpty()
            };
            if (m.FromId != null)
            {
                m.SetFromId();
            }
            if (m._media != null)
            {
                m.SetMedia();
            }
#else
            var m = new TLMessage36
            {
                Id      = id,
                FromId  = fromId,
                ToId    = toId,
                Out     = TLBool.False,
                _date   = date,
                Message = message,
                _media  = new TLMessageMediaEmpty()
            };
#endif
            return(m);
        }
Esempio n. 20
0
        public override void Update(TLPhotoSizeBase photoSizeBase)
        {
            base.Update(photoSizeBase);

            var photoSize = photoSizeBase as TLPhotoCachedSize;

            if (photoSize != null)
            {
                W     = photoSize.W;
                H     = photoSize.H;
                Bytes = photoSize.Bytes;
                if (Location != null)
                {
                    Location.Update(photoSize.Location);
                }
                else
                {
                    Location = photoSize.Location;
                }
            }
        }
Esempio n. 21
0
        public override bool DraftEquals(TLDraftMessageBase draftBase)
        {
            var draftEmpty = draftBase as TLDraftMessageEmpty;

            if (draftEmpty != null)
            {
                return(IsEmpty());
            }

            var draft = draftBase as TLDraftMessage;

            if (draft != null)
            {
                if (Flags.Value != draft.Flags.Value)
                {
                    return(false);
                }

                if (!TLString.Equals(Message, draft.Message, StringComparison.Ordinal))
                {
                    return(false);
                }

                if (ReplyToMsgId != null && draft.ReplyToMsgId != null && ReplyToMsgId.Value != draft.ReplyToMsgId.Value)
                {
                    return(false);
                }

                if (Entities != null && draft.Entities != null && Entities.Count != draft.Entities.Count)
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }

            return(true);
        }
Esempio n. 22
0
        public override void Update(TLChatBase chat)
        {
            base.Update(chat);
            var c = chat as TLChat;

            if (c != null)
            {
                _title = c.Title;
                if (Photo.GetType() != c.Photo.GetType())
                {
                    _photo = c.Photo;    // при удалении фото чата не обновляется UI при _photo = c.Photo
                }
                else
                {
                    Photo.Update(c.Photo);
                }
                ParticipantsCount = c.ParticipantsCount;
                Date    = c.Date;
                Left    = c.Left;
                Version = c.Version;
            }
        }
Esempio n. 23
0
        public virtual void Update(TLEncryptedChatBase chat)
        {
            Id = chat.Id;
            if (chat.Key != null)
            {
                _key = chat._key;
            }
            if (chat.KeyFingerprint != null)
            {
                KeyFingerprint = chat.KeyFingerprint;
            }
            if (chat.P != null)
            {
                P = chat.P;
            }
            if (chat.G != null)
            {
                G = chat.G;
            }
            if (chat.A != null)
            {
                A = chat.A;
            }

            if (chat.CustomFlags != null)
            {
                CustomFlags = chat.CustomFlags;
            }
            if (chat.OriginalKey != null)
            {
                OriginalKey = chat.OriginalKey;
            }
            if (chat.ExtendedKey != null)
            {
                ExtendedKey = chat.ExtendedKey;
            }
        }
Esempio n. 24
0
        public override TLObject FromStream(Stream input)
        {
            Message = GetObject <TLString>(input);

            return(this);
        }
Esempio n. 25
0
        public override TLObject FromStream(Stream input)
        {
            Caption = GetObject <TLString>(input);

            return(this);
        }
Esempio n. 26
0
        public override TLObject FromStream(Stream input)
        {
            Hashtag = GetObject <TLString>(input);

            return(this);
        }
Esempio n. 27
0
 public override bool IsEmpty()
 {
     return(TLString.IsNullOrEmpty(Message) && ReplyToMsgId == null);
 }
Esempio n. 28
0
 public TLInputMediaUploadedPhoto28(TLInputMediaUploadedPhoto inputMediaUploadedPhoto, TLString caption)
 {
     File    = inputMediaUploadedPhoto.File;
     Caption = caption;
 }
Esempio n. 29
0
 public TLKeyboardButton(TLString text)
 {
     Text = text;
 }
Esempio n. 30
0
 public TLInputMediaPhoto28(TLInputMediaPhoto inputMediaPhoto, TLString caption)
 {
     Id      = inputMediaPhoto.Id;
     Caption = caption;
 }