using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Runtime.InteropServices; using UnityFusion.CLR.TypeSystem; using UnityFusion.CLR.Method; using UnityFusion.Runtime.Enviorment; using UnityFusion.Runtime.Intepreter; using UnityFusion.Runtime.Stack; using UnityFusion.Reflection; using UnityFusion.CLR.Utils; #if DEBUG && !DISABLE_UNITYFUSION_DEBUG using AutoList = System.Collections.Generic.List; #else using AutoList = UnityFusion.Other.UncheckedList; #endif namespace UnityFusion.Runtime.Generated { unsafe class System_Byte_Binding { public static void Register(UnityFusion.Runtime.Enviorment.AppDomain app) { Type type = typeof(System.Byte); app.RegisterCLRCreateArrayInstance(type, s => new System.Byte[s]); } static System.Byte GetInstance(UnityFusion.Runtime.Enviorment.AppDomain __domain, StackObject* ptr_of_this_method, AutoList __mStack) { ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method); System.Byte instance_of_this_method; switch(ptr_of_this_method->ObjectType) { case ObjectTypes.FieldReference: { var instance_of_fieldReference = __mStack[ptr_of_this_method->Value]; if(instance_of_fieldReference is ILTypeInstance) { instance_of_this_method = (System.Byte)typeof(System.Byte).CheckCLRTypes(((ILTypeInstance)instance_of_fieldReference)[ptr_of_this_method->ValueLow]); } else { var t = __domain.GetType(instance_of_fieldReference.GetType()) as CLRType; instance_of_this_method = (System.Byte)t.GetFieldValue(ptr_of_this_method->ValueLow, instance_of_fieldReference); } } break; case ObjectTypes.StaticFieldReference: { var t = __domain.GetType(ptr_of_this_method->Value); if(t is ILType) { instance_of_this_method = (System.Byte)typeof(System.Byte).CheckCLRTypes(((ILType)t).StaticInstance[ptr_of_this_method->ValueLow]); } else { instance_of_this_method = (System.Byte)((CLRType)t).GetFieldValue(ptr_of_this_method->ValueLow, null); } } break; case ObjectTypes.ArrayReference: { var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as System.Byte[]; instance_of_this_method = instance_of_arrayReference[ptr_of_this_method->ValueLow]; } break; default: instance_of_this_method = (byte)ptr_of_this_method->Value; break; } return instance_of_this_method; } } }