public override void Read(TLBinaryReader from)
 {
     Flags   = (Flag)from.ReadInt32();
     QueryId = from.ReadInt64();
     UserId  = from.ReadInt32();
     Payload = from.ReadByteArray();
     if (HasInfo)
     {
         Info = TLFactory.Read <TLPaymentRequestedInfo>(from);
     }
     if (HasShippingOptionId)
     {
         ShippingOptionId = from.ReadString();
     }
     Currency    = from.ReadString();
     TotalAmount = from.ReadInt64();
 }
Exemple #2
0
 public override void Read(TLBinaryReader from)
 {
     Id            = from.ReadInt32();
     AccessHash    = from.ReadInt64();
     Date          = from.ReadInt32();
     AdminId       = from.ReadInt32();
     ParticipantId = from.ReadInt32();
 }
Exemple #3
0
 public override void Read(TLBinaryReader from)
 {
     RandomId = from.ReadInt64();
     ChatId   = from.ReadInt32();
     Date     = from.ReadInt32();
     Bytes    = from.ReadByteArray();
     File     = TLFactory.Read <TLEncryptedFileBase>(from);
 }
Exemple #4
0
 public override void Read(TLBinaryReader from)
 {
     Flags        = (Flag)from.ReadInt32();
     QueryId      = from.ReadInt64();
     UserId       = from.ReadInt32();
     Peer         = TLFactory.Read <TLPeerBase>(from);
     MsgId        = from.ReadInt32();
     ChatInstance = from.ReadInt64();
     if (HasData)
     {
         Data = from.ReadByteArray();
     }
     if (HasGameShortName)
     {
         GameShortName = from.ReadString();
     }
 }
 public override void Read(TLBinaryReader from)
 {
     Id      = from.ReadInt64();
     Ip      = from.ReadString();
     Ipv6    = from.ReadString();
     Port    = from.ReadInt32();
     PeerTag = from.ReadByteArray();
 }
Exemple #6
0
 public override void Read(TLBinaryReader from)
 {
     Url        = from.ReadString();
     AccessHash = from.ReadInt64();
     Size       = from.ReadInt32();
     MimeType   = from.ReadString();
     Attributes = TLFactory.Read <TLVector <TLDocumentAttributeBase> >(from);
     DCId       = from.ReadInt32();
 }
 public override void Read(TLBinaryReader from)
 {
     Flags      = (Flag)from.ReadInt32();
     Id         = from.ReadInt32();
     AccessHash = from.ReadInt64();
     Title      = from.ReadString();
     if (HasUntilDate)
     {
         UntilDate = from.ReadInt32();
     }
 }
Exemple #8
0
 public override void Read(TLBinaryReader from)
 {
     Hash        = from.ReadInt64();
     BotId       = from.ReadInt32();
     Domain      = from.ReadString();
     Browser     = from.ReadString();
     Platform    = from.ReadString();
     DateCreated = from.ReadInt32();
     DateActive  = from.ReadInt32();
     Ip          = from.ReadString();
     Region      = from.ReadString();
 }
Exemple #9
0
 public override void Read(TLBinaryReader from)
 {
     Flags   = (Flag)from.ReadInt32();
     QueryId = from.ReadInt64();
     UserId  = from.ReadInt32();
     Query   = from.ReadString();
     if (HasGeo)
     {
         Geo = TLFactory.Read <TLGeoPointBase>(from);
     }
     Offset = from.ReadString();
 }
