예제 #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();
            }
        }
예제 #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();
            }
        }