Ejemplo n.º 1
0
        public GenericResult TryToLoad()
        {
            string typename = _pluginType.FullName;

            if (!typeof(IPlugin).IsAssignableFrom(_pluginType))
            {
                _manager.Tracer.Trace("PluginManager.Messages.IPluginIsNotImplemented", typename);
                return(GenericResult.Failed);
            }

            object[] attrs = _pluginType.GetCustomAttributes(typeof(PluginInfoAttribute), false);
            if (attrs.Length != 1)
            {
                _manager.Tracer.Trace("PluginManager.Messages.PluginInfoAttributeNotFound", typename);
                return(GenericResult.Failed);
            }

            _attribute = (PluginInfoAttribute)attrs[0];
            string id = _attribute.ID;

            if (id == null || id.Length == 0)
            {
                _manager.Tracer.Trace("PluginManager.Messages.IDNotFound", typename);
                return(GenericResult.Failed);
            }
            _status = PluginStatus.Loaded;

            return(GenericResult.Succeeded);
        }
Ejemplo n.º 2
0
        public GenericResult TryToLoad()
        {
            string typename = _pluginType.FullName;
            if (!typeof(IPlugin).IsAssignableFrom(_pluginType)) {
                _manager.Tracer.Trace("PluginManager.Messages.IPluginIsNotImplemented", typename);
                return GenericResult.Failed;
            }

            object[] attrs = _pluginType.GetCustomAttributes(typeof(PluginInfoAttribute), false);
            if (attrs.Length != 1) {
                _manager.Tracer.Trace("PluginManager.Messages.PluginInfoAttributeNotFound", typename);
                return GenericResult.Failed;
            }

            _attribute = (PluginInfoAttribute)attrs[0];
            string id = _attribute.ID;
            if (id == null || id.Length == 0) {
                _manager.Tracer.Trace("PluginManager.Messages.IDNotFound", typename);
                return GenericResult.Failed;
            }
            _status = PluginStatus.Loaded;

            return GenericResult.Succeeded;
        }