public ActionInfo[] Reflector() { if (_assemblies == null || _assemblies.Count == 0) { return(null); } List <ActionInfo> actionNames = new List <ActionInfo>(); foreach (Assembly ass in _assemblies) { Type[] types = ass.GetTypes(); if (types == null || types.Length == 0) { continue; } foreach (Type t in types) { if (!t.IsClass || t.IsAbstract) { continue; } if (t.GetInterface("CodeCell.Bricks.ModelFabric.IAction") == null) { continue; } ActionAttribute name = null; object[] atts = t.GetCustomAttributes(typeof(ActionAttribute), true); if (atts == null || atts.Length == 0) { ObjectHandle actObj = Activator.CreateInstance(ass.FullName, t.FullName); object nameobj = actObj.Unwrap().GetType().InvokeMember("Name", BindingFlags.GetProperty, null, actObj.Unwrap(), null); if (nameobj != null) { name = new ActionAttribute(nameobj.ToString(), string.Empty); } } else { name = atts[0] as ActionAttribute; } actionNames.Add(new ActionInfo(ass.Location, t.FullName, name)); } } return(actionNames.Count > 0 ? actionNames.ToArray() : null); }
public ActionInfo(string assemblyUrl, string className, ActionAttribute name) { AssemblyUrl = assemblyUrl; ClassName = className; ActionAttribute = name; }