PRoConEvents.MULTIbalancer.CheckSuccess C# (CSharp) Method

CheckSuccess() private method

private CheckSuccess ( Hashtable json, String &err ) : bool
json System.Collections.Hashtable
err String
return bool
        private bool CheckSuccess(Hashtable json, out String err)
        {
            if (json == null) {
            err = "JSON response is null!";
            return false;
            }

            if (!json.ContainsKey("type")) {
            err = "JSON response malformed: does not contain 'type'!";
            return false;
            }

            String type = (String)json["type"];

            if (type == null) {
            err = "JSON response malformed: 'type' is null!";
            return false;
            }

            if (Regex.Match(type, @"success", RegexOptions.IgnoreCase).Success) {
            err = null;
            return true;
            }

            if (!json.ContainsKey("message")) {
            err = "JSON response malformed: does not contain 'message'!";
            return false;
            }

            String message = (String)json["message"];

            if (message == null) {
            err = "JSON response malformed: 'message' is null!";
            return false;
            }

            err = "Cache fetch failed (type: " + type + ", message: " + message + ")!";
            return false;
        }
MULTIbalancer