Exemple #10
0
 public override void Read(TLBinaryReader from)
 {
     Flags = (Flag)from.ReadInt32();
     Id    = from.ReadInt32();
     if (HasFromId)
     {
         FromId = from.ReadInt32();
     }
     ToId = TLFactory.Read <TLPeerBase>(from);
     if (HasFwdFrom)
     {
         FwdFrom = TLFactory.Read <TLMessageFwdHeader>(from);
     }
     if (HasViaBotId)
     {
         ViaBotId = from.ReadInt32();
     }
     if (HasReplyToMsgId)
     {
         ReplyToMsgId = from.ReadInt32();
     }
     Date    = from.ReadInt32();
     Message = from.ReadString();
     if (HasMedia)
     {
         Media = TLFactory.Read <TLMessageMediaBase>(from);
     }
     if (HasReplyMarkup)
     {
         ReplyMarkup = TLFactory.Read <TLReplyMarkupBase>(from);
     }
     if (HasEntities)
     {
         Entities = TLFactory.Read <TLVector <TLMessageEntityBase> >(from);
     }
     if (HasViews)
     {
         Views = from.ReadInt32();
     }
     if (HasEditDate)
     {
         EditDate = from.ReadInt32();
     }
     if (HasPostAuthor)
     {
         PostAuthor = from.ReadString();
     }
     if (HasGroupedId)
     {
         GroupedId = from.ReadInt64();
     }
 }
Exemple #11
0
 public override void Read(TLBinaryReader from)
 {
     Flags = (Flag)from.ReadInt32();
     Id    = from.ReadInt64();
     if (HasReason)
     {
         Reason = TLFactory.Read <TLPhoneCallDiscardReasonBase>(from);
     }
     if (HasDuration)
     {
         Duration = from.ReadInt32();
     }
 }
Exemple #12
0
 public override void Read(TLBinaryReader from)
 {
     Flags = (Flag)from.ReadInt32();
     Id    = from.ReadInt32();
     if (HasAccessHash)
     {
         AccessHash = from.ReadInt64();
     }
     if (HasFirstName)
     {
         FirstName = from.ReadString();
     }
     if (HasLastName)
     {
         LastName = from.ReadString();
     }
     if (HasUsername)
     {
         Username = from.ReadString();
     }
     if (HasPhone)
     {
         Phone = from.ReadString();
     }
     if (HasPhoto)
     {
         Photo = TLFactory.Read <TLUserProfilePhotoBase>(from);
     }
     if (HasStatus)
     {
         Status = TLFactory.Read <TLUserStatusBase>(from);
     }
     if (HasBotInfoVersion)
     {
         BotInfoVersion = from.ReadInt32();
     }
     if (HasRestrictionReason)
     {
         RestrictionReason = from.ReadString();
     }
     if (HasBotInlinePlaceholder)
     {
         BotInlinePlaceholder = from.ReadString();
     }
     if (HasLangCode)
     {
         LangCode = from.ReadString();
     }
 }
Exemple #13
0
 public override void Read(TLBinaryReader from)
 {
     Flags   = (Flag)from.ReadInt32();
     QueryId = from.ReadInt64();
     if (HasNextOffset)
     {
         NextOffset = from.ReadString();
     }
     if (HasSwitchPM)
     {
         SwitchPM = TLFactory.Read <TLInlineBotSwitchPM>(from);
     }
     Results   = TLFactory.Read <TLVector <TLBotInlineResultBase> >(from);
     CacheTime = from.ReadInt32();
 }
Exemple #14
0
 public override void Read(TLBinaryReader from)
 {
     Hash          = from.ReadInt64();
     Flags         = from.ReadInt32();
     DeviceModel   = from.ReadString();
     Platform      = from.ReadString();
     SystemVersion = from.ReadString();
     ApiId         = from.ReadInt32();
     AppName       = from.ReadString();
     AppVersion    = from.ReadString();
     DateCreated   = from.ReadInt32();
     DateActive    = from.ReadInt32();
     Ip            = from.ReadString();
     Country       = from.ReadString();
     Region        = from.ReadString();
 }
Exemple #15
0
 public override void Read(TLBinaryReader from)
 {
     Flags       = (Flag)from.ReadInt32();
     Title       = from.ReadString();
     Description = from.ReadString();
     if (HasPhoto)
     {
         Photo = TLFactory.Read <TLWebDocument>(from);
     }
     if (HasReceiptMsgId)
     {
         ReceiptMsgId = from.ReadInt32();
     }
     Currency    = from.ReadString();
     TotalAmount = from.ReadInt64();
     StartParam  = from.ReadString();
 }
