36 lines
886 B
C#
36 lines
886 B
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using JetBrains.Annotations;
|
|
|
|
namespace Foodsoft.Alpm.Marshalling
|
|
{
|
|
internal readonly struct UTF8Return : ICustomMarshaler
|
|
{
|
|
private static readonly UTF8Return _instance = default;
|
|
|
|
[UsedImplicitly]
|
|
private static ICustomMarshaler GetInstance(string cookie)
|
|
{
|
|
return _instance;
|
|
}
|
|
|
|
public void CleanUpManagedData(object managedObj) { }
|
|
|
|
public void CleanUpNativeData(IntPtr pNativeData) { }
|
|
|
|
public int GetNativeDataSize()
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
public object MarshalNativeToManaged(IntPtr pNativeData)
|
|
{
|
|
return Marshal.PtrToStringUTF8(pNativeData)!;
|
|
}
|
|
|
|
public IntPtr MarshalManagedToNative(object managedObj)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
} |