Esempio n. 1
0
        private static IEnumerable <string> GetPackageUrls(XElement setupDescription)
        {
            int maxkey = setupDescription.Descendants().Attributes(KeyAttributeName).Select(f => (int)f).Max();

            SetupSoapClient client = CreateClient();

            XElement originalSetupDescription = client.GetSetupDescription(RuntimeInformation.ProductVersion.ToString(),
                                                                           InstallationInformationFacade.InstallationId.ToString());

            var element =
                (from elm in originalSetupDescription.Descendants()
                 let keyAttr = elm.Attribute(KeyAttributeName)
                               where keyAttr != null && (int)keyAttr == maxkey
                               select elm).Single();

            foreach (XElement packageElement in setupDescription.Descendants(PackageElementName))
            {
                XAttribute idAttribute = packageElement.Attribute(IdAttributeName);
                if (idAttribute == null)
                {
                    throw new InvalidOperationException($"Setup XML malformed, '{IdAttributeName}' is missing on a '{PackageElementName}' element");
                }

                string url =
                    (from elm in element.Descendants(PackageElementName)
                     where elm.Attribute(IdAttributeName).Value == idAttribute.Value
                     select elm.Attribute(UrlAttributeName).Value).SingleOrDefault();

                yield return(ResolvePackageUrl(url));
            }
        }
Esempio n. 2
0
        /// <exclude />
        public static XElement GetSetupDescription()
        {
            SetupSoapClient client = CreateClient();

            return(client.GetSetupDescription(
                       RuntimeInformation.ProductVersion.ToString(),
                       InstallationInformationFacade.InstallationId.ToString()));
        }