Refactored a few for Ext.cs

This commit is contained in:
sta 2015-06-28 16:59:39 +09:00
parent 72b7cafe4f
commit 85dc704cc6

View File

@ -808,22 +808,24 @@ namespace WebSocketSharp
} }
/// <summary> /// <summary>
/// Tries to create a <see cref="Uri"/> for WebSocket with the specified /// Tries to create a <see cref="Uri"/> for WebSocket with
/// <paramref name="uriString"/>. /// the specified <paramref name="uriString"/>.
/// </summary> /// </summary>
/// <returns> /// <returns>
/// <c>true</c> if a <see cref="Uri"/> is successfully created; otherwise, <c>false</c>. /// <c>true</c> if a <see cref="Uri"/> is successfully created; otherwise, <c>false</c>.
/// </returns> /// </returns>
/// <param name="uriString"> /// <param name="uriString">
/// A <see cref="string"/> that represents the WebSocket URL to try. /// A <see cref="string"/> that represents a WebSocket URL to try.
/// </param> /// </param>
/// <param name="result"> /// <param name="result">
/// When this method returns, a <see cref="Uri"/> that represents the WebSocket URL /// When this method returns, a <see cref="Uri"/> that represents
/// if <paramref name="uriString"/> is valid; otherwise, <see langword="null"/>. /// a WebSocket URL if <paramref name="uriString"/> is valid;
/// otherwise, <see langword="null"/>.
/// </param> /// </param>
/// <param name="message"> /// <param name="message">
/// When this method returns, a <see cref="string"/> that represents the error message /// When this method returns, a <see cref="string"/> that represents
/// if <paramref name="uriString"/> is invalid; otherwise, <see cref="String.Empty"/>. /// an error message if <paramref name="uriString"/> is invalid;
/// otherwise, <see cref="String.Empty"/>.
/// </param> /// </param>
internal static bool TryCreateWebSocketUri ( internal static bool TryCreateWebSocketUri (
this string uriString, out Uri result, out string message) this string uriString, out Uri result, out string message)
@ -831,7 +833,7 @@ namespace WebSocketSharp
result = null; result = null;
var uri = uriString.ToUri (); var uri = uriString.ToUri ();
if (!uri.IsAbsoluteUri) { if (uri == null || !uri.IsAbsoluteUri) {
message = "Not an absolute URI: " + uriString; message = "Not an absolute URI: " + uriString;
return false; return false;
} }
@ -1719,11 +1721,11 @@ namespace WebSocketSharp
/// </param> /// </param>
public static Uri ToUri (this string uriString) public static Uri ToUri (this string uriString)
{ {
Uri res; Uri ret;
return Uri.TryCreate ( Uri.TryCreate (
uriString, uriString.MaybeUri () ? UriKind.Absolute : UriKind.Relative, out res) uriString, uriString.MaybeUri () ? UriKind.Absolute : UriKind.Relative, out ret);
? res
: null; return ret;
} }
/// <summary> /// <summary>