Exemplo n.º 1
0
 public override void Read(TLBinaryReader from)
 {
     ChatId  = from.ReadInt32();
     UserId  = from.ReadInt32();
     IsAdmin = from.ReadBoolean();
     Version = from.ReadInt32();
 }
Exemplo n.º 2
0
 public override void Read(TLBinaryReader from)
 {
     UserId   = from.ReadInt32();
     Date     = from.ReadInt32();
     Photo    = TLFactory.Read <TLUserProfilePhotoBase>(from);
     Previous = from.ReadBoolean();
 }
Exemplo n.º 3
0
 public override void Read(TLBinaryReader from)
 {
     Id       = from.ReadInt32();
     Critical = from.ReadBoolean();
     Url      = from.ReadString();
     Text     = from.ReadString();
 }
Exemplo n.º 4
0
 public override void Read(TLBinaryReader from)
 {
     CurrentSalt             = from.ReadByteArray();
     NewSalt                 = from.ReadByteArray();
     Hint                    = from.ReadString();
     HasRecovery             = from.ReadBoolean();
     EmailUnconfirmedPattern = from.ReadString();
 }
Exemplo n.º 5
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();
     StickersFavedLimit      = from.ReadInt32();
     ChannelsReadMediaPeriod = 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);
 }
Exemplo n.º 6
0
 public override void Read(TLBinaryReader from)
 {
     ChatId  = from.ReadInt32();
     Enabled = from.ReadBoolean();
     Version = from.ReadInt32();
 }
Exemplo n.º 7
0
 public override void Read(TLBinaryReader from)
 {
     NewValue = from.ReadBoolean();
 }
Exemplo n.º 8
0
 public override void Read(TLBinaryReader from)
 {
     UserId  = from.ReadInt32();
     Blocked = from.ReadBoolean();
 }
Exemplo n.º 9
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));
            }
        }
Exemplo n.º 10
0
 public override void Read(TLBinaryReader from)
 {
     PhoneRegistered = from.ReadBoolean();
 }
Exemplo n.º 11
0
 public override void Read(TLBinaryReader from)
 {
     Ordered = from.ReadBoolean();
     Items   = TLFactory.Read <TLVector <TLRichTextBase> >(from);
 }