// by Diplomat #pragma warning disable 0105 using System; using System.Runtime.InteropServices; using Devolutions.IronRdp.Diplomat; #pragma warning restore 0105 namespace Devolutions.IronRdp; #nullable enable public partial class ClientConnectorState: IDisposable { private unsafe Raw.ClientConnectorState* _inner; public SecurityProtocol BasicSettingsExchangeSendInitialSelectedProtocol { get { return GetBasicSettingsExchangeSendInitialSelectedProtocol(); } } public ConnectInitial BasicSettingsExchangeWaitResponseConnectInitial { get { return GetBasicSettingsExchangeWaitResponseConnectInitial(); } } public ConnectionResult ConnectedResult { get { return GetConnectedResult(); } } public ConnectionActivationSequence ConnectionFinalizationResult { get { return GetConnectionFinalizationResult(); } } public SecurityProtocol ConnectionInitiationWaitConfirmRequestedProtocol { get { return GetConnectionInitiationWaitConfirmRequestedProtocol(); } } public SecurityProtocol CredsspSelectedProtocol { get { return GetCredsspSelectedProtocol(); } } public SecurityProtocol EnhancedSecurityUpgradeSelectedProtocol { get { return GetEnhancedSecurityUpgradeSelectedProtocol(); } } public ClientConnectorStateType EnumType { get { return GetEnumType(); } } /// /// Creates a managed ClientConnectorState from a raw handle. /// /// /// Safety: you should not build two managed objects using the same raw handle (may causes use-after-free and double-free). ///
/// This constructor assumes the raw struct is allocated on Rust side. /// If implemented, the custom Drop implementation on Rust side WILL run on destruction. ///
public unsafe ClientConnectorState(Raw.ClientConnectorState* handle) { _inner = handle; } /// /// /// A ClientConnectorStateType allocated on C# side. /// public ClientConnectorStateType GetEnumType() { unsafe { if (_inner == null) { throw new ObjectDisposedException("ClientConnectorState"); } Raw.ConnectorStateFfiResultClientConnectorStateTypeBoxIronRdpError result = Raw.ClientConnectorState.GetEnumType(_inner); if (!result.isOk) { throw new IronRdpException(new IronRdpError(result.Err)); } Raw.ClientConnectorStateType retVal = result.Ok; return (ClientConnectorStateType)retVal; } } /// /// /// A SecurityProtocol allocated on Rust side. /// public SecurityProtocol GetConnectionInitiationWaitConfirmRequestedProtocol() { unsafe { if (_inner == null) { throw new ObjectDisposedException("ClientConnectorState"); } Raw.ConnectorStateFfiResultBoxSecurityProtocolBoxIronRdpError result = Raw.ClientConnectorState.GetConnectionInitiationWaitConfirmRequestedProtocol(_inner); if (!result.isOk) { throw new IronRdpException(new IronRdpError(result.Err)); } Raw.SecurityProtocol* retVal = result.Ok; return new SecurityProtocol(retVal); } } /// /// /// A SecurityProtocol allocated on Rust side. /// public SecurityProtocol GetEnhancedSecurityUpgradeSelectedProtocol() { unsafe { if (_inner == null) { throw new ObjectDisposedException("ClientConnectorState"); } Raw.ConnectorStateFfiResultBoxSecurityProtocolBoxIronRdpError result = Raw.ClientConnectorState.GetEnhancedSecurityUpgradeSelectedProtocol(_inner); if (!result.isOk) { throw new IronRdpException(new IronRdpError(result.Err)); } Raw.SecurityProtocol* retVal = result.Ok; return new SecurityProtocol(retVal); } } /// /// /// A SecurityProtocol allocated on Rust side. /// public SecurityProtocol GetCredsspSelectedProtocol() { unsafe { if (_inner == null) { throw new ObjectDisposedException("ClientConnectorState"); } Raw.ConnectorStateFfiResultBoxSecurityProtocolBoxIronRdpError result = Raw.ClientConnectorState.GetCredsspSelectedProtocol(_inner); if (!result.isOk) { throw new IronRdpException(new IronRdpError(result.Err)); } Raw.SecurityProtocol* retVal = result.Ok; return new SecurityProtocol(retVal); } } /// /// /// A SecurityProtocol allocated on Rust side. /// public SecurityProtocol GetBasicSettingsExchangeSendInitialSelectedProtocol() { unsafe { if (_inner == null) { throw new ObjectDisposedException("ClientConnectorState"); } Raw.ConnectorStateFfiResultBoxSecurityProtocolBoxIronRdpError result = Raw.ClientConnectorState.GetBasicSettingsExchangeSendInitialSelectedProtocol(_inner); if (!result.isOk) { throw new IronRdpException(new IronRdpError(result.Err)); } Raw.SecurityProtocol* retVal = result.Ok; return new SecurityProtocol(retVal); } } /// /// /// A ConnectInitial allocated on Rust side. /// public ConnectInitial GetBasicSettingsExchangeWaitResponseConnectInitial() { unsafe { if (_inner == null) { throw new ObjectDisposedException("ClientConnectorState"); } Raw.ConnectorStateFfiResultBoxConnectInitialBoxIronRdpError result = Raw.ClientConnectorState.GetBasicSettingsExchangeWaitResponseConnectInitial(_inner); if (!result.isOk) { throw new IronRdpException(new IronRdpError(result.Err)); } Raw.ConnectInitial* retVal = result.Ok; return new ConnectInitial(retVal); } } /// /// /// A ConnectionResult allocated on Rust side. /// public ConnectionResult GetConnectedResult() { unsafe { if (_inner == null) { throw new ObjectDisposedException("ClientConnectorState"); } Raw.ConnectorStateFfiResultBoxConnectionResultBoxIronRdpError result = Raw.ClientConnectorState.GetConnectedResult(_inner); if (!result.isOk) { throw new IronRdpException(new IronRdpError(result.Err)); } Raw.ConnectionResult* retVal = result.Ok; return new ConnectionResult(retVal); } } /// /// /// A ConnectionActivationSequence allocated on Rust side. /// public ConnectionActivationSequence GetConnectionFinalizationResult() { unsafe { if (_inner == null) { throw new ObjectDisposedException("ClientConnectorState"); } Raw.ConnectorStateFfiResultBoxConnectionActivationSequenceBoxIronRdpError result = Raw.ClientConnectorState.GetConnectionFinalizationResult(_inner); if (!result.isOk) { throw new IronRdpException(new IronRdpError(result.Err)); } Raw.ConnectionActivationSequence* retVal = result.Ok; return new ConnectionActivationSequence(retVal); } } /// /// Returns the underlying raw handle. /// public unsafe Raw.ClientConnectorState* AsFFI() { return _inner; } /// /// Destroys the underlying object immediately. /// public void Dispose() { unsafe { if (_inner == null) { return; } Raw.ClientConnectorState.Destroy(_inner); _inner = null; GC.SuppressFinalize(this); } } ~ClientConnectorState() { Dispose(); } }