示例#1
0
        public async Task Sync(string folderPath)
        {
            const string folderName = "Google Drive Test";

            _localRootFolder = Path.Combine(folderPath, folderName);

            Directory.CreateDirectory(_localRootFolder);

            //TODO: Salvar informações e configurações do usuário
            //TODO: Obter estrutura de diretórios
            await _driveAppService.DownloadAndCreateFolders(_localRootFolder);

            Console.WriteLine("Download finalizado.");
            //await DownloadFiles();
        }
示例#2
0
        public Task StartAsync(CancellationToken cancellationToken)
        {
            _logger.LogDebug($"Starting with arguments: {string.Join(" ", Environment.GetCommandLineArgs())}");

            _appLifetime.ApplicationStarted.Register(() =>
            {
                Task.Run(async() =>
                {
                    try
                    {
                        var googleUserInfo = await _oAuthAppService.GetUserInfo();

                        Console.WriteLine("User credentials:");
                        Console.WriteLine($"\tId: {googleUserInfo.Id}");
                        Console.WriteLine($"\tEmail: {googleUserInfo.Email}");
                        Console.WriteLine($"\tName: {googleUserInfo.Name}");
                        Console.WriteLine($"\tETag: {googleUserInfo.ETag}");
                        Console.WriteLine($"\tGender: {googleUserInfo.Gender}");
                        Console.WriteLine($"\tPicture: {googleUserInfo.Picture}");

                        //await _googleScriptAppService.GetFoldersUnderRoot();
                        await _driveAppService.DownloadAndCreateFolders("MonoDrive Test");
                    }
                    catch (Exception ex)
                    {
                        _logger.LogError(ex, "Unhandled exception!");
                    }
                    finally
                    {
                        // Stop the application once the work is done
                        //_appLifetime.StopApplication();
                    }
                }, cancellationToken);
            });

            return(Task.CompletedTask);
        }
示例#3
0
 public async Task DownloadAndCreateFolders()
 {
     await _driveAppService.DownloadAndCreateFolders("MonoDrive Test");
 }