public override bool ValidateProperties(out string error) { if (SelectedTemplate is TemplateDescriptionViewModel) { if (!string.IsNullOrWhiteSpace(SolutionLocation) && !UPath.IsValid(SolutionLocation)) { error = "Invalid solution directory."; return(ArePropertiesValid = false); } if (!string.IsNullOrWhiteSpace(SolutionName) && (!UFile.IsValid(SolutionName) || SolutionName.Contains(UPath.DirectorySeparatorString) || SolutionName.Contains(UPath.DirectorySeparatorStringAlt))) { error = "Invalid solution name."; return(ArePropertiesValid = false); } } return(ArePropertiesValid = base.ValidateProperties(out error)); }
public override bool ValidateProperties(out string error) { if (SelectedTemplate is TemplateDescriptionViewModel) { if (!UPath.IsValid(Location)) { error = "Invalid output directory."; return(false); } if (!UFile.IsValid(Name) || Name.Contains(UPath.DirectorySeparatorString) || Name.Contains(UPath.DirectorySeparatorStringAlt)) { error = "Invalid name."; return(false); } var outputPath = UPath.Combine <UDirectory>(Location, Name); if (Directory.Exists(outputPath)) { error = "Cannot use the selected name because a folder with the same name already exists in the same location."; return(false); } } error = ""; return(true); }
protected virtual bool IsValidName(string value, out string error) { if (value == null) { throw new ArgumentNullException(nameof(value)); } if (value.Length > 240) { error = Tr._p("Message", "The name is too long."); return(false); } if (value.Contains(UPath.DirectorySeparatorChar) || value.Contains(UPath.DirectorySeparatorCharAlt) || !UPath.IsValid(value)) { error = Tr._p("Message", "The name contains invalid characters."); return(false); } if (string.IsNullOrEmpty(value)) { error = Tr._p("Message", "The name is empty."); return(false); } error = null; return(true); }