refactor(interop): NdiRuntimeProbe now matches by prefix to handle NDI runtime version strings
Some checks failed
CI / build-and-test (push) Failing after 24s
Some checks failed
CI / build-and-test (push) Failing after 24s
This commit is contained in:
parent
da5818b690
commit
af37b4d9e1
1 changed files with 7 additions and 6 deletions
|
|
@ -11,25 +11,26 @@ public abstract record NdiRuntimeProbeResult
|
|||
|
||||
/// <summary>
|
||||
/// Compares the installed NDI runtime version (read via <see cref="INdiInterop.GetRuntimeVersion"/>)
|
||||
/// against the version expected by the bundled SDK headers. Surfaces mismatches so the engine
|
||||
/// can raise <c>EngineAlert.NdiRuntimeMismatch</c>.
|
||||
/// against an expected prefix supplied at construction. Prefix matching is used because the NDI
|
||||
/// runtime reports a longer string (e.g. "NDI SDK for Windows v6.0.1.0") and we typically only
|
||||
/// care that the major SDK family is correct ("NDI SDK for Windows v6").
|
||||
/// </summary>
|
||||
public sealed class NdiRuntimeProbe
|
||||
{
|
||||
private readonly INdiInterop _interop;
|
||||
private readonly string _expectedVersion;
|
||||
private readonly string _expectedPrefix;
|
||||
|
||||
public NdiRuntimeProbe(INdiInterop interop, string expectedVersion)
|
||||
{
|
||||
_interop = interop;
|
||||
_expectedVersion = expectedVersion;
|
||||
_expectedPrefix = expectedVersion;
|
||||
}
|
||||
|
||||
public NdiRuntimeProbeResult Probe()
|
||||
{
|
||||
var detected = _interop.GetRuntimeVersion();
|
||||
return string.Equals(detected, _expectedVersion, StringComparison.Ordinal)
|
||||
return detected.StartsWith(_expectedPrefix, StringComparison.Ordinal)
|
||||
? new NdiRuntimeProbeResult.Match(detected)
|
||||
: new NdiRuntimeProbeResult.Mismatch(detected, _expectedVersion);
|
||||
: new NdiRuntimeProbeResult.Mismatch(detected, _expectedPrefix);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue