|
| 1 | +// <auto-generated/> by Diplomat |
| 2 | + |
| 3 | +#pragma warning disable 0105 |
| 4 | +using System; |
| 5 | +using System.Runtime.InteropServices; |
| 6 | + |
| 7 | +using Devolutions.IronRdp.Diplomat; |
| 8 | +#pragma warning restore 0105 |
| 9 | + |
| 10 | +namespace Devolutions.IronRdp; |
| 11 | + |
| 12 | +#nullable enable |
| 13 | + |
| 14 | +public partial class DvcPipeProxyConfig: IDisposable |
| 15 | +{ |
| 16 | + private unsafe Raw.DvcPipeProxyConfig* _inner; |
| 17 | + |
| 18 | + public DvcPipeProxyMessageSink MessageSink |
| 19 | + { |
| 20 | + get |
| 21 | + { |
| 22 | + return GetMessageSink(); |
| 23 | + } |
| 24 | + } |
| 25 | + |
| 26 | + /// <summary> |
| 27 | + /// Creates a managed <c>DvcPipeProxyConfig</c> from a raw handle. |
| 28 | + /// </summary> |
| 29 | + /// <remarks> |
| 30 | + /// Safety: you should not build two managed objects using the same raw handle (may causes use-after-free and double-free). |
| 31 | + /// <br/> |
| 32 | + /// This constructor assumes the raw struct is allocated on Rust side. |
| 33 | + /// If implemented, the custom Drop implementation on Rust side WILL run on destruction. |
| 34 | + /// </remarks> |
| 35 | + public unsafe DvcPipeProxyConfig(Raw.DvcPipeProxyConfig* handle) |
| 36 | + { |
| 37 | + _inner = handle; |
| 38 | + } |
| 39 | + |
| 40 | + /// <returns> |
| 41 | + /// A <c>DvcPipeProxyConfig</c> allocated on Rust side. |
| 42 | + /// </returns> |
| 43 | + public static DvcPipeProxyConfig New(DvcPipeProxyMessageSink messageSink) |
| 44 | + { |
| 45 | + unsafe |
| 46 | + { |
| 47 | + Raw.DvcPipeProxyMessageSink* messageSinkRaw; |
| 48 | + messageSinkRaw = messageSink.AsFFI(); |
| 49 | + if (messageSinkRaw == null) |
| 50 | + { |
| 51 | + throw new ObjectDisposedException("DvcPipeProxyMessageSink"); |
| 52 | + } |
| 53 | + Raw.DvcPipeProxyConfig* retVal = Raw.DvcPipeProxyConfig.New(messageSinkRaw); |
| 54 | + return new DvcPipeProxyConfig(retVal); |
| 55 | + } |
| 56 | + } |
| 57 | + |
| 58 | + public void AddPipeProxy(DvcPipeProxyDescriptor descriptor) |
| 59 | + { |
| 60 | + unsafe |
| 61 | + { |
| 62 | + if (_inner == null) |
| 63 | + { |
| 64 | + throw new ObjectDisposedException("DvcPipeProxyConfig"); |
| 65 | + } |
| 66 | + Raw.DvcPipeProxyDescriptor* descriptorRaw; |
| 67 | + descriptorRaw = descriptor.AsFFI(); |
| 68 | + if (descriptorRaw == null) |
| 69 | + { |
| 70 | + throw new ObjectDisposedException("DvcPipeProxyDescriptor"); |
| 71 | + } |
| 72 | + Raw.DvcPipeProxyConfig.AddPipeProxy(_inner, descriptorRaw); |
| 73 | + } |
| 74 | + } |
| 75 | + |
| 76 | + /// <returns> |
| 77 | + /// A <c>DvcPipeProxyMessageSink</c> allocated on Rust side. |
| 78 | + /// </returns> |
| 79 | + public DvcPipeProxyMessageSink GetMessageSink() |
| 80 | + { |
| 81 | + unsafe |
| 82 | + { |
| 83 | + if (_inner == null) |
| 84 | + { |
| 85 | + throw new ObjectDisposedException("DvcPipeProxyConfig"); |
| 86 | + } |
| 87 | + Raw.DvcPipeProxyMessageSink* retVal = Raw.DvcPipeProxyConfig.GetMessageSink(_inner); |
| 88 | + return new DvcPipeProxyMessageSink(retVal); |
| 89 | + } |
| 90 | + } |
| 91 | + |
| 92 | + /// <summary> |
| 93 | + /// Returns the underlying raw handle. |
| 94 | + /// </summary> |
| 95 | + public unsafe Raw.DvcPipeProxyConfig* AsFFI() |
| 96 | + { |
| 97 | + return _inner; |
| 98 | + } |
| 99 | + |
| 100 | + /// <summary> |
| 101 | + /// Destroys the underlying object immediately. |
| 102 | + /// </summary> |
| 103 | + public void Dispose() |
| 104 | + { |
| 105 | + unsafe |
| 106 | + { |
| 107 | + if (_inner == null) |
| 108 | + { |
| 109 | + return; |
| 110 | + } |
| 111 | + |
| 112 | + Raw.DvcPipeProxyConfig.Destroy(_inner); |
| 113 | + _inner = null; |
| 114 | + |
| 115 | + GC.SuppressFinalize(this); |
| 116 | + } |
| 117 | + } |
| 118 | + |
| 119 | + ~DvcPipeProxyConfig() |
| 120 | + { |
| 121 | + Dispose(); |
| 122 | + } |
| 123 | +} |
0 commit comments