- int wildcard = mask.LastIndexOf ("*");
- if (wildcard > 0) {
- // partial match with a wildcard at the end
- return (String.Compare (mask, 0, url, 0, wildcard, true, CultureInfo.InvariantCulture) == 0);
+ if (url == null)
+ throw new ArgumentNullException ("Url");
+ if (url == String.Empty)
+ throw new FormatException (Locale.GetText ("Invalid (empty) Url"));
+
+ int protocolPos = url.IndexOf (Uri.SchemeDelimiter); // '://'
+ if (protocolPos > 0) {
+ if (url.StartsWith ("file://")) {
+ // convert file url into uppercase
+ url = "file://" + url.Substring (7).ToUpperInvariant ();
+ } else {
+ // add a trailing slash if none (lonely one) is present
+ if (url.LastIndexOf ("/") == protocolPos + 2)
+ url += "/";
+ }
+ } else {
+ // add file scheme (default) and convert url to uppercase
+ url = "file://" + url.ToUpperInvariant ();