Exemple #16
0
 public override void Read(TLBinaryReader from)
 {
     Flags = (Flag)from.ReadInt32();
     if (HasUrl)
     {
         Url = from.ReadString();
     }
     if (HasHtml)
     {
         Html = from.ReadString();
     }
     if (HasPosterPhotoId)
     {
         PosterPhotoId = from.ReadInt64();
     }
     W       = from.ReadInt32();
     H       = from.ReadInt32();
     Caption = TLFactory.Read <TLRichTextBase>(from);
 }
Exemple #17
0
 public override void Read(TLBinaryReader from)
 {
     Flags      = (Flag)from.ReadInt32();
     Date       = from.ReadInt32();
     BotId      = from.ReadInt32();
     Invoice    = TLFactory.Read <TLInvoice>(from);
     ProviderId = from.ReadInt32();
     if (HasInfo)
     {
         Info = TLFactory.Read <TLPaymentRequestedInfo>(from);
     }
     if (HasShipping)
     {
         Shipping = TLFactory.Read <TLShippingOption>(from);
     }
     Currency         = from.ReadString();
     TotalAmount      = from.ReadInt64();
     CredentialsTitle = from.ReadString();
     Users            = TLFactory.Read <TLVector <TLUserBase> >(from);
 }
Exemple #18
0
 public override void Read(TLBinaryReader from)
 {
     Flags = (Flag)from.ReadInt32();
     Id    = from.ReadInt32();
     if (HasAccessHash)
     {
         AccessHash = from.ReadInt64();
     }
     Title = from.ReadString();
     if (HasUsername)
     {
         Username = from.ReadString();
     }
     Photo   = TLFactory.Read <TLChatPhotoBase>(from);
     Date    = from.ReadInt32();
     Version = from.ReadInt32();
     if (HasRestrictionReason)
     {
         RestrictionReason = from.ReadString();
     }
 }
Exemple #19
0
        public void Read(TLBinaryReader from, byte[] authKey)
        {
            AuthKeyId = from.ReadInt64();
            MsgKey    = from.ReadBytes(16);

            var data1 = from.ReadBytes((int)from.BaseStream.Length - (int)from.BaseStream.Position);

            var decryptKeyIV = Utils.GetDecryptKeyIV(authKey, MsgKey);
            var data2        = Utils.AesIge(data1, decryptKeyIV.Item1, decryptKeyIV.Item2, false);

            using (var reader = new TLBinaryReader(data2))
            {
                Query = new TLTransportMessage();
                Query.Read(reader);
            }

            //from.ReadUInt64();
            //MsgId = from.ReadUInt64();

            //var length = from.ReadUInt32();
            //var innerType = (TLType)from.ReadUInt32();
            //Inner = TLFactory.Read<T>(from, innerType);
        }
Exemple #20
0
 public override void Read(TLBinaryReader from)
 {
     Id             = from.ReadInt64();
     Parts          = from.ReadInt32();
     KeyFingerprint = from.ReadInt32();
 }
