XDAFileWatcher.ServiceHost.SendResponseWithAttachment C# (CSharp) Méthode

SendResponseWithAttachment() protected méthode

Sends an actionable response to client with a formatted message and attachment.
protected SendResponseWithAttachment ( GSF.ServiceProcess.ClientRequestInfo requestInfo, bool success, object attachment, string status ) : void
requestInfo GSF.ServiceProcess.ClientRequestInfo instance containing the client request.
success bool Flag that determines if this response to client request was a success.
attachment object Attachment to send with response.
status string Formatted status message to send with response.
Résultat void
        protected virtual void SendResponseWithAttachment(ClientRequestInfo requestInfo, bool success, object attachment, string status, params object[] args)
        {
            try
            {
                // Send actionable response
                m_serviceHelper.SendActionableResponse(requestInfo, success, attachment, status, args);

                // Log details of client request as well as response
                if (m_serviceHelper.LogStatusUpdates && m_serviceHelper.StatusLog.IsOpen)
                {
                    string responseType = requestInfo.Request.Command + (success ? ":Success" : ":Failure");
                    string arguments = requestInfo.Request.Arguments.ToString();
                    string message = responseType + (string.IsNullOrWhiteSpace(arguments) ? "" : "(" + arguments + ")");

                    if (status != null)
                    {
                        if (args.Length == 0)
                            message += " - " + status;
                        else
                            message += " - " + string.Format(status, args);
                    }

                    m_serviceHelper.StatusLog.WriteTimestampedLine(message);
                }
            }
            catch (Exception ex)
            {
                string message = string.Format("Failed to send client response due to an exception: {0}", ex.Message);
                HandleException(new InvalidOperationException(message, ex));
            }
        }