PkmnLibSharp/PkmnLibSharp/Utilities/ResultChecker.cs

23 lines
728 B
C#

using Arbutils.Generated;
namespace PkmnLibSharp.Utilities
{
internal static class ResultChecker
{
internal static void Assert(this byte result)
{
switch (result)
{
case 0: return;
case 1:
throw new NativeException("Arbutils", C.GetLastException().PtrString()!);
case 2:
throw new NativeException("CreatureLibLibrary",
Creaturelib.Generated.C.GetLastException().PtrString()!);
case 4:
throw new NativeException("PkmnLib",
Pkmnlib.Generated.C.GetLastException().PtrString()!);
}
}
}
}