UnityEditor.MonoAOTRegistration.ExtractNativeMethodsFromTypes C# (CSharp) Method

ExtractNativeMethodsFromTypes() private static method

private static ExtractNativeMethodsFromTypes ( ICollection types, ArrayList res ) : void
types ICollection
res System.Collections.ArrayList
return void
        private static void ExtractNativeMethodsFromTypes(ICollection<TypeDefinition> types, ArrayList res)
        {
            foreach (TypeDefinition definition in types)
            {
                foreach (MethodDefinition definition2 in definition.Methods)
                {
                    if ((definition2.IsStatic && definition2.IsPInvokeImpl) && definition2.PInvokeInfo.Module.Name.Equals("__Internal"))
                    {
                        if (res.Contains(definition2.Name))
                        {
                            throw new SystemException("Duplicate native method found : " + definition2.Name + ". Please check your source carefully.");
                        }
                        res.Add(definition2.Name);
                    }
                }
                if (definition.HasNestedTypes)
                {
                    ExtractNativeMethodsFromTypes(definition.NestedTypes, res);
                }
            }
        }

Usage Example

 private static void ExtractNativeMethodsFromTypes(ICollection <TypeDefinition> types, ArrayList res)
 {
     using (IEnumerator <TypeDefinition> enumerator1 = ((IEnumerable <TypeDefinition>)types).GetEnumerator())
     {
         while (((IEnumerator)enumerator1).MoveNext())
         {
             TypeDefinition current1 = enumerator1.Current;
             using (Collection <MethodDefinition> .Enumerator enumerator2 = current1.get_Methods().GetEnumerator())
             {
                 // ISSUE: explicit reference operation
                 while (((Collection <MethodDefinition> .Enumerator)@enumerator2).MoveNext())
                 {
                     // ISSUE: explicit reference operation
                     MethodDefinition current2 = ((Collection <MethodDefinition> .Enumerator)@enumerator2).get_Current();
                     if (current2.get_IsStatic() && current2.get_IsPInvokeImpl() && current2.get_PInvokeInfo().get_Module().get_Name().Equals("__Internal"))
                     {
                         if (res.Contains((object)((MemberReference)current2).get_Name()))
                         {
                             throw new SystemException("Duplicate native method found : " + ((MemberReference)current2).get_Name() + ". Please check your source carefully.");
                         }
                         res.Add((object)((MemberReference)current2).get_Name());
                     }
                 }
             }
             if (current1.get_HasNestedTypes())
             {
                 MonoAOTRegistration.ExtractNativeMethodsFromTypes((ICollection <TypeDefinition>)current1.get_NestedTypes(), res);
             }
         }
     }
 }
All Usage Examples Of UnityEditor.MonoAOTRegistration::ExtractNativeMethodsFromTypes