private VersionResult CreateVersionResult(string id, List<RegistrationEntry> registrationEntries, DownloadsByVersion downloadsByVersion)
        {
            VersionResult result = new VersionResult();

            foreach (var registrationEntry in registrationEntries.OrderBy(r => r.Version))
            {
                string versionStr = String.Intern(registrationEntry.Version.ToNormalizedString());

                int downloads = 0;
                if (downloadsByVersion != null)
                {
                    downloads = downloadsByVersion[versionStr];
                }

                result.VersionDetails.Add(new VersionDetail
                {
                    Version = versionStr,
                    Downloads = downloads,
                    IsStable = !registrationEntry.Version.IsPrerelease,
                    IsListed = registrationEntry.IsListed
                });
            }

            return result;
        }
Exemplo n.º 2
0
        public DownloadsByVersion this[int docId]
        {
            get
            {
                DownloadsByVersion result = null;
                _byDocId.TryGetValue(docId, out result);

                return(result);
            }

            set
            {
                _byDocId[docId] = value;
            }
        }
Exemplo n.º 3
0
        public DownloadsByVersion this[string packageId]
        {
            get
            {
                DownloadsByVersion result = null;
                _downloads.TryGetValue(packageId, out result);

                return(result);
            }

            set
            {
                _downloads[packageId] = value;
            }
        }
Exemplo n.º 4
0
        private VersionResult CreateVersionResult(string id, List <RegistrationEntry> registrationEntries, DownloadsByVersion downloadsByVersion)
        {
            VersionResult result = new VersionResult();

            foreach (var registrationEntry in registrationEntries.OrderBy(r => r.Version))
            {
                string fullVersion       = String.Intern(registrationEntry.Version.ToFullString());
                string normalizedVersion = String.Intern(registrationEntry.Version.ToNormalizedString());

                int downloads = 0;
                if (downloadsByVersion != null)
                {
                    downloads = downloadsByVersion[normalizedVersion];
                }

                result.AllVersionDetails.Add(new VersionDetail
                {
                    NormalizedVersion = normalizedVersion,
                    FullVersion       = fullVersion,
                    Downloads         = downloads,
                    IsStable          = !registrationEntry.Version.IsPrerelease,
                    IsListed          = registrationEntry.IsListed,
                    IsSemVer2         = registrationEntry.Version.IsSemVer2
                });
            }

            return(result);
        }