private void LoadAdvisorAssembly(string path) { eventLog.AddEntry("Scaning assembly " + path + "... ", EventSeverity.Info); try { Assembly advisorAssembly = Assembly.LoadFile(path); foreach (Type type in advisorAssembly.GetTypes()) { object[] attrs = type.GetCustomAttributes( typeof(RegisterAdvisorAttribute), true); if (attrs.Length > 0) { RegisterAdvisorAttribute advisorAttr = (RegisterAdvisorAttribute)attrs[0]; RegisterAdvisor(type, advisorAttr.Name); } } } catch (Exception ex) { eventLog.AddEntry("Failed to load assembly " + path + "." + ex.ToString(), EventSeverity.Error); } }
private IAdvisorProxy LoadAdvisorAssembly(string path) { Assembly advisorAssembly = Assembly.LoadFile(path); foreach (Type type in advisorAssembly.GetTypes()) { object[] attrs = type.GetCustomAttributes( typeof(RegisterAdvisorAttribute), true); if (attrs.Length > 0) { RegisterAdvisorAttribute advisorAttr = (RegisterAdvisorAttribute)attrs[0]; return((IAdvisorProxy)type.InvokeMember("ctor", BindingFlags.CreateInstance, null, null, null)); } } return(null); }