internal bool TrySearchHttpListener(Uri uri, out WebSocketSharp.Net.HttpListener listener) { bool flag; listener = null; if (uri != null) { string host = uri.Host; bool flag1 = Uri.CheckHostName(host) == UriHostNameType.Dns; string str = uri.Port.ToString(); string str1 = HttpUtility.UrlDecode(uri.AbsolutePath); string str2 = (str1[str1.Length - 1] != '/' ? string.Concat(str1, "/") : str1); if ((host == null ? false : host.Length > 0)) { int num = -1; foreach (HttpListenerPrefix key in this._prefixes.Keys) { if (flag1) { string host1 = key.Host; if ((Uri.CheckHostName(host1) != UriHostNameType.Dns ? false : host1 != host)) { continue; } } if (key.Port == str) { string path = key.Path; int length = path.Length; if (length >= num) { if ((str1.StartsWith(path) ? true : str2.StartsWith(path))) { num = length; listener = this._prefixes[key]; } } } } if (num != -1) { flag = true; return(flag); } } List <HttpListenerPrefix> httpListenerPrefixes = this._unhandled; listener = EndPointListener.searchHttpListenerFromSpecial(str1, httpListenerPrefixes); if ((listener != null ? false : str2 != str1)) { listener = EndPointListener.searchHttpListenerFromSpecial(str2, httpListenerPrefixes); } if (listener == null) { httpListenerPrefixes = this._all; listener = EndPointListener.searchHttpListenerFromSpecial(str1, httpListenerPrefixes); if ((listener != null ? false : str2 != str1)) { listener = EndPointListener.searchHttpListenerFromSpecial(str2, httpListenerPrefixes); } flag = listener != null; } else { flag = true; } } else { flag = false; } return(flag); }