public bool AddCodePlugIn(BasePlugInAttribute attribute, Type type) { TkDebug.AssertArgumentNull(attribute, "attribute", this); TkDebug.AssertArgumentNull(type, "type", this); BasePlugInFactory factory = GetFactory(attribute.FactoryName); return(factory.Add(attribute, type)); }
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); }