コード例 #1
0
 internal virtual bool PreInstall(PackageItem packageItem)
 {
     return(true);
 }
コード例 #2
0
        internal bool YieldPackage(PackageItem pkg, string searchKey)
        {
            try {
                if (YieldSoftwareIdentity(pkg.FastPath, pkg.Package.Id, pkg.Package.Version.ToString(), "semver", pkg.Package.Summary, pkg.PackageSource.Name, searchKey, pkg.FullPath, pkg.PackageFilename))
                {
                    if (!YieldSoftwareMetadata(pkg.FastPath, "copyright", pkg.Package.Copyright))
                    {
                        return(false);
                    }
                    if (!YieldSoftwareMetadata(pkg.FastPath, "description", pkg.Package.Description))
                    {
                        return(false);
                    }
                    if (!YieldSoftwareMetadata(pkg.FastPath, "language", pkg.Package.Language))
                    {
                        return(false);
                    }
                    if (!YieldSoftwareMetadata(pkg.FastPath, "releaseNotes", pkg.Package.ReleaseNotes))
                    {
                        return(false);
                    }
                    if (pkg.Package.Published != null)
                    {
                        // published time.
                        if (!YieldSoftwareMetadata(pkg.FastPath, "published", pkg.Package.Published.ToString()))
                        {
                            return(false);
                        }
                    }
                    if (!YieldSoftwareMetadata(pkg.FastPath, "tags", pkg.Package.Tags))
                    {
                        return(false);
                    }
                    if (!YieldSoftwareMetadata(pkg.FastPath, "title", pkg.Package.Title))
                    {
                        return(false);
                    }
                    if (!YieldSoftwareMetadata(pkg.FastPath, "developmentDependency", pkg.Package.DevelopmentDependency.ToString()))
                    {
                        return(false);
                    }
                    if (!YieldSoftwareMetadata(pkg.FastPath, "FromTrustedSource", pkg.PackageSource.Trusted.ToString()))
                    {
                        return(false);
                    }
                    if (pkg.Package.LicenseUrl != null && !String.IsNullOrEmpty(pkg.Package.LicenseUrl.ToString()))
                    {
                        if (!YieldLink(pkg.FastPath, pkg.Package.LicenseUrl.ToString(), "license", null, null, null, null, null))
                        {
                            return(false);
                        }
                    }
                    if (pkg.Package.ProjectUrl != null && !String.IsNullOrEmpty(pkg.Package.ProjectUrl.ToString()))
                    {
                        if (!YieldLink(pkg.FastPath, pkg.Package.ProjectUrl.ToString(), "project", null, null, null, null, null))
                        {
                            return(false);
                        }
                    }
                    if (pkg.Package.ReportAbuseUrl != null && !String.IsNullOrEmpty(pkg.Package.ReportAbuseUrl.ToString()))
                    {
                        if (!YieldLink(pkg.FastPath, pkg.Package.ReportAbuseUrl.ToString(), "abuse", null, null, null, null, null))
                        {
                            return(false);
                        }
                    }
                    if (pkg.Package.IconUrl != null && !String.IsNullOrEmpty(pkg.Package.IconUrl.ToString()))
                    {
                        if (!YieldLink(pkg.FastPath, pkg.Package.IconUrl.ToString(), "icon", null, null, null, null, null))
                        {
                            return(false);
                        }
                    }
                    if (pkg.Package.Authors.Any(author => !YieldEntity(pkg.FastPath, author.Trim(), author.Trim(), "author", null)))
                    {
                        return(false);
                    }

                    if (pkg.Package.Owners.Any(owner => !YieldEntity(pkg.FastPath, owner.Trim(), owner.Trim(), "owner", null)))
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            } catch (Exception e) {
                e.Dump(this);
                return(false);
            }
            return(true);
        }