ALMRestClient.ALMClient.FindCookie C# (CSharp) Method

FindCookie() private static method

Enumerates the client's cookie container looking for the cookie requested and calls the action when the cookie is found
private static FindCookie ( RestSharp client, string cookieName, Action foundCookie ) : bool
client RestSharp The client to be processed against
cookieName string The name of the cookie to locate
foundCookie Action The action to occur if the cookie is found
return bool
        private static bool FindCookie(RestSharp.IRestClient client, string cookieName, Action<Cookie> foundCookie)
        {
            bool result = false;

            if (client != null && client.CookieContainer != null || client.CookieContainer.GetCookies(client.BaseUrl).Count >= 0)
            {
                foreach (Cookie cookie in client.CookieContainer.GetCookies(client.BaseUrl))
                {
                    if (string.Equals(cookie.Name, cookieName) == true)
                    {
                        if (foundCookie != null)
                        {
                            foundCookie(cookie);
                        }

                        result = true;
                        break;
                    }
                }
            }

            return result;
        }