示例#1
0
        public void Load(Type[] types)
        {
            if (types == null)
            {
                return;
            }

            foreach (Type type in types)
            {
                if (type == null)
                {
                    continue;
                }
                try
                {
                    IChoPlugIn <T> plugIn = ChoActivator.CreateInstance <IChoPlugIn <T> >();
                    if (plugIn != null)
                    {
                        _plugInsObjs.Add(plugIn);
                    }
                }
                catch (Exception ex)
                {
                    ChoTrace.Write(ex);
                }
            }
        }
示例#2
0
        public void Load(string[] types)
        {
            if (types == null)
            {
                return;
            }

            foreach (string typeString in types)
            {
                if (typeString.IsNullOrWhiteSpace())
                {
                    continue;
                }

                foreach (string typeText in typeString.SplitNTrim())
                {
                    try
                    {
                        Type type = ChoType.GetType(typeText);
                        if (type == null)
                        {
                            continue;
                        }

                        IChoPlugIn <T> plugIn = ChoActivator.CreateInstance <IChoPlugIn <T> >();
                        if (plugIn != null)
                        {
                            _plugInsObjs.Add(plugIn);
                        }
                    }
                    catch (Exception ex)
                    {
                        ChoTrace.Write(ex);
                    }
                }
            }
        }