Universe.Framework.Servers.HttpServer.BaseHttpServer.TryGetPollServiceHTTPHandler C# (CSharp) Method

TryGetPollServiceHTTPHandler() private method

private TryGetPollServiceHTTPHandler ( string handlerKey, PollServiceEventArgs &oServiceEventArgs ) : bool
handlerKey string
oServiceEventArgs PollServiceEventArgs
return bool
        internal bool TryGetPollServiceHTTPHandler (string handlerKey, out PollServiceEventArgs oServiceEventArgs)
        {
            string bestMatch = null;

            lock (m_pollHandlers)
            {
                if (m_pollHandlers.TryGetValue (handlerKey, out oServiceEventArgs))
                    return true;
                foreach (string pattern in m_pollHandlers.Keys) {
                    if (handlerKey.StartsWith (pattern, StringComparison.Ordinal))
                    {
                        if (string.IsNullOrEmpty (bestMatch) || pattern.Length > bestMatch.Length)
                        {
                            bestMatch = pattern;
                        }
                    }
                }

                if (string.IsNullOrEmpty (bestMatch))
                {
                    oServiceEventArgs = null;
                    return false;
                }

                oServiceEventArgs = m_pollHandlers [bestMatch];
                return true;
            }
        }