GSF.ServiceProcess.ClientHelper.TryParseActionableResponse C# (CSharp) Метод

TryParseActionableResponse() публичный статический Метод

Attempts to parse an actionable response sent from the service.
public static TryParseActionableResponse ( ServiceResponse serviceResponse, string &sourceCommand, bool &responseSuccess ) : bool
serviceResponse ServiceResponse to test for actionable response.
sourceCommand string Command that invoked .
responseSuccess bool Boolean success state of .
Результат bool
        public static bool TryParseActionableResponse(ServiceResponse serviceResponse, out string sourceCommand, out bool responseSuccess)
        {
            bool parseSucceeded = false;

            sourceCommand = null;
            responseSuccess = false;

            try
            {
                string response = serviceResponse.Type;

                // Attempt to parse response message
                if (!string.IsNullOrWhiteSpace(response))
                {
                    // Response types are formatted as "Command:Success" or "Command:Failure"
                    string[] parts = response.Split(':');

                    if (parts.Length > 1)
                    {
                        sourceCommand = parts[0].Trim().ToTitleCase();
                        responseSuccess = (string.Compare(parts[1].Trim(), "Success", StringComparison.OrdinalIgnoreCase) == 0);
                        parseSucceeded = true;
                    }
                }
            }
            catch
            {
                parseSucceeded = false;
            }

            return parseSucceeded;
        }