soundvision/UnityProject/Assets/ThridParty/KinectScript/NativeWrapper.cs
2019-07-06 14:50:40 +02:00

28 lines
No EOL
648 B
C#

using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Linq;
namespace Helper
{
public static class NativeWrapper
{
public static System.IntPtr GetNativePtr(Object obj)
{
if(obj == null)
{
return System.IntPtr.Zero;
}
var nativeWrapperIface = obj as INativeWrapper;
if(nativeWrapperIface != null)
{
return nativeWrapperIface.nativePtr;
}
else
{
throw new ArgumentException("Object must wrap native type");
}
}
}
}