Exemplo n.º 1
0
        /// <summary>
        /// Deserilizes an MTProtoHelper object from a stream
        /// </summary>
        /// <param name="reader">The stream containing the raw MTProtoHelper data</param>
        public static MTProtoHelper Deserialize(BinaryReader reader)
        {
            ServerAuthentication AuthInfo = null;

            if (BoolUtil.Deserialize(reader))
            {
                byte[] AuthInfoKey = null;

                if (BoolUtil.Deserialize(reader))
                {
                    AuthInfoKey = BytesUtil.Deserialize(reader);
                }

                AuthInfo = new ServerAuthentication()
                {
                    AuthKey    = new AuthKey(AuthInfoKey),
                    TimeOffset = IntegerUtil.Deserialize(reader)
                };
            }

            return(new MTProtoHelper(AuthInfo));
        }
Exemplo n.º 2
0
 public MTProtoHelper(ServerAuthentication authinfo)
 {
     AuthInfo = authinfo ?? new ServerAuthentication();
     Reset();
 }