Files

202 lines
5.0 KiB
C#

// <auto-generated/> 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 ConnectionResult: IDisposable
{
private unsafe Raw.ConnectionResult* _inner;
public DesktopSize DesktopSize
{
get
{
return GetDesktopSize();
}
}
public bool EnableServerPointer
{
get
{
return GetEnableServerPointer();
}
}
public ushort IoChannelId
{
get
{
return GetIoChannelId();
}
}
public bool PointerSoftwareRendering
{
get
{
return GetPointerSoftwareRendering();
}
}
public ushort UserChannelId
{
get
{
return GetUserChannelId();
}
}
/// <summary>
/// Creates a managed <c>ConnectionResult</c> from a raw handle.
/// </summary>
/// <remarks>
/// Safety: you should not build two managed objects using the same raw handle (may causes use-after-free and double-free).
/// <br/>
/// This constructor assumes the raw struct is allocated on Rust side.
/// If implemented, the custom Drop implementation on Rust side WILL run on destruction.
/// </remarks>
public unsafe ConnectionResult(Raw.ConnectionResult* handle)
{
_inner = handle;
}
/// <exception cref="IronRdpException"></exception>
public ushort GetIoChannelId()
{
unsafe
{
if (_inner == null)
{
throw new ObjectDisposedException("ConnectionResult");
}
Raw.ConnectorResultFfiResultU16BoxIronRdpError result = Raw.ConnectionResult.GetIoChannelId(_inner);
if (!result.isOk)
{
throw new IronRdpException(new IronRdpError(result.Err));
}
ushort retVal = result.Ok;
return retVal;
}
}
/// <exception cref="IronRdpException"></exception>
public ushort GetUserChannelId()
{
unsafe
{
if (_inner == null)
{
throw new ObjectDisposedException("ConnectionResult");
}
Raw.ConnectorResultFfiResultU16BoxIronRdpError result = Raw.ConnectionResult.GetUserChannelId(_inner);
if (!result.isOk)
{
throw new IronRdpException(new IronRdpError(result.Err));
}
ushort retVal = result.Ok;
return retVal;
}
}
/// <exception cref="IronRdpException"></exception>
/// <returns>
/// A <c>DesktopSize</c> allocated on Rust side.
/// </returns>
public DesktopSize GetDesktopSize()
{
unsafe
{
if (_inner == null)
{
throw new ObjectDisposedException("ConnectionResult");
}
Raw.ConnectorResultFfiResultBoxDesktopSizeBoxIronRdpError result = Raw.ConnectionResult.GetDesktopSize(_inner);
if (!result.isOk)
{
throw new IronRdpException(new IronRdpError(result.Err));
}
Raw.DesktopSize* retVal = result.Ok;
return new DesktopSize(retVal);
}
}
/// <exception cref="IronRdpException"></exception>
public bool GetEnableServerPointer()
{
unsafe
{
if (_inner == null)
{
throw new ObjectDisposedException("ConnectionResult");
}
Raw.ConnectorResultFfiResultBoolBoxIronRdpError result = Raw.ConnectionResult.GetEnableServerPointer(_inner);
if (!result.isOk)
{
throw new IronRdpException(new IronRdpError(result.Err));
}
bool retVal = result.Ok;
return retVal;
}
}
/// <exception cref="IronRdpException"></exception>
public bool GetPointerSoftwareRendering()
{
unsafe
{
if (_inner == null)
{
throw new ObjectDisposedException("ConnectionResult");
}
Raw.ConnectorResultFfiResultBoolBoxIronRdpError result = Raw.ConnectionResult.GetPointerSoftwareRendering(_inner);
if (!result.isOk)
{
throw new IronRdpException(new IronRdpError(result.Err));
}
bool retVal = result.Ok;
return retVal;
}
}
/// <summary>
/// Returns the underlying raw handle.
/// </summary>
public unsafe Raw.ConnectionResult* AsFFI()
{
return _inner;
}
/// <summary>
/// Destroys the underlying object immediately.
/// </summary>
public void Dispose()
{
unsafe
{
if (_inner == null)
{
return;
}
Raw.ConnectionResult.Destroy(_inner);
_inner = null;
GC.SuppressFinalize(this);
}
}
~ConnectionResult()
{
Dispose();
}
}