Exemplo n.º 1
0
        public async Task <MTProtoGateway> GetFileGateway(ulong salt)
        {
            await _lock.WaitAsync();

//            fileGateway = new MTProtoGateway(this, fileSession);
            try {
                if (fileGateway != null)
                {
                    return(fileGateway);
                }

                if (fileSession == null)
                {
                    fileSession = new TelegramFileSession(Helpers.GenerateRandomUlong(), 0);
                }

                fileGateway = new MTProtoGateway(this, fileSession, false, salt);
                await fileGateway.ConnectAsync();

                return(fileGateway);
            }
            finally {
                _lock.Release();
            }
        }
Exemplo n.º 2
0
        public async Task<MTProtoGateway> GetFileGateway(ulong salt) {
            await _lock.WaitAsync();
//            fileGateway = new MTProtoGateway(this, fileSession);
            try {
                if (fileGateway != null) {
                    return fileGateway;
                }

                if (fileSession == null) {
                    fileSession = new TelegramFileSession(Helpers.GenerateRandomUlong(), 0);
                }

                fileGateway = new MTProtoGateway(this, fileSession, false, salt);
                await fileGateway.ConnectAsync();

                return fileGateway;
            }
            finally {
                _lock.Release();
            }
        }