From 7e98434f6cb85a40384087eadc2ab4c962c3ade5 Mon Sep 17 00:00:00 2001 From: sta Date: Thu, 17 Nov 2016 17:29:47 +0900 Subject: [PATCH] [Modify] Add it --- websocket-sharp/Ext.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/websocket-sharp/Ext.cs b/websocket-sharp/Ext.cs index 86cadae1..9c9fdf8c 100644 --- a/websocket-sharp/Ext.cs +++ b/websocket-sharp/Ext.cs @@ -964,6 +964,20 @@ namespace WebSocketSharp return true; } + internal static bool TryGetUTF8EncodedBytes (this string s, out byte[] bytes) + { + bytes = null; + + try { + bytes = Encoding.UTF8.GetBytes (s); + } + catch { + return false; + } + + return true; + } + internal static bool TryOpenRead ( this FileInfo fileInfo, out FileStream fileStream )