Exemple #1
0
 public static V2FeedPackageInfo ToV2FeedPackageInfo(
     this NuspecReader reader, PackageDerivedData packageDerivedData, string downloadUrl, long downloadCount)
 {
     return(new V2FeedPackageInfo(
                identity: new PackageIdentity(reader.GetId(), reader.GetVersion()),
                title: reader.GetTitle(),
                summary: reader.GetSummary(),
                description: reader.GetDescription(),
                authors: reader.GetAuthors().Split(','),
                owners: reader.GetOwners().Split(','),
                iconUrl: reader.GetIconUrl(),
                licenseUrl: reader.GetLicenseUrl(),
                projectUrl: reader.GetProjectUrl(),
                reportAbuseUrl: reader.GetProjectUrl(),
                tags: reader.GetTags(),
                created: packageDerivedData.Created,
                lastEdited: packageDerivedData.LastUpdated,
                published: packageDerivedData.LastUpdated,
                dependencies: DependencySetsAsString(reader.GetDependencyGroups()),
                requireLicenseAccept: reader.GetRequireLicenseAcceptance(),
                downloadUrl: downloadUrl,
                downloadCount: downloadCount.ToString(),
                packageHash: packageDerivedData.PackageHash,
                packageHashAlgorithm: packageDerivedData.PackageHashAlgorithm,
                minClientVersion: reader.GetMinClientVersion()
                ));
 }
Exemple #2
0
 private void ProcessNuspecContent(NuspecReader reader)
 {
     if (Specification.Id == null)
     {
         Update(reader.GetId(), (id) => Specification.Id = id);
     }
     UpdateUrl(reader.GetLicenseUrl(), url => Specification.LicenseUrl    = url, DEFAULT_LICENCE_URL);
     UpdateUrl(reader.GetProjectUrl(), url => Specification.ProjectUrl    = url, DEFAULT_PROJECT_URL);
     UpdateUrl(reader.GetIconUrl(), url => Specification.IconUrl          = url, DEFAULT_ICON_URL);
     UpdateList(reader.GetAuthors(), list => Specification.Authors        = list);
     UpdateList(reader.GetOwners(), list => Specification.Owners          = list);
     Update(reader.GetReleaseNotes(), notes => Specification.ReleaseNotes = notes, DEFAULT_RELEASE_NOTES);
     Update(reader.GetCopyright(), copyright => Specification.Copyright   = copyright);
     UpdateList(reader.GetTags(), list => Specification.Tags           = list, ' ', DEFAULT_TAGS);
     Update(reader.GetDescription(), desc => Specification.Description = desc);
 }
Exemple #3
0
        public ServerPackage(NuspecReader package, PackageDerivedData packageDerivedData)
        {
            Id         = package.GetId();
            Version    = package.GetVersion();
            Title      = package.GetTitle();
            Authors    = package.GetAuthors();
            Owners     = package.GetOwners();
            IconUrl    = package.GetIconUrl();
            LicenseUrl = package.GetLicenseUrl();
            ProjectUrl = package.GetProjectUrl();
            RequireLicenseAcceptance = package.GetRequireLicenseAcceptance();
            DevelopmentDependency    = package.GetDevelopmentDependency();
            Description             = package.GetDescription();
            Summary                 = package.GetSummary();
            ReleaseNotes            = package.GetReleaseNotes();
            Language                = package.GetLanguage();
            Tags                    = package.GetTags();
            Copyright               = package.GetCopyright();
            MinClientVersion        = package.GetMinClientVersion();
            ReportAbuseUrl          = null;
            DownloadCount           = 0;
            SemVer1IsAbsoluteLatest = false;
            SemVer1IsLatest         = false;
            SemVer2IsAbsoluteLatest = false;
            SemVer2IsLatest         = false;
            //FIXME is this OK?
            Listed = true;

            IsSemVer2 = IsPackageSemVer2(package);

            _dependencySets = package.GetDependencyGroups().ToList();
            Dependencies    = _dependencySets.DependencySetsAsString();

            _supportedFrameworks = package.GetFrameworkReferenceGroups().Select(f => f.TargetFramework).ToList();
            SupportedFrameworks  = string.Join("|", _supportedFrameworks.Select(f => f.GetFrameworkString()));

            PackageSize          = packageDerivedData.PackageSize;
            PackageHash          = packageDerivedData.PackageHash;
            PackageHashAlgorithm = packageDerivedData.PackageHashAlgorithm;
            LastUpdated          = packageDerivedData.LastUpdated;
            Created  = packageDerivedData.Created;
            Path     = packageDerivedData.Path;
            FullPath = packageDerivedData.FullPath;
        }
Exemple #4
0
        /// <summary>
        /// Points to an Icon, either Embedded Icon or IconUrl
        /// </summary>
        private Uri GetIconUri()
        {
            string embeddedIcon = _nuspec.GetIcon();

            if (embeddedIcon == null)
            {
                return(Convert(_nuspec.GetIconUrl()));
            }

            var baseUri = Convert(_package.Path);

            UriBuilder builder = new UriBuilder(baseUri)
            {
                Fragment = embeddedIcon
            };

            // get the special icon url
            return(builder.Uri);
        }