// // /*=============================================================================== // // Copyright (C) 2025 PhantomsXR Ltd. All Rights Reserved. // // // // This file is part of the Phantom.XRMOD.UnityFusion.Runtime.CLRBingding.CLR.System. // // // // The XR-MOD cannot be copied, distributed, or made available to // // third-parties for commercial purposes without written permission of PhantomsXR Ltd. // // // // Contact nswell@phantomsxr.com for licensing requests. // // ===============================================================================*/ 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_Collections_Generic_CollectionExtensions_Binding { public static void Register(UnityFusion.Runtime.Enviorment.AppDomain app) { MethodBase method; Type[] args; Type type = typeof(System.Collections.Generic.CollectionExtensions); Dictionary> genericMethods = new Dictionary>(); List lst = null; foreach(var m in type.GetMethods()) { if(m.IsGenericMethodDefinition) { if (!genericMethods.TryGetValue(m.Name, out lst)) { lst = new List(); genericMethods[m.Name] = lst; } lst.Add(m); } } args = new Type[]{typeof(System.String), typeof(UnityFusion.Runtime.Intepreter.ILTypeInstance)}; if (genericMethods.TryGetValue("GetValueOrDefault", out lst)) { foreach(var m in lst) { if(m.MatchGenericParameters(args, typeof(UnityFusion.Runtime.Intepreter.ILTypeInstance), typeof(System.Collections.Generic.IReadOnlyDictionary), typeof(System.String))) { method = m.MakeGenericMethod(args); app.RegisterCLRMethodRedirection(method, GetValueOrDefault_0); break; } } } } static StackObject* GetValueOrDefault_0(ILIntepreter __intp, StackObject* __esp, AutoList __mStack, CLRMethod __method, bool isNewObj) { UnityFusion.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.String @key = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Collections.Generic.IReadOnlyDictionary @dictionary = (System.Collections.Generic.IReadOnlyDictionary)typeof(System.Collections.Generic.IReadOnlyDictionary).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0); __intp.Free(ptr_of_this_method); var result_of_this_method = System.Collections.Generic.CollectionExtensions.GetValueOrDefault(@dictionary, @key); return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } } }