Example #1
0
        public static ManagedMethodInjectionHandle[] Inject(Type R, Type I)
        {
            List <ManagedMethodInjectionHandle> Outp = new List <ManagedMethodInjectionHandle>();

            foreach (MethodInfo RMI in R.GetMethods())
            {
                MethodInfo IMI = I.GetMethod(RMI.Name);
                if (IMI != null)
                {
                    if (RMI.ReturnType == IMI.ReturnType)
                    {
                        ParameterInfo[] RPI = RMI.GetParameters();
                        ParameterInfo[] IPI = IMI.GetParameters();

                        if (RPI.Length != IPI.Length)
                        {
                            continue;
                        }
                        Boolean Load = true;
                        for (Int32 x = 0; x < RPI.Length; x++)
                        {
                            if (RPI[x].ParameterType != IPI[x].ParameterType || RPI[x].IsOptional != IPI[x].IsOptional ||
                                RPI[x].IsOut != IPI[x].IsOut || RPI[x].IsIn != IPI[x].IsIn)
                            {
                                Load = false;
                                break;
                            }
                        }
                        if (Load)
                        {
                            Outp.Add(Inject(RMI, IMI));
                        }
                    }
                }
            }
            return(Outp.ToArray());
        }