private static Type[] GetInstallerTypes(System.Reflection.Assembly assem) { ArrayList list = new ArrayList(); Module[] modules = assem.GetModules(); for (int i = 0; i < modules.Length; i++) { Type[] types = modules[i].GetTypes(); for (int j = 0; j < types.Length; j++) { if ((typeof(Installer).IsAssignableFrom(types[j]) && !types[j].IsAbstract) && (types[j].IsPublic && ((RunInstallerAttribute) TypeDescriptor.GetAttributes(types[j])[typeof(RunInstallerAttribute)]).RunInstaller)) { list.Add(types[j]); } } } return (Type[]) list.ToArray(typeof(Type)); }
private static void ExecuteMain(System.Reflection.Assembly Assembly, string[] args) { MethodInfo mainMethod = Assembly.GetModules(false)[0].GetMethod("Main"); try { mainMethod.Invoke(null, new object[] { args }); } catch (System.Reflection.TargetInvocationException exception) { throw exception.InnerException; } }