示例#1
0
        internal IEnumerable <PreinstalledPackageConfiguration> 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 <PreinstalledPackageInfo> packages = new PreinstalledPackageInfo[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 PreinstalledPackageConfiguration(repositoryPath, packages, isPreunzipped));
            }
        }
        internal IEnumerable<PreinstalledPackageConfiguration> 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<PreinstalledPackageInfo> packages = new PreinstalledPackageInfo[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 PreinstalledPackageConfiguration(repositoryPath, packages, isPreunzipped);
            }
        }