protected MessageClassAttribute GetMessageSerializedClassAttribute() { object[] messageSerializedClassAttributes = ClassType.GetCustomAttributes(typeof(MessageClassAttribute), false); if (messageSerializedClassAttributes.Length == 0) { return(new MessageClassAttribute()); } return((MessageClassAttribute)messageSerializedClassAttributes[0]); }
/// <summary> /// /// </summary> /// <param name="screenType"></param> /// <exception cref="ArgumentException">Screen Type is invalid.</exception> public InternalScreen(Type screenType) { if (!CheckValidScreen(screenType)) { throw new ArgumentException("Screen Type is invalid."); } m_classType = screenType; m_assemblyName = ClassType.GetType().Assembly.FullName; m_screenAttribute = (ScreenAttribute)ClassType.GetCustomAttributes(typeof(ScreenAttribute), false)[0]; }
private static void QueryImplementationFromAssembly(Dictionary <string, InterfaceImplementation> ImplementationDictionary, Assembly Assembly) { Type[] Types = Assembly.GetTypes(); foreach (Type ClassType in Types) { InterfaceImplementationAttribute[] ImplementationAttributes = (InterfaceImplementationAttribute[])ClassType.GetCustomAttributes(typeof(InterfaceImplementationAttribute), false); foreach (InterfaceImplementationAttribute Attribute in ImplementationAttributes) { if (ImplementationDictionary.ContainsKey(Attribute.Scheme)) { // Update if scheme exist in dictionary, so only last discovered implementation available ImplementationDictionary[Attribute.Scheme] = new InterfaceImplementation(Attribute.Name, Attribute.Scheme, ClassType, Attribute.ConfigPanel); } else { // Add new item if scheme not exist in dictionary ImplementationDictionary.Add(Attribute.Scheme, new InterfaceImplementation(Attribute.Name, Attribute.Scheme, ClassType, Attribute.ConfigPanel)); } } } }