protected virtual string ValidatePath(string label, string path, Action onError, bool pathIsRequired)
{
if (!pathIsRequired && string.IsNullOrWhiteSpace(path))
{
return string.Empty;
}
var errors = new List<IActionableErrorInfo>();
RuleSet fileActivityRuleSet = new RuleSet();
IsValidExpressionRule isValidExpressionRule = new IsValidExpressionRule(() => path, DataListSingleton.ActiveDataList.Resource.DataList);
fileActivityRuleSet.Add(isValidExpressionRule);
errors.AddRange(fileActivityRuleSet.ValidateRules(label, onError));
string pathValue;
path.TryParseVariables(out pathValue, onError, variableValue: ValidUriSchemes[0] + "://temp");
if (errors.Count == 0)
{
IsStringEmptyOrWhiteSpaceRule isStringEmptyOrWhiteSpaceRuleUserName = new IsStringEmptyOrWhiteSpaceRule(() => path)
{
LabelText = label,
DoError = onError
};
IsValidFileNameRule isValidFileNameRule = new IsValidFileNameRule(() => path)
{
LabelText = label,
DoError = onError
};
fileActivityRuleSet.Add(isStringEmptyOrWhiteSpaceRuleUserName);
fileActivityRuleSet.Add(isValidExpressionRule);
errors.AddRange(fileActivityRuleSet.ValidateRules(label, onError));
}
UpdateErrors(errors);
return pathValue;
}