39 lines
1.5 KiB
C#
39 lines
1.5 KiB
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()!, null);
|
|
case 2:
|
|
{
|
|
var message = Creaturelib.Generated.C.GetLastException().PtrString()!;
|
|
var stack = Creaturelib.Generated.C.GetLastExceptionStacktrace().PtrString();
|
|
throw new NativeException("CreatureLibLibrary", message, stack);
|
|
}
|
|
case 4:
|
|
{
|
|
var message = Pkmnlib.Generated.C.GetLastException().PtrString()!;
|
|
var stack = Pkmnlib.Generated.C.GetLastExceptionStacktrace().PtrString();
|
|
throw new NativeException("PkmnLib", message, stack);
|
|
}
|
|
case 5:
|
|
{
|
|
var message = PkmnLibAI.Generated.C.GetLastException().PtrString()!;
|
|
var stack = PkmnLibAI.Generated.C.GetLastExceptionStacktrace().PtrString();
|
|
throw new NativeException("PkmnLibAI", message, stack);
|
|
}
|
|
default:
|
|
{
|
|
throw new NativeException("Undefined", "", "");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |