当前位置: 首页>>代码示例>>C#>>正文


C# XmlNode.GetChildrenByTag方法代码示例

本文整理汇总了C#中System.Xml.XmlNode.GetChildrenByTag方法的典型用法代码示例。如果您正苦于以下问题:C# XmlNode.GetChildrenByTag方法的具体用法?C# XmlNode.GetChildrenByTag怎么用?C# XmlNode.GetChildrenByTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XmlNode的用法示例。


在下文中一共展示了XmlNode.GetChildrenByTag方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExtractWrokflow

 private static void ExtractWrokflow(XmlNode workflowRoot, SingleWorkflowStep root)
 {
     var workflowSteps = workflowRoot.GetChildrenByTag(new List<string>(_availableStepsSpecs.Keys).ToArray());
     for (int i = 0; i < workflowSteps.Count; i++)
     {
         var workflowStep = workflowSteps[i];
         var newStep = SetupStepFactory.CreateStep(workflowStep);
         if (workflowStep.GetAttribute("include") != null)
         {
             LoadExternalWorkflowSteps(workflowStep.GetAttribute("include"), newStep, workflowStep.GetAttribute("assemblyPath"));
         }
         ExtractWrokflow(workflowStep, newStep);
         root.WorkflowSteps.Add(newStep);
     }
 }
开发者ID:kendarorg,项目名称:ZakSetup,代码行数:15,代码来源:TemplateFileLoader.cs

示例2: ExtractTemplates

        private static void ExtractTemplates(XmlNode rootTemplates)
        {
            var templates = rootTemplates.GetChildrenByTag("template");
            for (int i = 0; i < templates.Count; i++)
            {
                var template = templates[i];

                var setupTemplate = new SetupTemplate
                {
                    Content = template.InnerText.Trim('\r', '\n', '\f') + "\n",
                    Id = template.GetAttribute("id")
                };
                _setupFile.SetupTemplates.Add(setupTemplate.Id, setupTemplate);
            }
        }
开发者ID:kendarorg,项目名称:ZakSetup,代码行数:15,代码来源:TemplateFileLoader.cs

示例3: ExtractDlls

        private static void ExtractDlls(XmlNode rootDlls)
        {
            _availableStepsSpecs = new Dictionary<string, SingleWorkflowStep>();
            var dlls = rootDlls.GetChildrenByTag("dll");

            for (int i = 0; i < dlls.Count; i++)
            {
                var listOfAvailablePaths = new List<string>(_templatesDirectories.ToArray());

                var dll = dlls[i];
                var location = dll.GetAttribute("location");
                var dllName = dll.GetAttribute("name");

                listOfAvailablePaths.Add(location);
                listOfAvailablePaths.Add(Environment.CurrentDirectory);
                listOfAvailablePaths.Add(Environment.SystemDirectory);
                listOfAvailablePaths.Add(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location));

                if (!AssembliesManager.LoadAssemblyFrom(dllName, null,
                    listOfAvailablePaths.ToArray()))
                {
                    throw new FileNotFoundException("Impossible to load assembly", dllName);
                }
            }

            var loaders = new List<Type>(AssembliesManager.LoadTypesInheritingFrom(typeof(IOnLoad))).ToArray();
            foreach (var loader in loaders)
            {
                var step = (IOnLoad)Activator.CreateInstance(loader);
                step.Initialize();
            }

            var files = new List<Type>( AssembliesManager.LoadTypesInheritingFrom(typeof (SingleWorkflowStep))).ToArray();
            foreach (var stepType in files)
            {
                var step = (SingleWorkflowStep) Activator.CreateInstance(stepType);
                if (step.GetNodeType()!=null)
                {
                    if (!_availableStepsSpecs.ContainsKey(step.GetNodeType()))
                    {
                        _availableStepsSpecs.Add(step.GetNodeType(), step);
                    }
                }
            }

            var factories = new List<Type>(AssembliesManager.LoadTypesInheritingFrom(typeof(BaseStepFactory))).ToArray();
            foreach (var factory in factories)
            {
                var stepFactory = (BaseStepFactory)Activator.CreateInstance(factory);
                SetupStepFactory.AddFactory(stepFactory);
            }
        }
