Add .editorconfig and apply formatting
This commit is contained in:
parent
d1f0b9fd91
commit
696955463f
32 changed files with 6831 additions and 6808 deletions
|
|
@ -30,41 +30,40 @@ using System;
|
|||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Raylib_cs.Tests
|
||||
namespace Raylib_cs.Tests;
|
||||
|
||||
public static class BlittableHelper
|
||||
{
|
||||
public static class BlittableHelper
|
||||
public static bool IsBlittable<T>()
|
||||
{
|
||||
public static bool IsBlittable<T>()
|
||||
{
|
||||
return IsBlittableCache<T>.VALUE;
|
||||
}
|
||||
return IsBlittableCache<T>.VALUE;
|
||||
}
|
||||
|
||||
public static bool IsBlittable(this Type type)
|
||||
public static bool IsBlittable(this Type type)
|
||||
{
|
||||
if (type == typeof(decimal))
|
||||
{
|
||||
if (type == typeof(decimal))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (type.IsArray)
|
||||
{
|
||||
var elementType = type.GetElementType();
|
||||
return elementType != null && elementType.IsValueType && IsBlittable(elementType);
|
||||
}
|
||||
try
|
||||
{
|
||||
var instance = FormatterServices.GetUninitializedObject(type);
|
||||
GCHandle.Alloc(instance, GCHandleType.Pinned).Free();
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static class IsBlittableCache<T>
|
||||
if (type.IsArray)
|
||||
{
|
||||
public static readonly bool VALUE = IsBlittable(typeof(T));
|
||||
var elementType = type.GetElementType();
|
||||
return elementType != null && elementType.IsValueType && IsBlittable(elementType);
|
||||
}
|
||||
try
|
||||
{
|
||||
var instance = FormatterServices.GetUninitializedObject(type);
|
||||
GCHandle.Alloc(instance, GCHandleType.Pinned).Free();
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static class IsBlittableCache<T>
|
||||
{
|
||||
public static readonly bool VALUE = IsBlittable(typeof(T));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue