Ejemplo n.º 1
0
        private UpmPackage CreateUpmPackage(PackageInfo searchInfo, PackageInfo installedInfo, string packageName = null)
        {
            if (searchInfo == null && installedInfo == null)
            {
                return(new UpmPackage(packageName, false, PackageType.Installable));
            }

            UpmPackage result;

            if (searchInfo == null)
            {
                result = new UpmPackage(installedInfo, true, false, IsUnityPackage(installedInfo));

                var registryInfo       = installedInfo.registry;
                var compatibleVersions = installedInfo.versions?.compatible;
            }
            else
            {
                var isUnityPackage = IsUnityPackage(searchInfo);
                result = new UpmPackage(searchInfo, false, true, isUnityPackage);
                if (installedInfo != null)
                {
                    result.AddInstalledVersion(new UpmPackageVersion(installedInfo, true, isUnityPackage));
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
        private static void FilterVersions(UpmPackage package, bool showPreRelease)
        {
            var versions          = (UpmVersionList)package.versions;
            var packageTagsToKeep = PackageTag.Release | PackageTag.ReleaseCandidate;

            if (showPreRelease || package.versions.installed?.HasTag(PackageTag.PreRelease | PackageTag.Experimental) == true)
            {
                packageTagsToKeep |= PackageTag.PreRelease;
            }

            // should see updates to the installed experimental packages, if they exist
            if (package.versions.installed?.HasTag(PackageTag.Experimental) == true)
            {
                packageTagsToKeep |= PackageTag.Experimental;
            }

            var filteredVersions = versions.Where(v => v.isInstalled || v.HasTag(packageTagsToKeep)).ToList();

            package.UpdateVersions(filteredVersions.Cast <UpmPackageVersion>());
        }
Ejemplo n.º 3
0
        public AssetStorePackage(AssetStoreUtils assetStoreUtils, IOProxy ioProxy, AssetStorePurchaseInfo purchaseInfo, AssetStoreProductInfo productInfo, UpmPackage package)
        {
            ResolveDependencies(assetStoreUtils, ioProxy);

            m_Errors    = new List <UIError>();
            m_Progress  = PackageProgress.None;
            m_Type      = PackageType.AssetStore;
            m_Name      = package?.name ?? string.Empty;
            m_ProductId = productInfo?.id.ToString();

            m_Images      = productInfo?.images ?? new List <PackageImage>();
            m_Links       = productInfo?.links ?? new List <PackageLink>();
            m_VersionList = new AssetStoreVersionList(assetStoreUtils, ioProxy);

            m_Labels             = purchaseInfo?.tags;
            m_IsHidden           = purchaseInfo?.isHidden == true;
            m_PurchasedTimeTicks = !string.IsNullOrEmpty(purchaseInfo?.purchasedTime) ? DateTime.Parse(purchaseInfo?.purchasedTime).Ticks : 0;

            m_UpmVersionList = package?.versions as UpmVersionList ?? new UpmVersionList();
            if (productInfo != null)
            {
                foreach (var version in m_UpmVersionList.Cast <UpmPackageVersion>())
                {
                    version.UpdateProductInfo(productInfo);
                }
            }

            m_AssetStoreLink = productInfo?.assetStoreLink.url;

            var firstPublishedDateString = productInfo?.firstPublishedDate ?? string.Empty;

            m_FirstPublishedDateTicks = !string.IsNullOrEmpty(firstPublishedDateString) ? DateTime.Parse(firstPublishedDateString).Ticks : 0;

            if (purchaseInfo == null)
            {
                AddError(new UIError(UIErrorCode.AssetStorePackageError, L10n.Tr("Unable to get asset purchase details because you may not have purchased this package.")));
            }
            if (string.IsNullOrEmpty(productInfo?.id) || string.IsNullOrEmpty(productInfo?.versionId))
            {
                AddError(new UIError(UIErrorCode.AssetStorePackageError, L10n.Tr("Unable to retrieve asset product details.")));
            }
            else if (string.IsNullOrEmpty(package?.name))
            {
                AddError(new UIError(UIErrorCode.AssetStorePackageError, L10n.Tr("Unable to retrieve asset package info.")));
            }

            LinkPackageAndVersions();
        }