From ac12a0e32b7ab866ddf171203a6614b79ca90381 Mon Sep 17 00:00:00 2001 From: sta Date: Tue, 12 Feb 2019 21:53:03 +0900 Subject: [PATCH] [Modify] Add it --- websocket-sharp/Net/Cookie.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/websocket-sharp/Net/Cookie.cs b/websocket-sharp/Net/Cookie.cs index 3f613231..67a7d8e9 100644 --- a/websocket-sharp/Net/Cookie.cs +++ b/websocket-sharp/Net/Cookie.cs @@ -699,6 +699,29 @@ namespace WebSocketSharp.Net return buff.ToString (); } + private static bool tryCreatePorts (string value, out int[] result) + { + result = null; + + var ports = value.Trim ('"').Split (','); + var len = ports.Length; + var res = new int[len]; + + for (var i = 0; i < len; i++) { + var port = ports[i].Trim (); + if (port.Length == 0) { + res[i] = Int32.MinValue; + continue; + } + + if (!Int32.TryParse (port, out res[i])) + return false; + } + + result = res; + return true; + } + private static bool tryCreatePorts (string value, out int[] result, out string parseError) { var ports = value.Trim ('"').Split (',');