コード例 #1
0
 /// <summary>
 /// This method does load all codons and conditions in the given assembly.
 /// It will create builders for them which could be used by the factories to
 /// create the codon and condition objects.
 /// </summary>
 private void LoadCodonsAndConditions(Assembly assembly)
 {
     if (assembly != null)
     {
         foreach (Type type in assembly.GetTypes())
         {
             if (!type.IsAbstract)
             {
                 if (type.IsSubclassOf(typeof(AbstractCodon)) && Attribute.GetCustomAttribute(type, typeof(CodonAttribute)) != null)
                 {
                     codonFactory.AddCodonBuilder(new CodonBuilder(type.FullName, assembly));
                 }
                 else if (type.IsSubclassOf(typeof(AbstractCondition)) && Attribute.GetCustomAttribute(type, typeof(ConditionAttribute)) != null)
                 {
                     conditionFactory.AddConditionBuilder(new ConditionBuilder(type.FullName, assembly));
                 }
             }
         }
     }
 }