24 lines
554 B
C#
24 lines
554 B
C#
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Runtime.InteropServices;
|
||
|
|
||
|
namespace PkmnLibSharp.Utilities
|
||
|
{
|
||
|
internal static class MarshalHelper
|
||
|
{
|
||
|
internal static IntPtr ToPtr(this string s)
|
||
|
{
|
||
|
return Marshal.StringToHGlobalAuto(s);
|
||
|
}
|
||
|
|
||
|
internal static string PtrString(this IntPtr i)
|
||
|
{
|
||
|
return Marshal.PtrToStringAuto(i);
|
||
|
}
|
||
|
|
||
|
internal static IntPtr ArrayPtr(this Array a)
|
||
|
{
|
||
|
return Marshal.UnsafeAddrOfPinnedArrayElement(a, 0);
|
||
|
}
|
||
|
}
|
||
|
}
|