public async Task <bool> Execute() { try { var cacheFolder = Path.GetTempPath() + "/GlC"; if (!Directory.Exists(cacheFolder)) { Directory.CreateDirectory(cacheFolder); } var service = new GitHubService(_consoleService, _progressService); while (service.HasAnotherQuestion()) { _consoleService.WriteToConsole(service.AskQuestion()); service.AnswerToQuestion(_consoleService.GetNextInputFromConsole()); } while (true) { //download _consoleService.WriteToConsole("Choose your mode: type 'all' to download & count all your repositories, or type the full repo name to evaluate (for Example: dotnet/roslyn)"); var input = _consoleService.GetNextInputFromConsole(); if (input.Contains("/")) { var usr = input.Substring(0, input.IndexOf("/", StringComparison.Ordinal)); var repo = input.Substring(input.IndexOf("/", StringComparison.Ordinal) + 1); _consoleService.WriteToConsole("Working on " + usr + "/" + repo); await service.DownloadRepository(cacheFolder, usr, repo); } else if (input == "all") { _consoleService.WriteToConsole("Downloading all your repos"); await service.DownloadAllUserRepositores(cacheFolder); } else { _consoleService.WriteToConsole("Invalid input, try again ;)"); continue; } //extract var extractService = new ExtractService(); extractService.Execute(service.DownloadedRepositoresPaths); service.DownloadedRepositoresPaths.Clear(); //count var counterService = new CountService(_consoleService); var summary = counterService.Execute(extractService.FolderPaths); File.WriteAllText(cacheFolder + "/summary.txt", summary); extractService.FolderPaths.Clear(); } } catch (Exception ex) { _consoleService.WriteToConsole("Exception occred in Execute"); _consoleService.WriteToConsole(ex.ToString()); } return(false); }
public ClientsController(ClientService clientService, CreditService creditService, ExtractService extractService, IHttpContextAccessor httpContextAccessor) { _clientService = clientService; _creditService = creditService; _extractService = extractService; _httpContextAccessor = httpContextAccessor; userId = _httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; }
private async Task <string> ExtractAsync(string targetPath, string filePath, string dirPath, string tempPath, CancellationToken cancellationToken) { SetTitle(nameof(Resources.Download_Extracting_Text)); ViewModel.ProgressMaximum = 0; try { return(await Task.Run(() => ExtractService.Extract( path: targetPath, filePath: filePath, dirPath: dirPath, tempPath: tempPath, cancellationToken: cancellationToken), cancellationToken)); } catch (TaskCanceledException ex) { Logger.LogWarning(0, ex, "Canceled"); //cts = null; return(null); } }
private void Loading_Load(object sender, EventArgs e) { if (InstallPathExists() && !IsNewVersionAvailable()) { ExecuteApplication(); } else if (IsNewVersionAvailable()) { NotifyNewVersionIsAvailable(); } statusLabelMessage.Text = ""; fileDataReceivedLabel.Text = ""; var fileProcess = new FileProcess(); var botDirectories = new CreateBotDirectoriesCommand(); var downloadFactory = new DownloadFactory(_webClient, fileProcess); var downloadService = new DownloadService(downloadFactory); var extractFactory = new ExtractFactory(); var extractService = new ExtractService(extractFactory); var removeFactory = new RemoveFactory(); var removeService = new RemoveService(removeFactory); var tesseractDownload = downloadService.Create(FileType.Tesseract, _binDirectory); var clientDownload = downloadService.Create(FileType.Client, _installPath); var tesseractExtract = extractService.Create(FileType.Tesseract, _binDirectory); var clientExtract = extractService.Create(FileType.Client, _installPath); var tesseractRemove = removeService.Create(FileType.Tesseract, _binDirectory); var clientRemove = removeService.Create(FileType.Client, _installPath); _commandList.Add(botDirectories); _commandList.Add(tesseractDownload); _commandList.Add(clientDownload); _commandList.Add(tesseractExtract); _commandList.Add(clientExtract); _commandList.Add(tesseractRemove); _commandList.Add(clientRemove); Run(); }
public CatrobatProgramRepository(ExtractService extractService) { _extractService = extractService; }
public Task Hunt() => ExtractService.Hunt(Context);
public Task Timber() => ExtractService.Timber(Context);
public Task Harvest() => ExtractService.Harvest(Context);