public override ValidationResult Validate(object value, CultureInfo cultureInfo) { if (!(value is string path)) { return(new ValidationResult(false, $"Value '{value}' is not a string")); } if (!Path_.PathExists(path)) { return(new ValidationResult(false, $"Path '{path}' does not exist")); } return(ValidationResult.ValidResult); }
/// <summary></summary> public override async Task StartAsync(CancellationToken cancellationToken) { // If the user profile doesn't exist, stop if (!(WinOS.UserProfilePath(AppSettings.Value.UserProfile) is string profile_path)) { throw new Exception($"UserProfile '{AppSettings.Value.UserProfile}' does not have a home directory"); } // Output directory not found? stop OutputDirectory = Path.Combine(profile_path, "Documents", "Rylogic", "SolarHotWater"); if (!Path_.PathExists(OutputDirectory)) { throw new Exception($"Output directory path '{OutputDirectory}' does not exist"); } await base.StartAsync(cancellationToken); }