private void MapAttributeTypes()
        {
            foreach (var registration in RuntimeCodebase.GetAssemblyAttributes <TAttribute>(registrationAssemblies))
            {
                if (definedDecoratorTypes.ContainsKey(registration.decoratedType))
                {
                    Debug.LogWarning($"Multiple '{typeof(TDecorator)}' for '{registration.decoratedType}'. Ignoring '{registration.decoratorType}'.");
                    continue;
                }

                definedDecoratorTypes.Add(registration.decoratedType, registration.decoratorType);
            }
        }
        protected MultiDecoratorProvider()
        {
            definedDecoratorTypes  = new Dictionary <Type, HashSet <Type> >();
            resolvedDecoratorTypes = new Dictionary <Type, HashSet <Type> >();
            decorators             = new Dictionary <TDecorated, HashSet <TDecorator> >();

            foreach (var registration in RuntimeCodebase.GetAssemblyAttributes <TAttribute>(registrationAssemblies))
            {
                if (!definedDecoratorTypes.TryGetValue(registration.decoratedType, out var _definedDecoratorTypes))
                {
                    _definedDecoratorTypes = new HashSet <Type>();
                    definedDecoratorTypes.Add(registration.decoratedType, _definedDecoratorTypes);
                }

                _definedDecoratorTypes.Add(registration.decoratorType);
            }
        }
Пример #3
0
 public static IEnumerable <Attribute> GetAssemblyAttributes(Type attributeType)
 {
     // Faster version than RuntimeCodebase:
     // Usually no need to check in other assemblies as our custom attributes are defined in Ludiq
     return(RuntimeCodebase.GetAssemblyAttributes(attributeType, ludiqAssemblies));
 }