private static string ReplaceToken(Match match, IPropertyProvider propertyProvider, bool throwIfNotFound)
{
string propertyName = match.Groups["propertyName"].Value;
var value = propertyProvider.GetPropertyValue(propertyName);
if (value == null && throwIfNotFound)
{
throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, NuGetResources.TokenHasNoValue, propertyName));
}
return value;
}
}