예제 #1
0
        private void AddXmlConfigXml(ToolkitConfig config, XmlConfigInfo configInfo)
        {
            string path = Path.GetFileName(config.FullPath);

            foreach (XmlPlugInItemInfo configItem in configInfo.ConfigItems)
            {
                object value = ObjectUtil.GetValue(configItem.PropertyInfo, config);
                if (value != null)
                {
                    switch (configItem.Type)
                    {
                    case XmlPlugInItemType.Single:
                        AddPlugInXmlItem(value as IXmlPlugInItem, path);
                        break;

                    case XmlPlugInItemType.Enumerable:
                        AddPlugInXmlItems(value as IEnumerable, path);
                        break;

                    case XmlPlugInItemType.Enumerator:
                        AddPlugInXmlItems(value as IEnumerator, path);
                        break;
                    }
                }
            }
        }
예제 #2
0
        private void SearchXmlFile(XmlPlugInAttribute attribute, string file)
        {
            TkTrace.LogInfo($"工厂[{Description}]搜索Xml文件{file}");
            ToolkitConfig configXml = ObjectUtil.CreateObject(attribute.XmlConfigType).Convert <ToolkitConfig>();

            configXml.ReadXmlFromFile(file);
            AddXmlConfigXml(configXml, attribute.ConfigInfo);
        }