示例#1
0
 internal ErrorPlugInInfo(BasePlugInAttribute attribute, Type type, PlugInErrorType errorType)
 {
     RegName      = attribute.GetRegName(type);
     Type         = type.ToString();
     AssemblyName = type.Assembly.FullName;
     Error        = errorType;
 }
示例#2
0
        public bool Add(BasePlugInAttribute attribute, Type type)
        {
            TkDebug.AssertArgumentNull(attribute, "attribute", this);
            TkDebug.AssertArgumentNull(type, "type", this);

            TkDebug.Assert(attribute.FactoryName == Name, string.Format(ObjectUtil.SysCulture,
                                                                        "调用错误,Attribute的工厂名{0}和当前工厂的不一致", attribute.FactoryName), this);

            string regName = attribute.GetRegName(type);

            return(Add(regName, attribute, type));
        }
示例#3
0
        internal bool InternalAddCodePlugIn(BaseGlobalVariable globalVariable,
                                            BasePlugInAttribute attribute, Type type)
        {
            BasePlugInFactory factory = ObjectUtil.TryGetValue(fAllFactories, attribute.FactoryName);

            if (factory == null)
            {
                globalVariable.AddCodeError(attribute, type, PlugInErrorType.NoFactory);
                return(false);
            }

            bool result = factory.Add(attribute, type);

            if (!result)
            {
                globalVariable.AddCodeError(attribute, type, PlugInErrorType.Duplicate);
            }
            else
            {
                TkTrace.LogInfo($"在工程[{factory.Description}]中添加注册名为[{attribute.GetRegName(type)}]类型[{type}]");
            }
            return(result);
        }