Example #1
0
        public StarSystemFactory(Type InAttributeType, Type InInterfaceType)
        {
            DebugHelper.Assert(InAttributeType != null && InInterfaceType != null);
            Assembly assembly = InInterfaceType.get_Assembly();

            Type[] types = assembly.GetTypes();
            int    num   = 0;

            while (types != null && num < types.Length)
            {
                Type     type             = types[num];
                object[] customAttributes = type.GetCustomAttributes(InAttributeType, true);
                if (customAttributes != null)
                {
                    for (int i = 0; i < customAttributes.Length; i++)
                    {
                        IIdentifierAttribute <int> identifierAttribute = customAttributes[i] as IIdentifierAttribute <int>;
                        if (identifierAttribute != null)
                        {
                            this.RegisterType(identifierAttribute.get_ID(), type);
                        }
                    }
                }
                num++;
            }
        }
Example #2
0
 public StarSystemFactory(System.Type InAttributeType, System.Type InInterfaceType)
 {
     DebugHelper.Assert((InAttributeType != null) && (InInterfaceType != null));
     System.Type[] types = InInterfaceType.Assembly.GetTypes();
     for (int i = 0; (types != null) && (i < types.Length); i++)
     {
         System.Type inType           = types[i];
         object[]    customAttributes = inType.GetCustomAttributes(InAttributeType, true);
         if (customAttributes != null)
         {
             for (int j = 0; j < customAttributes.Length; j++)
             {
                 IIdentifierAttribute <int> attribute = customAttributes[j] as IIdentifierAttribute <int>;
                 if (attribute != null)
                 {
                     this.RegisterType(attribute.ID, inType);
                 }
             }
         }
     }
 }