Exemple #21
0
        public static T Read <T>(TLBinaryReader from)
        {
            if (typeof(T) == typeof(UInt32))
            {
                return((T)(Object)from.ReadUInt32());
            }
            else if (typeof(T) == typeof(Int32))
            {
                return((T)(Object)from.ReadInt32());
            }
            else if (typeof(T) == typeof(UInt64))
            {
                return((T)(Object)from.ReadUInt64());
            }
            else if (typeof(T) == typeof(Int64))
            {
                return((T)(Object)from.ReadInt64());
            }
            else if (typeof(T) == typeof(Double))
            {
                return((T)(Object)from.ReadDouble());
            }
            else if (typeof(T) == typeof(Boolean))
            {
                return((T)(Object)from.ReadBoolean());
            }
            else if (typeof(T) == typeof(String))
            {
                return((T)(Object)from.ReadString());
            }
            else if (typeof(T) == typeof(Byte[]))
            {
                return((T)(Object)from.ReadByteArray());
            }
            else if (typeof(T) == typeof(TLInt128))
            {
                return((T)(Object) new TLInt128(from));
            }
            else if (typeof(T) == typeof(TLInt256))
            {
                return((T)(Object) new TLInt256(from));
            }
            else if (typeof(T) == typeof(TLNonEncryptedTransportMessage))
            {
                return((T)(Object) new TLNonEncryptedTransportMessage(from));
            }

            var type = from.ReadUInt32();

            if (type == 0xFFFFFF0D || typeof(T) == typeof(TLActionInfo))
            {
                return((T)(Object) new TLActionInfo(from));
            }
            else if ((TLType)type == TLType.Vector)
            {
                if (typeof(T) != typeof(object) && typeof(T) != typeof(TLObject))
                {
                    return((T)(Object)Activator.CreateInstance(typeof(T), from));
                }
                else
                {
                    var length = from.ReadUInt32();
                    if (length > 0)
                    {
                        var inner = from.ReadUInt32();
                        from.BaseStream.Position -= 8;

                        var innerType = Type.GetType($"Telegram.Api.TL.TL{(TLType)inner}");
                        if (innerType != null)
                        {
                            var baseType = innerType.GetTypeInfo().BaseType;
                            if (baseType.Name != "TLObject")
                            {
                                innerType = baseType;
                            }

                            var d1       = typeof(TLVector <>);
                            var typeArgs = new Type[] { innerType };
                            var makeme   = d1.MakeGenericType(typeArgs);
                            return((T)(Object)Activator.CreateInstance(makeme, from));
                        }
                        else
                        {
                            // A base type collection (int, long, double, bool)
                            // TODO:
                            return((T)(Object)null);
                        }
                    }
                    else
                    {
                        // An empty collection, so we can't determine the generic type
                        // TODO:
                        return((T)(Object) new TLVectorEmpty());
                    }
                }
            }
            else if (type == 0x997275b5 || type == 0x3fedd339)
            {
                return((T)(Object)true);
            }
            else if (type == 0xbc799737)
            {
                return((T)(Object)false);
            }
            else
            {
                return(Read <T>(from, (TLType)type));
            }
        }
 public override void Read(TLBinaryReader from)
 {
     BadMsgId    = from.ReadInt64();
     BadMsgSeqno = from.ReadInt32();
     ErrorCode   = from.ReadInt32();
 }
Exemple #23
0
 public override void Read(TLBinaryReader from)
 {
     MsgId = from.ReadInt64();
     SeqNo = from.ReadInt32();
     Bytes = from.ReadInt32();
 }
Exemple #24
0
 public override void Read(TLBinaryReader from)
 {
     AnswerMsgId = from.ReadInt64();
     Bytes       = from.ReadInt32();
     Status      = from.ReadInt32();
 }
Exemple #25
0
 public override void Read(TLBinaryReader from)
 {
     Label  = from.ReadString();
     Amount = from.ReadInt64();
 }
Exemple #26
0
 public override void Read(TLBinaryReader from)
 {
     Url        = from.ReadString();
     AccessHash = from.ReadInt64();
 }
Exemple #27
0
 public override void Read(TLBinaryReader from)
 {
     Flags   = (Flag)from.ReadInt32();
     VideoId = from.ReadInt64();
     Caption = TLFactory.Read <TLRichTextBase>(from);
 }
Exemple #28
0
 public override void Read(TLBinaryReader from)
 {
     SessionId = from.ReadInt64();
 }
Exemple #29
0
 public override void Read(TLBinaryReader from)
 {
     Id         = from.ReadInt64();
     AccessHash = from.ReadInt64();
 }
Exemple #30
0
 public override void Read(TLBinaryReader from)
 {
     QueryId      = from.ReadInt64();
     ErrorCode    = from.ReadInt32();
     ErrorMessage = from.ReadString();
 }