30 lines
1.0 KiB
C#
30 lines
1.0 KiB
C#
namespace HellionChat.Integrations;
|
|
|
|
internal enum HonorificStatusKind
|
|
{
|
|
NotInstalled,
|
|
Incompatible,
|
|
Detected,
|
|
}
|
|
|
|
internal static class HonorificStatus
|
|
{
|
|
// Mirrors the 1.5.6 three-state discriminator (1d3b429:About.cs:171/183/196):
|
|
// it keys on IsAvailable + the *nullability* of DetectedApiVersion, never a
|
|
// recomputed major check. IsAvailable already encodes the compatibility
|
|
// result HonorificService set during the initial pull. Null-safe: an
|
|
// (isAvailable=true, detectedApiVersion=null) state a test seam can produce
|
|
// resolves to NotInstalled rather than dereferencing null.
|
|
internal static HonorificStatusKind Resolve(
|
|
bool isAvailable,
|
|
(uint Major, uint Minor)? detectedApiVersion
|
|
)
|
|
{
|
|
if (isAvailable && detectedApiVersion is not null)
|
|
return HonorificStatusKind.Detected;
|
|
if (detectedApiVersion is not null)
|
|
return HonorificStatusKind.Incompatible;
|
|
return HonorificStatusKind.NotInstalled;
|
|
}
|
|
}
|