Aurora.Addon.HyperGrid.UserAgentServiceConnector.GetBoolResponse C# (CSharp) Метод

GetBoolResponse() приватный Метод

private GetBoolResponse ( Nwc.XmlRpc.XmlRpcRequest request, string &reason ) : bool
request Nwc.XmlRpc.XmlRpcRequest
reason string
Результат bool
        private bool GetBoolResponse(XmlRpcRequest request, out string reason)
        {
            //MainConsole.Instance.Debug("[USER AGENT CONNECTOR]: GetBoolResponse from/to " + m_ServerURL);
            XmlRpcResponse response = null;
            try
            {
                response = request.Send (m_ServerURL, 10000);
            }
            catch (Exception e)
            {
                MainConsole.Instance.DebugFormat ("[USER AGENT CONNECTOR]: Unable to contact remote server {0}", m_ServerURL);
                reason = "Exception: " + e.Message;
                return false;
            }

            if (response.IsFault)
            {
                MainConsole.Instance.ErrorFormat ("[USER AGENT CONNECTOR]: remote call to {0} returned an error: {1}", m_ServerURL, response.FaultString);
                reason = "XMLRPC Fault";
                return false;
            }

            Hashtable hash = (Hashtable)response.Value;
            //foreach (Object o in hash)
            //    MainConsole.Instance.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
            try
            {
                if (hash == null)
                {
                    MainConsole.Instance.ErrorFormat ("[USER AGENT CONNECTOR]: Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
                    reason = "Internal error 1";
                    return false;
                }
                bool success = false;
                reason = string.Empty;
                if (hash.ContainsKey ("result"))
                    Boolean.TryParse ((string)hash["result"], out success);
                else
                {
                    reason = "Internal error 2";
                    MainConsole.Instance.WarnFormat ("[USER AGENT CONNECTOR]: response from {0} does not have expected key 'result'", m_ServerURL);
                }

                return success;
            }
            catch (Exception e)
            {
                MainConsole.Instance.ErrorFormat ("[USER AGENT CONNECTOR]: Got exception on GetBoolResponse response.");
                if (hash.ContainsKey ("result") && hash["result"] != null)
                    MainConsole.Instance.ErrorFormat ("Reply was ", (string)hash["result"]);
                reason = "Exception: " + e.Message;
                return false;
            }
        }