Beispiel #1
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);
        }
Beispiel #2
0
        public void AppStarting(object application, BaseAppSetting appsetting,
                                BaseGlobalVariable globalVariable)
        {
            TkAdoData.Culture = appsetting.Culture ?? CultureInfo.CurrentCulture;

            BaseXmlPlugInFactory factory = globalVariable.FactoryManager.GetCodeFactory(
                CodeTablePlugInFactory.REG_NAME).Convert <BaseXmlPlugInFactory>();

            if (factory != null)
            {
                factory.FailGetRegItem += AddStandardCodeTable;

                XmlPlugInAttribute codeTableAttr = new XmlPlugInAttribute(CodeTablePlugInFactory.PATH,
                                                                          typeof(CodeTableXml))
                {
                    SearchPattern = "*CodeTable.xml"
                };
                factory.AddXmlPlugInAttribute(codeTableAttr);

                factory.AddBaseClassAttribute(new XmlBaseClassAttribute(
                                                  StandardCodeTableConfig.BASE_CLASS, typeof(InternalStandardDbCodeTable)));
                factory.AddBaseClassAttribute(new XmlBaseClassAttribute(
                                                  Tk5CodeTableConfig.BASE_CLASS, typeof(InternalTk5DbCodeTable)));
                factory.AddBaseClassAttribute(new XmlBaseClassAttribute(
                                                  SqlCodeTableConfig.BASE_CLASS, typeof(InternalSqlCodeTable)));
            }

            factory = globalVariable.FactoryManager.GetCodeFactory(
                EasySearchPlugInFactory.REG_NAME).Convert <BaseXmlPlugInFactory>();

            if (factory != null)
            {
                XmlPlugInAttribute easySearchAttr = new XmlPlugInAttribute(CodeTablePlugInFactory.PATH,
                                                                           typeof(EasySearchXml))
                {
                    SearchPattern = "*EasySearch.xml"
                };
                factory.AddXmlPlugInAttribute(easySearchAttr);

                factory.AddBaseClassAttribute(new XmlBaseClassAttribute(
                                                  Tk5EasySearchConfig.BASE_CLASS, typeof(InternalTk5DbEasySearch)));
                factory.AddBaseClassAttribute(new XmlBaseClassAttribute(
                                                  Tk5CodeTableEasySearchConfig.BASE_CLASS, typeof(InternalTk5DbCodeTableEasySearch)));
                factory.AddBaseClassAttribute(new XmlBaseClassAttribute(
                                                  Tk5Level0CodeTableEasySearchConfig.BASE_CLASS,
                                                  typeof(InternalTk5DbLevel0CodeTableEasySearch)));
                factory.AddBaseClassAttribute(new XmlBaseClassAttribute(
                                                  Tk5LevelCodeTableEasySearchConfig.BASE_CLASS,
                                                  typeof(InternalTk5DbLevelCodeTableEasySearch)));
                factory.AddBaseClassAttribute(new XmlBaseClassAttribute(
                                                  Tk5TreeEasySearchConfig.BASE_CLASS,
                                                  typeof(InternalTk5DbTreeEasySearch)));
                factory.AddBaseClassAttribute(new XmlBaseClassAttribute(
                                                  SqlEasySearchConfig.BASE_CLASS,
                                                  typeof(InternalTk5DbSqlEasySearch)));
            }
        }
Beispiel #3
0
        private void SearchXml(XmlPlugInAttribute attribute, string path)
        {
            string[] files = Directory.GetFiles(path, FileUtil.GetXmlFilePattern(
                                                    attribute.SearchPattern), SearchOption.AllDirectories);

            foreach (string file in files)
            {
                SearchXmlPlugInFile(attribute, file);
            }
        }
Beispiel #4
0
        private void SearchXmlPlugIn(XmlPlugInAttribute attribute, string basePath)
        {
            string path = Path.Combine(basePath, attribute.XmlPath);

            if (!Directory.Exists(path))
            {
                return;
            }
            //if (attribute.IsVersionSwitcher)
            //{
            //    XmlVersionSwitcher switcher = ObjectUtil.CreateObject(attribute.XmlConfigType)
            //        as XmlVersionSwitcher;
            //    switcher.LoadFromDirectory(path, attribute.SearchPattern, AddXmlConfigXml);
            //}
            //else
            SearchXml(attribute, path);
        }
Beispiel #5
0
 private void SearchXmlPlugInFile(XmlPlugInAttribute attribute, string fileName)
 {
     //if (attribute.IsVersionSwitcher)
     //{
     //    XmlVersionSwitcher switcher = ObjectUtil.CreateObject(attribute.XmlConfigType)
     //        as XmlVersionSwitcher;
     //    switcher.LoadFromFile(fileName, AddXmlConfigXml);
     //}
     //else
     try
     {
         SearchXmlFile(attribute, fileName);
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #6
0
        public void AddXmlPlugInAttribute(XmlPlugInAttribute attribute)
        {
            TkDebug.AssertArgumentNull(attribute, "attribute", this);

            fXmlPlugInAttributes.Add(attribute);
        }