コード例 #1
0
        public VerifyPackageRequest(PackageMetadata packageMetadata, IEnumerable <User> possibleOwners)
        {
            Id                   = packageMetadata.Id;
            Version              = packageMetadata.Version.ToFullStringSafe();
            OriginalVersion      = packageMetadata.Version.OriginalVersion;
            HasSemVer2Version    = packageMetadata.Version.IsSemVer2;
            HasSemVer2Dependency = packageMetadata.GetDependencyGroups().Any(d => d.Packages.Any(
                                                                                 p => (p.VersionRange.HasUpperBound && p.VersionRange.MaxVersion.IsSemVer2) ||
                                                                                 (p.VersionRange.HasLowerBound && p.VersionRange.MinVersion.IsSemVer2)));

            // Verifiable fields
            Language = packageMetadata.Language;
            MinClientVersionDisplay  = packageMetadata.MinClientVersion.ToFullStringSafe();
            FrameworkReferenceGroups = packageMetadata.GetFrameworkReferenceGroups();
            Dependencies             = new DependencySetsViewModel(packageMetadata.GetDependencyGroups().AsPackageDependencyEnumerable());
            DevelopmentDependency    = packageMetadata.GetValueFromMetadata("developmentDependency");
            Authors      = packageMetadata.Authors.Flatten();
            Copyright    = packageMetadata.Copyright;
            Description  = packageMetadata.Description;
            IconUrl      = packageMetadata.IconUrl.ToEncodedUrlStringOrNull();
            LicenseUrl   = packageMetadata.LicenseUrl.ToEncodedUrlStringOrNull();
            ProjectUrl   = packageMetadata.ProjectUrl.ToEncodedUrlStringOrNull();
            ReleaseNotes = packageMetadata.ReleaseNotes;
            RequiresLicenseAcceptance = packageMetadata.RequireLicenseAcceptance;
            Summary = packageMetadata.Summary;
            Tags    = PackageHelper.ParseTags(packageMetadata.Tags);
            Title   = packageMetadata.Title;

            // Editable server-state
            Listed = true;
            Edit   = new EditPackageVersionReadMeRequest();

            PossibleOwners = possibleOwners.Select(u => u.Username).ToList();
        }
コード例 #2
0
        public VerifyPackageRequest(PackageMetadata packageMetadata)
        {
            var dependencyGroups = packageMetadata.GetDependencyGroups();

            Id                   = packageMetadata.Id;
            Version              = packageMetadata.Version.ToFullStringSafe();
            OriginalVersion      = packageMetadata.Version.OriginalVersion;
            HasSemVer2Version    = packageMetadata.Version.IsSemVer2;
            HasSemVer2Dependency = dependencyGroups.Any(d => d.Packages.Any(
                                                            p => (p.VersionRange.HasUpperBound && p.VersionRange.MaxVersion.IsSemVer2) ||
                                                            (p.VersionRange.HasLowerBound && p.VersionRange.MinVersion.IsSemVer2)));
            LicenseUrl = packageMetadata.LicenseUrl.ToEncodedUrlStringOrNull();
            Listed     = true;
            Language   = packageMetadata.Language;
            MinClientVersionDisplay  = packageMetadata.MinClientVersion.ToFullStringSafe();
            FrameworkReferenceGroups = packageMetadata.GetFrameworkReferenceGroups();
            Dependencies             = new DependencySetsViewModel(packageMetadata.GetDependencyGroups().AsPackageDependencyEnumerable());
            DevelopmentDependency    = packageMetadata.GetValueFromMetadata("developmentDependency");
            Edit = new EditPackageVersionRequest(packageMetadata);
        }