public IComponentProvider[] FindByType(string type)
        {
            bool allowParent;

            if (!AllowLookupByType(type, out allowParent))
            {
                throw new ComponentSecurityException();
            }

            if (type2Component.ContainsKey(type))
            {
                if (type2Component[type].Count == 0)
                {
                    type2Component.Remove(type);
                }
                else
                {
                    return(type2Component[type].ToArray());
                }
            }

            if (allowParent && parent != null)
            {
                return(parent.FindByType(type));
            }

            /* NOT FOUND */
            return(nullComponents);
        }
Beispiel #2
0
 private static bool HasComponent(IComponentDirectory componentDirectory, string typeName)
 {
     try
     {
         // Console.Out.WriteLine(".. HasComponent {0}", typeName);
         return(componentDirectory.FindByType(typeName).Length > 0);
     }
     catch (Exception) { return(false); }
 }