26 lines
718 B
C#
26 lines
718 B
C#
using MxGateway.Contracts.Proto;
|
|
|
|
namespace MxGateway.Client;
|
|
|
|
public static class MxStatusProxyExtensions
|
|
{
|
|
public static bool IsSuccess(this MxStatusProxy status)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(status);
|
|
|
|
return status.Success != 0
|
|
&& status.Category is MxStatusCategory.Ok;
|
|
}
|
|
|
|
public static string ToDiagnosticSummary(this MxStatusProxy status)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(status);
|
|
|
|
string diagnosticText = string.IsNullOrWhiteSpace(status.DiagnosticText)
|
|
? "no diagnostic text"
|
|
: status.DiagnosticText;
|
|
|
|
return $"{status.Category} by {status.DetectedBy}; detail={status.Detail}; {diagnosticText}";
|
|
}
|
|
}
|