Example #1
0
        static DynamicAssembly()
        {
            AssBuilder =
                VersionDifferences.DefineDynamicAssembly(
                    new AssemblyName(AssName),
                    Access);

            ModBuilder = AssBuilder.DefineDynamicModule(
                AssName);
        }
Example #2
0
        static MethodHelper()
        {
            var AssName = new AssemblyName(nameof(MethodHelper));

            AssBuilder = VersionDifferences.DefineDynamicAssembly(AssName,
                                                                  AssemblyBuilderAccess.Run);

            ModBuilder = AssBuilder.DefineDynamicModule(nameof(MethodHelper));

            DelegateTypesCache     = new Dictionary <MethodSign, Type>();
            DelegateTypesCacheLock = new object();

            FuncInterfaces = new Type[] {
                typeof(IFunc <>),
                typeof(IFunc <,>),
                typeof(IFunc <, ,>),
                typeof(IFunc <, , ,>),
                typeof(IFunc <, , , ,>),
                typeof(IFunc <, , , , ,>),
                typeof(IFunc <, , , , , ,>),
                typeof(IFunc <, , , , , , ,>),
                typeof(IFunc <, , , , , , , ,>),
                typeof(IFunc <, , , , , , , , ,>),
                typeof(IFunc <, , , , , , , , , ,>),
                typeof(IFunc <, , , , , , , , , , ,>),
                typeof(IFunc <, , , , , , , , , , , ,>),
                typeof(IFunc <, , , , , , , , , , , , ,>),
                typeof(IFunc <, , , , , , , , , , , , , ,>),
                typeof(IFunc <, , , , , , , , , , , , , , ,>),
                typeof(IFunc <, , , , , , , , , , , , , , , ,>)
            };

            ActionInterfaces = new Type[] {
                typeof(IAction),
                typeof(IAction <>),
                typeof(IAction <,>),
                typeof(IAction <, ,>),
                typeof(IAction <, , ,>),
                typeof(IAction <, , , ,>),
                typeof(IAction <, , , , ,>),
                typeof(IAction <, , , , , ,>),
                typeof(IAction <, , , , , , ,>),
                typeof(IAction <, , , , , , , ,>),
                typeof(IAction <, , , , , , , , ,>),
                typeof(IAction <, , , , , , , , , ,>),
                typeof(IAction <, , , , , , , , , , ,>),
                typeof(IAction <, , , , , , , , , , , ,>),
                typeof(IAction <, , , , , , , , , , , , ,>),
                typeof(IAction <, , , , , , , , , , , , , ,>)
            };

            DelegatePointerOffset = 0;
        }
Example #3
0
        private static void Reset()
        {
            if (!HaveDefinedType)
            {
                return;
            }

            lock (Lock)
            {
                if (!HaveDefinedType)
                {
                    return;
                }

                AssBuilder =
                    VersionDifferences.DefineDynamicAssembly(
                        new AssemblyName(AssName),
                        Access
#if Save
                        | AssemblyBuilderAccess.Save
#endif
                        );

                AssBuilders.Add(AssBuilder);

                ModBuilder = AssBuilder.DefineDynamicModule(
                    AssName
#if Save
                    , $"{AssName}.dll"
#endif
                    );

                HaveDefinedType = false;

                var assemblies = IgnoresAccessChecksToDic.Keys.ToArray();

                IgnoresAccessChecksToDic.Clear();

                foreach (var assembly in assemblies)
                {
                    IgnoresAccessChecksTo(assembly);
                }
            }
        }