Files

109 lines
2.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 PduInfo: IDisposable
{
private unsafe Raw.PduInfo* _inner;
public Action Action
{
get
{
return GetAction();
}
}
public nuint Length
{
get
{
return GetLength();
}
}
/// <summary>
/// Creates a managed <c>PduInfo</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 PduInfo(Raw.PduInfo* handle)
{
_inner = handle;
}
/// <returns>
/// A <c>Action</c> allocated on Rust side.
/// </returns>
public Action GetAction()
{
unsafe
{
if (_inner == null)
{
throw new ObjectDisposedException("PduInfo");
}
Raw.Action* retVal = Raw.PduInfo.GetAction(_inner);
return new Action(retVal);
}
}
public nuint GetLength()
{
unsafe
{
if (_inner == null)
{
throw new ObjectDisposedException("PduInfo");
}
nuint retVal = Raw.PduInfo.GetLength(_inner);
return retVal;
}
}
/// <summary>
/// Returns the underlying raw handle.
/// </summary>
public unsafe Raw.PduInfo* AsFFI()
{
return _inner;
}
/// <summary>
/// Destroys the underlying object immediately.
/// </summary>
public void Dispose()
{
unsafe
{
if (_inner == null)
{
return;
}
Raw.PduInfo.Destroy(_inner);
_inner = null;
GC.SuppressFinalize(this);
}
}
~PduInfo()
{
Dispose();
}
}