private static Dictionary <string, System.Type> FindComponentsInAssembly() { componentTypes = new Dictionary <string, System.Type>(); foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies().Where(asm => !CSharpFunctions.IsDynamic(asm))) { foreach (Type type in assembly.GetTypes()) { BuildableComponentNameAttribute[] attribs = (BuildableComponentNameAttribute[])type.GetCustomAttributes(typeof(BuildableComponentNameAttribute), false); if (attribs != null && attribs.Length > 0) { foreach (BuildableComponentNameAttribute compNameAttr in attribs) { componentTypes.Add(compNameAttr.ComponentName, type); UnityDebugger.Debugger.LogFormat(ComponentLogChannel, "Found component in assembly: {0}", compNameAttr.ComponentName); } } } } return(componentTypes); }
private static Dictionary <string, System.Type> FindOrderActionsInAssembly() { var orderActionTypes = new Dictionary <string, System.Type>(); foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies().Where(asm => !CSharpFunctions.IsDynamic(asm))) { foreach (Type type in assembly.GetTypes()) { OrderActionNameAttribute[] attribs = (OrderActionNameAttribute[])type.GetCustomAttributes(typeof(OrderActionNameAttribute), false); if (attribs != null && attribs.Length > 0) { foreach (OrderActionNameAttribute compNameAttr in attribs) { orderActionTypes.Add(compNameAttr.OrderActionName, type); UnityDebugger.Debugger.Log(OrderActionsLogChannel, string.Format("Found OrderAction in assembly: {0}", compNameAttr.OrderActionName)); } } } } return(orderActionTypes); }