Пример #1
0
 public void Remove(PluginKey key)
 {
     if (_plugins.ContainsKey(key))
     {
         _plugins.Remove(key);
     }
 }
        private IExtensionDescriptor CheckForExtension(Type type)
        {
            if (!type.IsSubclassOf(typeof(Extension)))
            {
                return(null);
            }

            var extensionAttribute = type.GetCustomAttribute(typeof(ExtensionAttribute)) as ExtensionAttribute;

            if (extensionAttribute == null)
            {
                return(null);
            }

            var key      = new PluginKey(type.Assembly.Location, type.FullName);
            var metadata = new ExtensionMetadata();

            SetPluginMetadata(metadata, extensionAttribute, type);

            var descriptor = new ExtensionDescriptor(key, metadata, type);

            return(descriptor);
        }
        private IFigureDescriptor CheckForFigure(Type type)
        {
            if (!type.IsSubclassOf(typeof(Figure)))
            {
                return(null);
            }

            var figureAttribute = type.GetCustomAttribute(typeof(FigureAttribute)) as FigureAttribute;

            if (figureAttribute == null)
            {
                return(null);
            }

            var key      = new PluginKey(type.Assembly.Location, type.FullName);
            var metadata = new FigureMetadata();

            SetPluginMetadata(metadata, figureAttribute, type);

            var descriptor = new FigureDescriptor(key, metadata, type);

            return(descriptor);
        }
Пример #4
0
 public IPluginDescriptor Get(PluginKey key)
 {
     return(_plugins.ContainsKey(key) ? _plugins[key] : null);
 }
Пример #5
0
 public FigureDescriptor(PluginKey key, IPluginMetadata metadata, Type type)
     : base(key, metadata)
 {
     _type = type;
 }
Пример #6
0
 public ExtensionDescriptor(PluginKey key, IPluginMetadata metadata, Type type)
     : base(key, metadata)
 {
     _type = type;
 }