Exemplo n.º 1
0
        private async Task <object> ProcessContainer(IMTSession session, InnerMessage message, CancellationToken cancellationToken)
        {
            var result = await Task.FromResult <object>(null);

            using (var stream = new MemoryStream(message.Content))
                using (var reader = new BinaryReader(stream))
                {
                    this.logger.LogInformation("Container...");
                    var type  = reader.ReadUInt32();
                    var count = reader.ReadInt32();
                    for (var i = 0; i < count; i++)
                    {
                        var _message_id = reader.ReadUInt64();
                        var _seq_no     = reader.ReadInt32();
                        var _len        = reader.ReadInt32();
                        var _content    = reader.ReadBytes(_len);
                        var _resp       = await this.ProcessProtoMessage(session, message.DoClone(_content, m =>
                        {
                            m.msg_id = _message_id;
                            m.seq_no = _seq_no;
                        }), cancellationToken);
                    }
                }
            return(result);
        }
Exemplo n.º 2
0
        private async Task <object> ProcessInvokeAftert(IMTSession session, InnerMessage message, CancellationToken cancellationToken)
        {
            var result = await Task.FromResult <object>(null);

            var _req = session.Services.Serialization().Deserialize(message.Content) as TLInvokeAfterMsg;

            if (_req != null)
            {
                await ProcessProtoMessage(session, message.DoClone(_req.Query.ToByteArray(), cfg =>
                {
                }), cancellationToken);
            }
            return(result);
        }
Exemplo n.º 3
0
        private async Task <object> ProcessInitInvokeWithLayer(IMTSession session, InnerMessage message, CancellationToken cancellationToken)
        {
            var result = await Task.FromResult <object>(null);

            using (var stream = new MemoryStream(message.Content))
                using (var reader = new BinaryReader(stream))
                {
                    var type          = reader.ReadUInt32();
                    var layer         = reader.ReadInt32();
                    var inner_message = reader.ReadAllBytes();
                    this.logger.LogInformation("WithLayer...");
                    result = await this.ProcessProtoMessage(session, message.DoClone(inner_message), cancellationToken);
                }

            return(result);
        }
Exemplo n.º 4
0
        private async Task <object> ProcessInitConnection(IMTSession session, InnerMessage message, CancellationToken cancellationToken)
        {
            var result = await Task.FromResult <object>(null);

            using (var stream = new MemoryStream(message.Content))
                using (var reader = new BinaryReader(stream))
                {
                    var type                 = reader.ReadUInt32();
                    var appId                = reader.ReadUInt32();
                    var device_info          = StringSerializer.Deserialize(reader);
                    var os_info              = StringSerializer.Deserialize(reader);
                    var app_version          = StringSerializer.Deserialize(reader);
                    var system_language      = StringSerializer.Deserialize(reader);
                    var system_language_pack = StringSerializer.Deserialize(reader);
                    var lang_code            = StringSerializer.Deserialize(reader);
                    var remain               = reader.ReadAllBytes();
                    this.logger.LogInformation("Init...");
                    result = await this.ProcessProtoMessage(session, message.DoClone(remain), cancellationToken);
                }
            return(result);
        }