Example #1
0
        internal AppDomainInitializerInfo(AppDomainInitializer init)
        {
            Info = null;
            if (init == null)
            {
                return;
            }
            List <ItemInfo>             itemInfo        = new List <ItemInfo>();
            List <AppDomainInitializer> nestedDelegates = new List <AppDomainInitializer>();

            nestedDelegates.Add(init);
            int idx = 0;

            while (nestedDelegates.Count > idx)
            {
                AppDomainInitializer curr = nestedDelegates[idx++];
                Delegate[]           list = curr.GetInvocationList();
                for (int i = 0; i < list.Length; i++)
                {
                    if (!list[i].Method.IsStatic)
                    {
                        if (list[i].Target == null)
                        {
                            continue;
                        }

                        AppDomainInitializer nested = list[i].Target as AppDomainInitializer;
                        if (nested != null)
                        {
                            nestedDelegates.Add(nested);
                        }
                        else
                        {
                            throw new ArgumentException(SR.Arg_MustBeStatic,
                                                        list[i].Method.ReflectedType.FullName + "::" + list[i].Method.Name);
                        }
                    }
                    else
                    {
                        ItemInfo info = new ItemInfo();
                        info.TargetTypeAssembly = list[i].Method.ReflectedType.Module.Assembly.FullName;
                        info.TargetTypeName     = list[i].Method.ReflectedType.FullName;
                        info.MethodName         = list[i].Method.Name;
                        itemInfo.Add(info);
                    }
                }
            }

            Info = itemInfo.ToArray();
        }
        // Token: 0x06000783 RID: 1923 RVA: 0x00019FC8 File Offset: 0x000181C8
        internal AppDomainInitializerInfo(AppDomainInitializer init)
        {
            this.Info = null;
            if (init == null)
            {
                return;
            }
            List <AppDomainInitializerInfo.ItemInfo> list = new List <AppDomainInitializerInfo.ItemInfo>();
            List <AppDomainInitializer> list2             = new List <AppDomainInitializer>();

            list2.Add(init);
            int num = 0;

            while (list2.Count > num)
            {
                AppDomainInitializer appDomainInitializer = list2[num++];
                Delegate[]           invocationList       = appDomainInitializer.GetInvocationList();
                for (int i = 0; i < invocationList.Length; i++)
                {
                    if (!invocationList[i].Method.IsStatic)
                    {
                        if (invocationList[i].Target != null)
                        {
                            AppDomainInitializer appDomainInitializer2 = invocationList[i].Target as AppDomainInitializer;
                            if (appDomainInitializer2 == null)
                            {
                                throw new ArgumentException(Environment.GetResourceString("Arg_MustBeStatic"), invocationList[i].Method.ReflectedType.FullName + "::" + invocationList[i].Method.Name);
                            }
                            list2.Add(appDomainInitializer2);
                        }
                    }
                    else
                    {
                        list.Add(new AppDomainInitializerInfo.ItemInfo
                        {
                            TargetTypeAssembly = invocationList[i].Method.ReflectedType.Module.Assembly.FullName,
                            TargetTypeName     = invocationList[i].Method.ReflectedType.FullName,
                            MethodName         = invocationList[i].Method.Name
                        });
                    }
                }
            }
            this.Info = list.ToArray();
        }