Пример #1
0
 public override void Read(TLBinaryReader from)
 {
     VolumeId = from.ReadInt64();
     LocalId  = from.ReadInt32();
     Secret   = from.ReadInt64();
 }
 public override void Read(TLBinaryReader from)
 {
     Offset = from.ReadInt32();
     Length = from.ReadInt32();
     UserId = TLFactory.Read <TLInputUserBase>(from);
 }
Пример #3
0
 public override void Read(TLBinaryReader from)
 {
     Id    = from.ReadInt32();
     Flags = from.ReadInt32();
 }
Пример #4
0
 public override void Read(TLBinaryReader from)
 {
     Offset   = from.ReadInt32();
     Length   = from.ReadInt32();
     Language = from.ReadString();
 }
Пример #5
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));
            }
        }
Пример #6
0
 public override void Read(TLBinaryReader from)
 {
     Url    = from.ReadString();
     ChatId = from.ReadInt32();
 }
Пример #7
0
 public override void Read(TLBinaryReader from)
 {
     Pts = from.ReadInt32();
 }
Пример #8
0
 public override void Read(TLBinaryReader from)
 {
     UserId    = from.ReadInt32();
     InviterId = from.ReadInt32();
     Date      = from.ReadInt32();
 }
Пример #9
0
 public override void Read(TLBinaryReader from)
 {
     ValidSince = from.ReadInt32();
     ValidUntil = from.ReadInt32();
     Salt       = from.ReadInt64();
 }
Пример #10
0
 public override void Read(TLBinaryReader from)
 {
     ChatId = from.ReadInt32();
     UserId = from.ReadInt32();
     Action = TLFactory.Read <TLSendMessageActionBase>(from);
 }
Пример #11
0
 public override void Read(TLBinaryReader from)
 {
     Author        = TLFactory.Read <TLRichTextBase>(from);
     PublishedDate = from.ReadInt32();
 }
Пример #12
0
 public override void Read(TLBinaryReader from)
 {
     GameId = from.ReadInt64();
     Score  = from.ReadInt32();
 }
Пример #13
0
 public override void Read(TLBinaryReader from)
 {
     GeoPoint = TLFactory.Read <TLInputGeoPointBase>(from);
     Period   = from.ReadInt32();
 }
Пример #14
0
 public override void Read(TLBinaryReader from)
 {
     Id         = from.ReadInt64();
     AccessHash = from.ReadInt64();
     Version    = from.ReadInt32();
 }
Пример #15
0
 public override void Read(TLBinaryReader from)
 {
     Messages = TLFactory.Read <TLVector <Int32> >(from);
     Pts      = from.ReadInt32();
     PtsCount = from.ReadInt32();
 }
Пример #16
0
 public override void Read(TLBinaryReader from)
 {
     ClientId  = from.ReadInt64();
     Importers = from.ReadInt32();
 }
Пример #17
0
 public override void Read(TLBinaryReader from)
 {
     Count  = from.ReadInt32();
     Photos = TLFactory.Read <TLVector <TLPhotoBase> >(from);
     Users  = TLFactory.Read <TLVector <TLUserBase> >(from);
 }
Пример #18
0
 public override void Read(TLBinaryReader from)
 {
     SendBefore = from.ReadInt32();
     Action     = TLFactory.Read <TLObject>(from);
 }
Пример #19
0
 public override void Read(TLBinaryReader from)
 {
     Flags                = (Flag)from.ReadInt32();
     Date                 = from.ReadInt32();
     Expires              = from.ReadInt32();
     TestMode             = from.ReadBoolean();
     ThisDC               = from.ReadInt32();
     DCOptions            = TLFactory.Read <TLVector <TLDCOption> >(from);
     ChatSizeMax          = from.ReadInt32();
     MegaGroupSizeMax     = from.ReadInt32();
     ForwardedCountMax    = from.ReadInt32();
     OnlineUpdatePeriodMs = from.ReadInt32();
     OfflineBlurTimeoutMs = from.ReadInt32();
     OfflineIdleTimeoutMs = from.ReadInt32();
     OnlineCloudTimeoutMs = from.ReadInt32();
     NotifyCloudDelayMs   = from.ReadInt32();
     NotifyDefaultDelayMs = from.ReadInt32();
     ChatBigSize          = from.ReadInt32();
     PushChatPeriodMs     = from.ReadInt32();
     PushChatLimit        = from.ReadInt32();
     SavedGifsLimit       = from.ReadInt32();
     EditTimeLimit        = from.ReadInt32();
     RatingEDecay         = from.ReadInt32();
     StickersRecentLimit  = from.ReadInt32();
     if (HasTmpSessions)
     {
         TmpSessions = from.ReadInt32();
     }
     PinnedDialogsCountMax = from.ReadInt32();
     CallReceiveTimeoutMs  = from.ReadInt32();
     CallRingTimeoutMs     = from.ReadInt32();
     CallConnectTimeoutMs  = from.ReadInt32();
     CallPacketTimeoutMs   = from.ReadInt32();
     MeUrlPrefix           = from.ReadString();
     if (HasSuggestedLangCode)
     {
         SuggestedLangCode = from.ReadString();
     }
     if (HasLangPackVersion)
     {
         LangPackVersion = from.ReadInt32();
     }
     DisabledFeatures = TLFactory.Read <TLVector <TLDisabledFeature> >(from);
 }
Пример #20
0
 public override void Read(TLBinaryReader from)
 {
     Flags = (Flag)from.ReadInt32();
     Data  = TLFactory.Read <TLDataJSON>(from);
 }
Пример #21
0
 public override void Read(TLBinaryReader from)
 {
     TmpPassword = from.ReadByteArray();
     ValidUntil  = from.ReadInt32();
 }
Пример #22
0
 public override void Read(TLBinaryReader from)
 {
     ChannelId  = from.ReadInt32();
     AccessHash = from.ReadInt64();
 }
Пример #23
0
 public override void Read(TLBinaryReader from)
 {
     ChannelId = from.ReadInt32();
     MaxId     = from.ReadInt32();
 }
Пример #24
0
 public override void Read(TLBinaryReader from)
 {
     UserId      = from.ReadInt32();
     MyLink      = TLFactory.Read <TLContactLinkBase>(from);
     ForeignLink = TLFactory.Read <TLContactLinkBase>(from);
 }
Пример #25
0
 public override void Read(TLBinaryReader from)
 {
     Flags = (Flag)from.ReadInt32();
 }
Пример #26
0
 public override void Read(TLBinaryReader from)
 {
     Id    = from.ReadInt64();
     Parts = from.ReadInt32();
     Name  = from.ReadString();
 }
Пример #27
0
 public override void Read(TLBinaryReader from)
 {
     UserId = from.ReadInt32();
     Status = TLFactory.Read <TLUserStatusBase>(from);
 }
Пример #28
0
 public override void Read(TLBinaryReader from)
 {
     Message  = TLFactory.Read <TLMessageBase>(from);
     Pts      = from.ReadInt32();
     PtsCount = from.ReadInt32();
 }
Пример #29
0
 public override void Read(TLBinaryReader from)
 {
     Id             = from.ReadInt64();
     Parts          = from.ReadInt32();
     KeyFingerprint = from.ReadInt32();
 }
Пример #30
0
 public override void Read(TLBinaryReader from)
 {
     Id       = from.ReadInt32();
     RandomId = from.ReadInt64();
 }