feat(worker): implement 6 MXAccess COM commands in executor
Wire up the previously-unimplemented Suspend, Activate, AuthenticateUser, ArchestrAUserToId, AddBufferedItem, and SetBufferedUpdateInterval command kinds in MxAccessCommandExecutor. These are real COM calls and run on the STA via the executor. - IMxAccessServer gains the 6 methods; MxAccessComServer routes them to the right interface version (Suspend/Activate -> ILMXProxyServer4 out MxStatus, AuthenticateUser -> base ILMXProxyServer, ArchestrAUserToId -> ILMXProxyServer2, AddBufferedItem/SetBufferedUpdateInterval -> ILMXProxyServer5). - Suspend/Activate surface the native MxStatus, converted to MxStatusProxy via the existing MxStatusProxyConverter. - AuthenticateUser hands the credential straight to MXAccess and never logs it; native HResult failures propagate via the dispatcher. - MxAccessSession gains matching pass-throughs; AddBufferedItem registers the item handle in the handle registry. - Unit tests (fake IMxAccessServer / fake COM object) cover each arm plus a password-non-leak assertion; existing IMxAccessServer fakes updated. No proto changes (all request/reply messages already exist).
This commit is contained in:
@@ -140,6 +140,89 @@ public sealed class MxAccessComServer : IMxAccessServer
|
||||
AsProxyServer4().AdviseSupervisory(serverHandle, itemHandle);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public object Suspend(
|
||||
int serverHandle,
|
||||
int itemHandle)
|
||||
{
|
||||
if (mxAccessComObject is IMxAccessServer typedFake)
|
||||
{
|
||||
return typedFake.Suspend(serverHandle, itemHandle);
|
||||
}
|
||||
|
||||
AsProxyServer4().Suspend(serverHandle, itemHandle, out MxStatus status);
|
||||
return status;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public object Activate(
|
||||
int serverHandle,
|
||||
int itemHandle)
|
||||
{
|
||||
if (mxAccessComObject is IMxAccessServer typedFake)
|
||||
{
|
||||
return typedFake.Activate(serverHandle, itemHandle);
|
||||
}
|
||||
|
||||
AsProxyServer4().Activate(serverHandle, itemHandle, out MxStatus status);
|
||||
return status;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public int AuthenticateUser(
|
||||
int serverHandle,
|
||||
string verifyUser,
|
||||
string verifyUserPassword)
|
||||
{
|
||||
if (mxAccessComObject is IMxAccessServer typedFake)
|
||||
{
|
||||
return typedFake.AuthenticateUser(serverHandle, verifyUser, verifyUserPassword);
|
||||
}
|
||||
|
||||
return AsProxyServer().AuthenticateUser(serverHandle, verifyUser, verifyUserPassword);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public int ArchestrAUserToId(
|
||||
int serverHandle,
|
||||
string userIdGuid)
|
||||
{
|
||||
if (mxAccessComObject is IMxAccessServer typedFake)
|
||||
{
|
||||
return typedFake.ArchestrAUserToId(serverHandle, userIdGuid);
|
||||
}
|
||||
|
||||
return AsProxyServer2().ArchestrAUserToId(serverHandle, userIdGuid);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public int AddBufferedItem(
|
||||
int serverHandle,
|
||||
string itemDefinition,
|
||||
string itemContext)
|
||||
{
|
||||
if (mxAccessComObject is IMxAccessServer typedFake)
|
||||
{
|
||||
return typedFake.AddBufferedItem(serverHandle, itemDefinition, itemContext);
|
||||
}
|
||||
|
||||
return AsProxyServer5().AddBufferedItem(serverHandle, itemDefinition, itemContext);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void SetBufferedUpdateInterval(
|
||||
int serverHandle,
|
||||
int updateIntervalMilliseconds)
|
||||
{
|
||||
if (mxAccessComObject is IMxAccessServer typedFake)
|
||||
{
|
||||
typedFake.SetBufferedUpdateInterval(serverHandle, updateIntervalMilliseconds);
|
||||
return;
|
||||
}
|
||||
|
||||
AsProxyServer5().SetBufferedUpdateInterval(serverHandle, updateIntervalMilliseconds);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Write(
|
||||
int serverHandle,
|
||||
@@ -216,6 +299,14 @@ public sealed class MxAccessComServer : IMxAccessServer
|
||||
+ $"{nameof(ILMXProxyServer)} or {nameof(IMxAccessServer)}.");
|
||||
}
|
||||
|
||||
private ILMXProxyServer2 AsProxyServer2()
|
||||
{
|
||||
return mxAccessComObject as ILMXProxyServer2
|
||||
?? throw new InvalidOperationException(
|
||||
$"MXAccess COM object of type '{mxAccessComObject.GetType().FullName}' does not implement "
|
||||
+ $"{nameof(ILMXProxyServer2)} or {nameof(IMxAccessServer)}.");
|
||||
}
|
||||
|
||||
private ILMXProxyServer3 AsProxyServer3()
|
||||
{
|
||||
return mxAccessComObject as ILMXProxyServer3
|
||||
@@ -231,4 +322,12 @@ public sealed class MxAccessComServer : IMxAccessServer
|
||||
$"MXAccess COM object of type '{mxAccessComObject.GetType().FullName}' does not implement "
|
||||
+ $"{nameof(ILMXProxyServer4)} or {nameof(IMxAccessServer)}.");
|
||||
}
|
||||
|
||||
private ILMXProxyServer5 AsProxyServer5()
|
||||
{
|
||||
return mxAccessComObject as ILMXProxyServer5
|
||||
?? throw new InvalidOperationException(
|
||||
$"MXAccess COM object of type '{mxAccessComObject.GetType().FullName}' does not implement "
|
||||
+ $"{nameof(ILMXProxyServer5)} or {nameof(IMxAccessServer)}.");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user