internal IEnumerable<VsTemplateWizardInstallerConfiguration> GetConfigurationsFromXmlDocument(
            XDocument document,
            string vsTemplatePath,
            object vsExtensionManager = null,
            IEnumerable<IRegistryKey> registryKeys = null)
        {
            // Ignore XML namespaces since VS does not check them either when loading vstemplate files.
            IEnumerable<XElement> packagesElements = document.Root.ElementsNoNamespace("WizardData")
                .ElementsNoNamespace("packages");

            foreach (var packagesElement in packagesElements)
            {
                IList<VsTemplateWizardPackageInfo> packages = new VsTemplateWizardPackageInfo[0];
                string repositoryPath = null;
                bool isPreunzipped = false;

                string isPreunzippedString = packagesElement.GetOptionalAttributeValue("isPreunzipped");
                if (!String.IsNullOrEmpty(isPreunzippedString))
                {
                    Boolean.TryParse(isPreunzippedString, out isPreunzipped);
                }

                packages = GetPackages(packagesElement).ToList();

                if (packages.Count > 0)
                {
                    RepositoryType repositoryType = GetRepositoryType(packagesElement);
                    repositoryPath = GetRepositoryPath(packagesElement, repositoryType, vsTemplatePath, vsExtensionManager, registryKeys);
                }

                yield return new VsTemplateWizardInstallerConfiguration(repositoryPath, packages, isPreunzipped);
            }
        }
Beispiel #2
0
        internal VsTemplateWizardInstallerConfiguration GetConfigurationFromXmlDocument(
            XDocument document,
            string vsTemplatePath,
            object vsExtensionManager = null,
            IEnumerable <IRegistryKey> registryKeys = null)
        {
            IList <VsTemplateWizardPackageInfo> packages = new VsTemplateWizardPackageInfo[0];
            string repositoryPath = null;
            bool   isPreunzipped  = false;

            // Ignore XML namespaces since VS does not check them either when loading vstemplate files.
            XElement packagesElement = document.Root.ElementsNoNamespace("WizardData")
                                       .ElementsNoNamespace("packages")
                                       .FirstOrDefault();

            if (packagesElement != null)
            {
                string isPreunzippedString = packagesElement.GetOptionalAttributeValue("isPreunzipped");
                if (!String.IsNullOrEmpty(isPreunzippedString))
                {
                    Boolean.TryParse(isPreunzippedString, out isPreunzipped);
                }

                packages = GetPackages(packagesElement).ToList();

                if (packages.Count > 0)
                {
                    RepositoryType repositoryType = GetRepositoryType(packagesElement);
                    repositoryPath = GetRepositoryPath(packagesElement, repositoryType, vsTemplatePath, vsExtensionManager, registryKeys);
                }
            }

            return(new VsTemplateWizardInstallerConfiguration(repositoryPath, packages, isPreunzipped));
        }