+2009-01-28 Bill Holmes <billholmes54@gmail.com>
+
+ * Uri.cs (IsWellFormedUriString): Changing IsWellFormedUriString
+ to not throw an exception but return false instead.
+
+ Contributed under MIT/X11 license.
+
2009-15-01 Leeszek Ciesielski <skolima@gmail.com>
* Uri.cs: Use registered UriParser when a custom schema is passed
{
if (uriString == null)
return false;
- Uri uri = new Uri (uriString, uriKind);
- return uri.IsWellFormedOriginalString ();
+
+ if (uriKind != UriKind.RelativeOrAbsolute &&
+ uriKind != UriKind.Absolute &&
+ uriKind != UriKind.Relative) {
+ string msg = Locale.GetText ("Invalid UriKind value '{0}'.", uriKind);
+ throw new ArgumentException ("uriKind", msg);
+ }
+
+ Uri uri;
+ if (Uri.TryCreate (uriString, uriKind, out uri))
+ return uri.IsWellFormedOriginalString ();
+ return false;
}
public static bool TryCreate (string uriString, UriKind uriKind, out Uri result)