forked from mirror/DotRecast
refactoring DtStatus 1st
This commit is contained in:
parent
a10dae89cd
commit
7bca7922eb
|
@ -18,6 +18,8 @@ freely, subject to the following restrictions:
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
namespace DotRecast.Detour
|
namespace DotRecast.Detour
|
||||||
{
|
{
|
||||||
public class DtStatus
|
public class DtStatus
|
||||||
|
@ -45,5 +47,29 @@ namespace DotRecast.Detour
|
||||||
{
|
{
|
||||||
Value = value;
|
Value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public bool IsSuccess()
|
||||||
|
{
|
||||||
|
return 0 != (Value & (DT_SUCCSESS.Value | DT_PARTIAL_RESULT.Value));
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public bool IsFailed()
|
||||||
|
{
|
||||||
|
return 0 != (Value & (DT_FAILURE.Value | DT_INVALID_PARAM.Value));
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public bool IsInProgress()
|
||||||
|
{
|
||||||
|
return 0 != (Value & DT_IN_PROGRESS.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public bool IsPartial()
|
||||||
|
{
|
||||||
|
return 0 != (Value & DT_PARTIAL_RESULT.Value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,25 +0,0 @@
|
||||||
namespace DotRecast.Detour
|
|
||||||
{
|
|
||||||
public static class DtStatusExtension
|
|
||||||
{
|
|
||||||
public static bool IsSuccess(this DtStatus @this)
|
|
||||||
{
|
|
||||||
return @this == DtStatus.DT_SUCCSESS || @this == DtStatus.DT_PARTIAL_RESULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool IsFailed(this DtStatus @this)
|
|
||||||
{
|
|
||||||
return @this == DtStatus.DT_FAILURE || @this == DtStatus.DT_INVALID_PARAM;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool IsInProgress(this DtStatus @this)
|
|
||||||
{
|
|
||||||
return @this == DtStatus.DT_IN_PROGRESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool IsPartial(this DtStatus @this)
|
|
||||||
{
|
|
||||||
return @this == DtStatus.DT_PARTIAL_RESULT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue