mirror of
https://github.com/netbirdio/IronRDP.git
synced 2026-05-22 18:43:12 -07:00
152 lines
4.2 KiB
C#
152 lines
4.2 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 WinCliprdr: IDisposable
|
|
{
|
|
private unsafe Raw.WinCliprdr* _inner;
|
|
|
|
/// <summary>
|
|
/// Creates a managed <c>WinCliprdr</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 WinCliprdr(Raw.WinCliprdr* handle)
|
|
{
|
|
_inner = handle;
|
|
}
|
|
|
|
/// <exception cref="IronRdpException"></exception>
|
|
/// <returns>
|
|
/// A <c>WinCliprdr</c> allocated on Rust side.
|
|
/// </returns>
|
|
public static WinCliprdr New()
|
|
{
|
|
unsafe
|
|
{
|
|
Raw.ClipboardWindowsFfiResultBoxWinCliprdrBoxIronRdpError result = Raw.WinCliprdr.New();
|
|
if (!result.isOk)
|
|
{
|
|
throw new IronRdpException(new IronRdpError(result.Err));
|
|
}
|
|
Raw.WinCliprdr* retVal = result.Ok;
|
|
return new WinCliprdr(retVal);
|
|
}
|
|
}
|
|
|
|
/// <exception cref="IronRdpException"></exception>
|
|
/// <returns>
|
|
/// A <c>ClipboardMessage</c> allocated on Rust side.
|
|
/// </returns>
|
|
public ClipboardMessage NextClipboardMessage()
|
|
{
|
|
unsafe
|
|
{
|
|
if (_inner == null)
|
|
{
|
|
throw new ObjectDisposedException("WinCliprdr");
|
|
}
|
|
Raw.ClipboardWindowsFfiResultOptBoxClipboardMessageBoxIronRdpError result = Raw.WinCliprdr.NextClipboardMessage(_inner);
|
|
if (!result.isOk)
|
|
{
|
|
throw new IronRdpException(new IronRdpError(result.Err));
|
|
}
|
|
Raw.ClipboardMessage* retVal = result.Ok;
|
|
if (retVal == null)
|
|
{
|
|
return null;
|
|
}
|
|
return new ClipboardMessage(retVal);
|
|
}
|
|
}
|
|
|
|
/// <exception cref="IronRdpException"></exception>
|
|
/// <returns>
|
|
/// A <c>ClipboardMessage</c> allocated on Rust side.
|
|
/// </returns>
|
|
public ClipboardMessage NextClipboardMessageBlocking()
|
|
{
|
|
unsafe
|
|
{
|
|
if (_inner == null)
|
|
{
|
|
throw new ObjectDisposedException("WinCliprdr");
|
|
}
|
|
Raw.ClipboardWindowsFfiResultBoxClipboardMessageBoxIronRdpError result = Raw.WinCliprdr.NextClipboardMessageBlocking(_inner);
|
|
if (!result.isOk)
|
|
{
|
|
throw new IronRdpException(new IronRdpError(result.Err));
|
|
}
|
|
Raw.ClipboardMessage* retVal = result.Ok;
|
|
return new ClipboardMessage(retVal);
|
|
}
|
|
}
|
|
|
|
/// <exception cref="IronRdpException"></exception>
|
|
/// <returns>
|
|
/// A <c>CliprdrBackendFactory</c> allocated on Rust side.
|
|
/// </returns>
|
|
public CliprdrBackendFactory BackendFactory()
|
|
{
|
|
unsafe
|
|
{
|
|
if (_inner == null)
|
|
{
|
|
throw new ObjectDisposedException("WinCliprdr");
|
|
}
|
|
Raw.ClipboardWindowsFfiResultBoxCliprdrBackendFactoryBoxIronRdpError result = Raw.WinCliprdr.BackendFactory(_inner);
|
|
if (!result.isOk)
|
|
{
|
|
throw new IronRdpException(new IronRdpError(result.Err));
|
|
}
|
|
Raw.CliprdrBackendFactory* retVal = result.Ok;
|
|
return new CliprdrBackendFactory(retVal);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns the underlying raw handle.
|
|
/// </summary>
|
|
public unsafe Raw.WinCliprdr* AsFFI()
|
|
{
|
|
return _inner;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Destroys the underlying object immediately.
|
|
/// </summary>
|
|
public void Dispose()
|
|
{
|
|
unsafe
|
|
{
|
|
if (_inner == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
Raw.WinCliprdr.Destroy(_inner);
|
|
_inner = null;
|
|
|
|
GC.SuppressFinalize(this);
|
|
}
|
|
}
|
|
|
|
~WinCliprdr()
|
|
{
|
|
Dispose();
|
|
}
|
|
}
|