[Modify] Add it
This commit is contained in:
parent
0a55e6859c
commit
cd6b510cbd
@ -964,6 +964,20 @@ namespace WebSocketSharp
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static bool TryGetUTF8DecodedString (this byte[] bytes, out string s)
|
||||||
|
{
|
||||||
|
s = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
s = Encoding.UTF8.GetString (bytes);
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
internal static bool TryGetUTF8EncodedBytes (this string s, out byte[] bytes)
|
internal static bool TryGetUTF8EncodedBytes (this string s, out byte[] bytes)
|
||||||
{
|
{
|
||||||
bytes = null;
|
bytes = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user