void EnsureFileListLoaded()
 {
     if (_fileList == null)
     {
         TaskManager.Instance.Run("Loading wrap index file.",
                                  x =>
         {
             _fileList = _httpClientGetter(_requestUri)
                         .Get()
                         .Notify(x)
                         .Send()
                         .Notify(x)
                         .AsPackageDocument();
         });
     }
 }
示例#2
0
        public static PackageFeed ParsePackageDocument(this XDocument xmlDocument)
        {
            if (xmlDocument == null)
            {
                return(null);
            }
            var feed = new PackageFeed
            {
                PublishHref                    = GetPublishHref(xmlDocument),
                Packages                       = from wrapList in xmlDocument.Descendants("wrap")
                                      let name = wrapList.Attribute("name")
                                                 let semver = wrapList.Attribute("semantic-version")
                                                              let version                         = wrapList.Attribute("version")
                                                                                        let nuked = wrapList.Attribute("nuked")
                                                                                                    let lastModifiedTimeUtc                       = GetModifiedTimeUtc(wrapList.Attribute("last-modified-time-utc"))
                                                                                                                                         let link = (from link in wrapList.Elements("link")
                                                                                                                                                     let relAttribute = link.Attribute("rel")
                                                                                                                                                                        let hrefAttribute = link.Attribute("href")
                                                                                                                                                                                            where hrefAttribute != null && relAttribute != null && relAttribute.Value.EqualsNoCase("package")
                                                                                                                                                                                            select hrefAttribute).FirstOrDefault()
                                                                                                                                                    let baseUri = !string.IsNullOrEmpty(xmlDocument.BaseUri) ? new Uri(xmlDocument.BaseUri, UriKind.Absolute) : null
                                                                                                                                                                  let absoluteLink = baseUri == null ? new Uri(link.Value, UriKind.RelativeOrAbsolute) : new Uri(baseUri, new Uri(link.Value, UriKind.RelativeOrAbsolute))
                                                                                                                                                                                     where name != null && (semver != null || version != null) && link != null
                                                                                                                                                                                     let depends = wrapList.Elements("depends").Select(x => x.Value)
                                                                                                                                                                                                   select new PackageEntry
                {
                    Name    = name.Value,
                    Version = semver != null?SemanticVersion.TryParseExact(semver.Value) : (version == null ? null : version.Value.ToSemVer()),
                                  PackageHref  = absoluteLink,
                                  Dependencies = depends,
                                  CreationTime = lastModifiedTimeUtc,
                                  Nuked        = nuked != null && GetNuked(nuked.Value)
                }
            };

            feed.CanPublish = feed.PublishHref != null;
            return(feed);
        }
示例#3
0
 protected void when_reading_feed()
 {
     Feed = NuFeedReader.Read(_xFeed.CreateReader());
 }
 void EnsureFileListLoaded()
 {
     if (_fileList == null)
     {
         TaskManager.Instance.Run("Loading wrap index file.",
                                  x =>
                                  {
                                      _fileList = _httpClientGetter(_requestUri)
                                              .Get()
                                              .Notify(x)
                                              .Send()
                                              .Notify(x)
                                              .AsPackageDocument();
                                  });
     }
 }