[Modify] Move it

This commit is contained in:
sta 2017-12-27 14:43:09 +09:00
parent 65337146ec
commit 05e9629652
2 changed files with 17 additions and 19 deletions

View File

@ -918,6 +918,22 @@ namespace WebSocketSharp
return ret.Length > 0 ? ret : value[0].ToString (); return ret.Length > 0 ? ret : value[0].ToString ();
} }
internal static bool TryCreateVersion (
this string versionString, out Version result
)
{
result = null;
try {
result = new Version (versionString);
}
catch {
return false;
}
return true;
}
/// <summary> /// <summary>
/// Tries to create a new <see cref="Uri"/> for WebSocket with /// Tries to create a new <see cref="Uri"/> for WebSocket with
/// the specified <paramref name="uriString"/>. /// the specified <paramref name="uriString"/>.

View File

@ -460,24 +460,6 @@ namespace WebSocketSharp.Net
#endregion #endregion
#region Private Methods
private static bool tryCreateVersion (string version, out Version result)
{
result = null;
try {
result = new Version (version);
}
catch {
return false;
}
return true;
}
#endregion
#region Internal Methods #region Internal Methods
internal void AddHeader (string header) internal void AddHeader (string header)
@ -646,7 +628,7 @@ namespace WebSocketSharp.Net
} }
Version ver; Version ver;
if (!tryCreateVersion (rawVer.Substring (5), out ver)) { if (!rawVer.Substring (5).TryCreateVersion (out ver)) {
_context.ErrorMessage = "Invalid request line (version)"; _context.ErrorMessage = "Invalid request line (version)";
return; return;
} }