a1156960b9
Resolves 1113 documentation-completeness gaps flagged by CommentChecker (MissingReturns, MissingInheritDoc, InheritDocMisused, MissingDoc, MissingParam, RedundantInheritDoc) so the API surface is fully documented and the analyzer scan is clean. Doc comments only; no code changes.
33 lines
1.3 KiB
C#
33 lines
1.3 KiB
C#
using ZB.MOM.WW.MxGateway.Contracts.Proto;
|
|
|
|
namespace ZB.MOM.WW.MxGateway.Client;
|
|
|
|
/// <summary>Extension methods for MxStatusProxy values.</summary>
|
|
public static class MxStatusProxyExtensions
|
|
{
|
|
/// <summary>Returns whether the status indicates success (success flag set and category is Ok).</summary>
|
|
/// <param name="status">The status to check.</param>
|
|
/// <returns><c>true</c> if the status is successful; <c>false</c> otherwise.</returns>
|
|
public static bool IsSuccess(this MxStatusProxy status)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(status);
|
|
|
|
return status.Success != 0
|
|
&& status.Category is MxStatusCategory.Ok;
|
|
}
|
|
|
|
/// <summary>Returns a formatted summary of the status for diagnostic output.</summary>
|
|
/// <param name="status">The status to summarize.</param>
|
|
/// <returns>A human-readable string combining category, source, detail, and diagnostic text.</returns>
|
|
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}";
|
|
}
|
|
}
|