开发者ID:kendarorg,项目名称:ZakSetup,代码行数:52,代码来源:TemplateFileLoader.cs

示例4: ExtractConfigs

        private static void ExtractConfigs(XmlNode rootConfig)
        {
            var configs = rootConfig.GetChildrenByTag("config");
            for (int i = 0; i < configs.Count; i++)
            {
                var config = configs[i];
                ConfigTypes configType;
                if (!ConfigTypes.TryParse(config.GetAttribute("type"), true, out configType))
                {
                    configType = ConfigTypes.Value;
                }

                var setupConfig = new SetupConfig
                {
                    Key = config.GetAttribute("key"),
                    AllowNone = config.GetAttributeBool("allownone"),
                    ConfigType = configType,
                    Help = config.GetAttribute("help"),
                    Default = config.GetAttribute("default")
                };
                ExtractAvailableConfigs(config, setupConfig);
                _setupFile.SetupConfigs.Add(setupConfig.Key, setupConfig);
            }

            AddYesNoConfig();
        }
开发者ID:kendarorg,项目名称:ZakSetup,代码行数:26,代码来源:TemplateFileLoader.cs

示例5: ExtractBaseTemplates

        private static void ExtractBaseTemplates(XmlNode baseTemplates)
        {
            var templates = baseTemplates.GetChildrenByTag("baseTemplate");
            for (int i = 0; i < templates.Count; i++)
            {
                var template = templates[i];

                var templateFile = template.GetAttribute("templateFile");
                string templateFileContent = null;
                if (templateFile != null)
                {
                    if (templateFile.StartsWith("res:"))
                    {
                        templateFileContent = LoadAssemblyResource(templateFile, template.GetAttribute("assemblyPath"));
                    }
                    else
                    {
                        templateFile = Path.Combine(_templatesDirectory, templateFile);
                        if (File.Exists(templateFile))
                        {
                            templateFileContent = File.ReadAllText(templateFile);
                        }
                    }
                }
                if (templateFileContent == null)
                {
                    templateFileContent = template.InnerText;
                }
                templateFileContent = templateFileContent.Trim('\r', '\n', '\f') + "\n";
                if (templateFile != null && File.Exists(templateFile))
                {
                    templateFileContent = File.ReadAllText(templateFile).Trim('\r', '\n', '\f') + "\n";
                }
                var setupTemplate = new SetupBaseTemplate
                {
                    Content = templateFileContent,
                    Id = template.GetAttribute("id"),
                    TemplateSourceFile = template.GetAttribute("templateFile"),
                    IsXml = template.GetAttributeBool("isxml")
                };
                _setupFile.BaseTemplates.Add(setupTemplate.Id, setupTemplate);
            }
        }
开发者ID:kendarorg,项目名称:ZakSetup,代码行数:43,代码来源:TemplateFileLoader.cs

示例6: ExtractAvailableConfigs

        private static void ExtractAvailableConfigs(XmlNode config, SetupConfig setupConfig)
        {
            var availables = config.GetChildrenByTag("available");
            for (int i = 0; i < availables.Count; i++)
            {
                var available = availables[i];

                var availableConfig = new SetupAvailable
                {
                    Value = available.GetAttribute("value"),
                    Help = available.GetAttribute("help"),
                    IsNull = false
                };

                ExtractWrokflow(available, availableConfig);
                setupConfig.SetupChoices.Add(availableConfig);
            }
            AddEmptyChoice(setupConfig);
        }
开发者ID:kendarorg,项目名称:ZakSetup,代码行数:19,代码来源:TemplateFileLoader.cs


注:本文中的System.Xml.XmlNode.GetChildrenByTag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。