public override UpdaterResult Update(InputFileInfo?origValue, out InputFileInfo?newValue) { newValue = origValue ?? new InputFileInfo(); if (!string.IsNullOrEmpty(origValue?.GetPath()) && File.Exists(origValue?.GetPath())) { return(UpdaterResult.OriginalOkay); } Console.WriteLine(); var filePath = Prompters.GetSingleValue(origValue?.GetPath() ?? "**undefined**", string.Empty, "full path to input file "); if (string.IsNullOrEmpty(filePath)) { return(UpdaterResult.InvalidUserInput); } newValue.FilePath = filePath; if (newValue.Type != ImportType.Unknown) { return(UpdaterResult.Changed); } newValue.FilePath = string.Empty; return(UpdaterResult.InvalidUserInput); }
public override UpdaterResult Update(string?origValue, out string?newValue) { newValue = origValue; if (!string.IsNullOrEmpty(origValue)) { return(UpdaterResult.OriginalOkay); } Console.WriteLine(); newValue = Prompters.GetSingleValue(origValue ?? "**undefined**", "APIKey"); return(UpdaterResult.Changed); }
public override UpdaterResult Update(ProcessorType origValue, out ProcessorType newValue) { newValue = origValue; if (origValue != ProcessorType.None) { return(UpdaterResult.OriginalOkay); } Console.WriteLine(); Colors.WriteLine("\nProcessorType".Yellow(), " is undefined\n"); newValue = Prompters.GetEnum( origValue, ProcessorType.Google, Enum.GetValues <ProcessorType>() .Where(x => x.SnapsToRoute()) .ToList()); return(UpdaterResult.Changed); }
public async Task StartAsync(CancellationToken cancellationToken) { if (!_config.IsValid(_logger)) { _lifetime.StopApplication(); return; } if (!_config.StoreAPIKey) { _lifetime.StopApplication(); return; } var secureProcessors = _config.Processors ?.Where(p => p.Key.RequiresAPIKey()) .Select(p => p.Key) .ToList() ?? new List <ProcessorType>(); if (!secureProcessors.Any()) { _logger?.Error("No processors are defined"); _lifetime.StopApplication(); return; } Colors.WriteLine("Select the ", "processor ".Yellow(), " whose API key you want to encrypt and store:\n"); var procType = Prompters.GetEnum(_config.ProcessorType, _config.ProcessorType switch { ProcessorType.Distance => ProcessorType.Google, ProcessorType.None => ProcessorType.Google, _ => _config.ProcessorType },