private void ResolveDependencies()
        {
            var container = ServicesContainer.instance;

            m_Application = container.Resolve <ApplicationProxy>();
            m_IOProxy     = container.Resolve <IOProxy>();
        }
예제 #2
0
 public static string GetOfflineDocumentation(IOProxy IOProxy, IPackageVersion version)
 {
     if (version?.isAvailableOnDisk == true && version.packageInfo != null)
     {
         try
         {
             var docsFolder = IOProxy.PathsCombine(version.packageInfo.resolvedPath, "Documentation~");
             if (!IOProxy.DirectoryExists(docsFolder))
             {
                 docsFolder = IOProxy.PathsCombine(version.packageInfo.resolvedPath, "Documentation");
             }
             if (IOProxy.DirectoryExists(docsFolder))
             {
                 var mdFiles = IOProxy.DirectoryGetFiles(docsFolder, "*.md", System.IO.SearchOption.TopDirectoryOnly);
                 var docsMd  = mdFiles.FirstOrDefault(d => IOProxy.GetFileName(d).ToLower() == "index.md")
                               ?? mdFiles.FirstOrDefault(d => IOProxy.GetFileName(d).ToLower() == "tableofcontents.md") ?? mdFiles.FirstOrDefault();
                 if (!string.IsNullOrEmpty(docsMd))
                 {
                     return(docsMd);
                 }
             }
         }
         catch (System.IO.IOException) {}
     }
     return(string.Empty);
 }
예제 #3
0
        private void ResolveDependencies()
        {
            var container = ServicesContainer.instance;

            m_Selection     = container.Resolve <SelectionProxy>();
            m_AssetDatabase = container.Resolve <AssetDatabaseProxy>();
            m_IOProxy       = container.Resolve <IOProxy>();
        }
예제 #4
0
        public AssetStorePackage(AssetStoreUtils assetStoreUtils, IOProxy ioProxy, AssetStorePurchaseInfo purchaseInfo, AssetStoreProductInfo productInfo, AssetStoreLocalInfo localInfo = null)
        {
            ResolveDependencies(assetStoreUtils, ioProxy);

            m_Errors         = new List <UIError>();
            m_Progress       = PackageProgress.None;
            m_Type           = PackageType.AssetStore;
            m_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_UpmVersionList = new UpmVersionList();
            m_AssetStoreLink = productInfo?.assetStoreLink.url;

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

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

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

            if (string.IsNullOrEmpty(productInfo?.id) || string.IsNullOrEmpty(productInfo?.versionId))
            {
                AddError(new UIError(UIErrorCode.AssetStorePackageError, L10n.Tr("Invalid product details.")));
            }
            else
            {
                // The version we get from the product info the latest on the server
                // The version we get from the localInfo is the version publisher set when uploading the .unitypackage file
                // The publisher could update the version on the server but NOT upload a new .unitypackage file, that will
                // result in a case where localInfo and productInfo have different version numbers but no update is available
                // Because of this, we prefer showing version from the server (even when localInfo version is different)
                // and we only want to show the localInfo version when `localInfo.canUpdate` is set to true
                var latestVersion = new AssetStorePackageVersion(assetStoreUtils, ioProxy, productInfo);
                if (localInfo != null)
                {
                    if (localInfo.canUpdate)
                    {
                        m_VersionList.AddVersion(new AssetStorePackageVersion(assetStoreUtils, ioProxy, productInfo, localInfo));
                    }
                    else
                    {
                        latestVersion.SetLocalPath(localInfo.packagePath);
                        if (localInfo.canDowngrade)
                        {
                            var warningMessage = string.Format(k_IncompatibleWarningMessage, localInfo.supportedVersion);
                            AddError(new UIError(UIErrorCode.AssetStorePackageError, warningMessage, UIError.Attribute.IsWarning));
                        }
                    }
                }
                m_VersionList.AddVersion(latestVersion);
            }

            LinkPackageAndVersions();
        }
예제 #5
0
        public void ResolveDependencies(ApplicationProxy application, AssetStoreUtils assetStoreUtils, HttpClientFactory httpClientFactory, IOProxy systemIOProxy)
        {
            m_Application       = application;
            m_HttpClientFactory = httpClientFactory;
            m_IOProxy           = systemIOProxy;

            foreach (var productInfo in m_ProductInfos.Values)
            {
                productInfo.ResolveDependencies(assetStoreUtils);
            }
        }
예제 #6
0
 public void ResolveDependencies(AssetStoreUtils assetStoreUtils, IOProxy ioProxy)
 {
     if (m_Versions == null)
     {
         return;
     }
     foreach (var version in m_Versions)
     {
         version.ResolveDependencies(assetStoreUtils, ioProxy);
     }
 }
예제 #7
0
 public static string GetOfflineLicenses(IOProxy IOProxy, IPackageVersion version)
 {
     if (version?.isAvailableOnDisk == true && version.packageInfo != null)
     {
         try
         {
             var licenseFile = IOProxy.PathsCombine(version.packageInfo.resolvedPath, "LICENSE.md");
             return(IOProxy.FileExists(licenseFile) ? licenseFile : string.Empty);
         }
         catch (System.IO.IOException) {}
     }
     return(string.Empty);
 }
예제 #8
0
 public static string GetOfflineChangelog(IOProxy IOProxy, IPackageVersion version)
 {
     if (version?.isAvailableOnDisk == true && version.packageInfo != null)
     {
         try
         {
             var changelogFile = IOProxy.PathsCombine(version.packageInfo.resolvedPath, "CHANGELOG.md");
             return(IOProxy.FileExists(changelogFile) ? changelogFile : string.Empty);
         }
         catch (System.IO.IOException) {}
     }
     return(string.Empty);
 }
예제 #9
0
        private void ResolveDependencies()
        {
            var container = ServicesContainer.instance;

            m_ResourceLoader            = container.Resolve <ResourceLoader>();
            m_Application               = container.Resolve <ApplicationProxy>();
            m_UnityConnect              = container.Resolve <UnityConnectProxy>();
            m_PackageFiltering          = container.Resolve <PackageFiltering>();
            m_PackageDatabase           = container.Resolve <PackageDatabase>();
            m_PageManager               = container.Resolve <PageManager>();
            m_UpmClient                 = container.Resolve <UpmClient>();
            m_AssetStoreDownloadManager = container.Resolve <AssetStoreDownloadManager>();
            m_SettingsProxy             = container.Resolve <PackageManagerProjectSettingsProxy>();
            m_IOProxy = container.Resolve <IOProxy>();
        }
예제 #10
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();
        }
예제 #11
0
        public void ResolveDependencies(UnityConnectProxy unityConnect,
                                        AssetStoreCache assetStoreCache,
                                        AssetStoreUtils assetStoreUtils,
                                        AssetStoreRestAPI assetStoreRestAPI,
                                        UpmClient upmClient,
                                        IOProxy ioProxy)
        {
            m_UnityConnect      = unityConnect;
            m_AssetStoreCache   = assetStoreCache;
            m_AssetStoreUtils   = assetStoreUtils;
            m_AssetStoreRestAPI = assetStoreRestAPI;
            m_UpmClient         = upmClient;
            m_IOProxy           = ioProxy;

            m_ListOperation?.ResolveDependencies(unityConnect, assetStoreRestAPI, assetStoreCache);
        }
예제 #12
0
        private void ResolveDependencies()
        {
            var container = ServicesContainer.instance;

            m_ResourceLoader      = container.Resolve <ResourceLoader>();
            m_SettingsProxy       = container.Resolve <PackageManagerProjectSettingsProxy>();
            m_PackageDatabase     = container.Resolve <PackageDatabase>();
            m_PackageManagerPrefs = container.Resolve <PackageManagerPrefs>();
            m_Selection           = container.Resolve <SelectionProxy>();
            m_AssetDatabase       = container.Resolve <AssetDatabaseProxy>();
            m_Application         = container.Resolve <ApplicationProxy>();
            m_IOProxy             = container.Resolve <IOProxy>();
            m_AssetStoreCache     = container.Resolve <AssetStoreCache>();
            m_PageManager         = container.Resolve <PageManager>();
            m_UpmCache            = container.Resolve <UpmCache>();
        }
예제 #13
0
        public PackageDetailsVersionsTab(ResourceLoader resourceLoader,
                                         ApplicationProxy applicationProxyProxy,
                                         PackageManagerPrefs packageManagerPrefs,
                                         PackageDatabase packageDatabase,
                                         PageManager pageManager,
                                         PackageManagerProjectSettingsProxy settingsProxy,
                                         UpmCache upmCache,
                                         IOProxy ioProxy)
        {
            m_Id                  = k_Id;
            m_DisplayName         = L10n.Tr("Version History");
            m_ResourceLoader      = resourceLoader;
            m_ApplicationProxy    = applicationProxyProxy;
            m_PackageManagerPrefs = packageManagerPrefs;
            m_PackageDatabase     = packageDatabase;
            m_PageManager         = pageManager;
            m_SettingsProxy       = settingsProxy;
            m_UpmCache            = upmCache;
            m_IOProxy             = ioProxy;

            m_DisableIfCompiling = new ButtonDisableCondition(() => m_ApplicationProxy.isCompiling,
                                                              L10n.Tr("You need to wait until the compilation is finished to perform this action."));
            m_DisableIfInstallOrUninstallInProgress = new ButtonDisableCondition(() => m_PackageDatabase.isInstallOrUninstallInProgress,
                                                                                 L10n.Tr("You need to wait until other install or uninstall operations are finished to perform this action."));

            m_Container = new VisualElement {
                name = "versionsTab"
            };
            Add(m_Container);

            m_VersionHistoryList = new VisualElement {
                name = "versionsList"
            };
            m_Container.Add(m_VersionHistoryList);

            m_VersionsToolbar = new VisualElement {
                name = "versionsToolbar"
            };
            m_Container.Add(m_VersionsToolbar);

            m_VersionsShowOthersButton = new Button {
                name = "versionsShowAllButton", text = L10n.Tr("See other versions")
            };
            m_VersionsToolbar.Add(m_VersionsShowOthersButton);

            m_VersionsShowOthersButton.clickable.clicked += ShowOthersVersion;
        }
        public ServicesContainer()
        {
            // In the constructor we only need to worry about creating a brand new instance.
            // In the case of assembly reload, a deserialize step will automatically happen after the constructor
            // to restore all the serializable states/services and we don't need to worry about that
            m_HttpClientFactory    = new HttpClientFactory();
            m_UnityOAuthProxy      = new UnityOAuthProxy();
            m_SelectionProxy       = new SelectionProxy();
            m_AssetDatabaseProxy   = new AssetDatabaseProxy();
            m_UnityConnectProxy    = new UnityConnectProxy();
            m_ApplicationProxy     = new ApplicationProxy();
            m_EditorAnalyticsProxy = new EditorAnalyticsProxy();
            m_IOProxy       = new IOProxy();
            m_SettingsProxy = new PackageManagerProjectSettingsProxy();
            m_ClientProxy   = new ClientProxy();

            m_ResourceLoader   = new ResourceLoader();
            m_ExtensionManager = new ExtensionManager();

            m_AssetStoreCache           = new AssetStoreCache();
            m_AssetStoreClient          = new AssetStoreClient();
            m_AssetStoreOAuth           = new AssetStoreOAuth();
            m_AssetStoreUtils           = new AssetStoreUtils();
            m_AssetStoreRestAPI         = new AssetStoreRestAPI();
            m_AssetStoreDownloadManager = new AssetStoreDownloadManager();
            m_AssetStoreCallQueue       = new AssetStoreCallQueue();
            m_AssetStoreCachePathProxy  = new AssetStoreCachePathProxy();

            m_UpmCache           = new UpmCache();
            m_UpmClient          = new UpmClient();
            m_UpmRegistryClient  = new UpmRegistryClient();
            m_UpmCacheRootClient = new UpmCacheRootClient();

            m_PackageFiltering    = new PackageFiltering();
            m_PackageManagerPrefs = new PackageManagerPrefs();

            m_PackageDatabase = new PackageDatabase();
            m_PageManager     = new PageManager();

            // Since dictionaries doesn't survive through serialization, we always re-create the default registration
            m_RegisteredObjects = new Dictionary <Type, object>();
            RegisterDefaultServices();

            m_DependenciesResolved = false;
            m_InitializeState      = State.NotInitialized;
        }
        public PackageDetailsSampleItem(IPackageVersion version, Sample sample, SelectionProxy selection, AssetDatabaseProxy assetDatabase, ApplicationProxy application, IOProxy iOProxy)
        {
            m_Selection        = selection;
            m_AssetDatabase    = assetDatabase;
            m_ApplicationProxy = application;
            m_IOProxy          = iOProxy;

            m_Version         = version;
            m_Sample          = sample;
            nameLabel.text    = sample.displayName;
            nameLabel.tooltip = sample.displayName; // add tooltip for when the label text is cut off
            sizeLabel.text    = sample.size;
            descriptionLabel.SetValueWithoutNotify(sample.description);
            descriptionLabel.multiline = true;
            RefreshImportStatus();
            importButton.clickable.clicked += OnImportButtonClicked;
        }
예제 #16
0
        public PackageDetailsSamplesTab(ResourceLoader resourceLoader, PackageDatabase packageDatabase, SelectionProxy selection, AssetDatabaseProxy assetDatabase, ApplicationProxy application, IOProxy iOProxy)
        {
            m_Id              = k_Id;
            m_DisplayName     = L10n.Tr("Samples");
            m_ResourceLoader  = resourceLoader;
            m_PackageDatabase = packageDatabase;
            m_Selection       = selection;
            m_AssetDatabase   = assetDatabase;
            m_Application     = application;
            m_IOProxy         = iOProxy;

            var root = m_ResourceLoader.GetTemplate("PackageDetailsSamplesTab.uxml");

            Add(root);
            m_Cache = new VisualElementCache(root);

            RegisterCallback <GeometryChangedEvent>(OnGeometryChanged);
        }
예제 #17
0
        public void ResolveDependencies(UpmCache upmCache,
                                        IOProxy IOProxy,
                                        PackageManagerProjectSettingsProxy settingsProxy,
                                        ClientProxy clientProxy,
                                        ApplicationProxy applicationProxy)
        {
            m_UpmCache         = upmCache;
            m_IOProxy          = IOProxy;
            m_SettingsProxy    = settingsProxy;
            m_ClientProxy      = clientProxy;
            m_ApplicationProxy = applicationProxy;

            m_SearchOperation?.ResolveDependencies(m_ClientProxy, m_ApplicationProxy);
            m_SearchOfflineOperation?.ResolveDependencies(m_ClientProxy, m_ApplicationProxy);
            m_ListOperation?.ResolveDependencies(m_ClientProxy, m_ApplicationProxy);
            m_ListOfflineOperation?.ResolveDependencies(m_ClientProxy, m_ApplicationProxy);
            m_AddOperation?.ResolveDependencies(m_ClientProxy, m_ApplicationProxy);
            m_RemoveOperation?.ResolveDependencies(m_ClientProxy, m_ApplicationProxy);
            m_EmbedOperation?.ResolveDependencies(m_ClientProxy, m_ApplicationProxy);
            m_AddAndRemoveOperation?.ResolveDependencies(m_ClientProxy, m_ApplicationProxy);
        }
        public PackageDetailsVersionHistoryItem(ResourceLoader resourceLoader,
                                                PackageDatabase packageDatabase,
                                                UpmCache upmCache,
                                                ApplicationProxy applicationProxy,
                                                IOProxy ioProxy,
                                                IPackageVersion version,
                                                bool multipleVersionsVisible,
                                                bool isLatestVersion,
                                                bool expanded,
                                                PackageToolBarRegularButton button)
        {
            m_Version          = version;
            m_PackageDatabase  = packageDatabase;
            m_UpmCache         = upmCache;
            m_ApplicationProxy = applicationProxy;
            m_IOProxy          = ioProxy;

            var root = resourceLoader.GetTemplate("PackageDetailsVersionHistoryItem.uxml");

            Add(root);
            m_Cache = new VisualElementCache(root);

            SetExpanded(expanded);
            versionHistoryItemToggle.RegisterValueChangedCallback(evt =>
            {
                SetExpanded(evt.newValue);
                onToggleChanged?.Invoke(evt.newValue);
            });

            m_Button = button;
            if (m_Button != null)
            {
                versionHistoryItemToggleRightContainer.Add(m_Button.element);
            }

            versionHistoryItemChangeLogLink.clickable.clicked += () => UpmPackageDocs.ViewUrl(UpmPackageDocs.GetChangelogUrl(m_Version), UpmPackageDocs.GetOfflineChangelog(m_IOProxy, m_Version), L10n.Tr("changelog"), "viewChangelog", m_Version, m_Version.package, m_ApplicationProxy);

            Refresh(multipleVersionsVisible, isLatestVersion);
        }
예제 #19
0
        public AssetStorePackage(AssetStoreUtils assetStoreUtils, IOProxy ioProxy, string productId, UIError error)
        {
            ResolveDependencies(assetStoreUtils, ioProxy);

            m_Errors = new List <UIError> {
                error
            };
            m_Progress  = PackageProgress.None;
            m_Type      = PackageType.AssetStore;
            m_Name      = string.Empty;
            m_ProductId = productId;

            m_Images         = new List <PackageImage>();
            m_Links          = new List <PackageLink>();
            m_VersionList    = new AssetStoreVersionList(assetStoreUtils, ioProxy);
            m_UpmVersionList = new UpmVersionList();

            m_Labels             = new List <string>();
            m_PurchasedTimeTicks = 0;

            LinkPackageAndVersions();
        }
예제 #20
0
        public void ResolveDependencies(ApplicationProxy application,
                                        HttpClientFactory httpClientFactory,
                                        UnityConnectProxy unityConnect,
                                        IOProxy ioProxy,
                                        AssetStoreCache assetStoreCache,
                                        AssetStoreUtils assetStoreUtils,
                                        AssetStoreRestAPI assetStoreRestAPI,
                                        AssetStoreCachePathProxy assetStoreCachePathProxy)
        {
            m_Application              = application;
            m_UnityConnect             = unityConnect;
            m_IOProxy                  = ioProxy;
            m_HttpClientFactory        = httpClientFactory;
            m_AssetStoreCache          = assetStoreCache;
            m_AssetStoreUtils          = assetStoreUtils;
            m_AssetStoreRestAPI        = assetStoreRestAPI;
            m_AssetStoreCachePathProxy = assetStoreCachePathProxy;

            foreach (var operation in m_DownloadOperations.Values)
            {
                operation.ResolveDependencies(assetStoreUtils, assetStoreRestAPI, m_AssetStoreCachePathProxy);
            }
        }
        public PackageDependencySampleItemLowWidth(ResourceLoader resourceLoader, IPackageVersion version, Sample sample, SelectionProxy selection, AssetDatabaseProxy assetDatabase, ApplicationProxy application, IOProxy iOProxy)
        {
            var root = resourceLoader.GetTemplate("PackageDependencySampleItemLowWidth.uxml");

            Add(root);

            cache = new VisualElementCache(root);

            var sampleItem = new PackageDetailsSampleItem(version, sample, selection, assetDatabase, application, iOProxy);

            sampleItem.importButton.SetEnabled(version.isInstalled);

            var name        = sampleItem.nameLabel.text;
            var size        = sampleItem.sizeLabel.text;
            var description = sampleItem.descriptionLabel.text;

            itemName.text    = name;
            itemName.tooltip = name;

            sampleStatus.Add(sampleItem.importStatus);

            itemSizeOrVersion.value   = size;
            itemSizeOrVersion.tooltip = size;

            importButtonContainer.Add(sampleItem.importButton);

            if (!string.IsNullOrEmpty(description))
            {
                UIUtils.SetElementDisplay(sampleDescription, true);
                sampleDescription.SetValueWithoutNotify(description);
            }
            else
            {
                UIUtils.SetElementDisplay(sampleDescription, false);
            }
        }
예제 #22
0
 public static string GetOfflineUseCasesUrl(IOProxy IOProxy, IPackageVersion version)
 {
     return(string.Empty);
 }
예제 #23
0
        public AssetStoreVersionList(AssetStoreUtils assetStoreUtils, IOProxy ioProxy)
        {
            ResolveDependencies(assetStoreUtils, ioProxy);

            m_Versions = new List <AssetStorePackageVersion>();
        }
예제 #24
0
 public static string GetOfflineDashboardUrl(IOProxy IOProxy, IPackageVersion version)
 {
     return(string.Empty);
 }
예제 #25
0
 public void ResolveDependencies(AssetStoreUtils assetStoreUtils, IOProxy ioProxy)
 {
     m_VersionList?.ResolveDependencies(assetStoreUtils, ioProxy);
 }
예제 #26
0
 public void ResolveDependencies(AssetStoreUtils assetStoreUtils, IOProxy ioProxy)
 {
     m_AssetStoreUtils = assetStoreUtils;
     m_IOProxy         = ioProxy;
 }
예제 #27
0
        public AssetStorePackageVersion(AssetStoreUtils assetStoreUtils, IOProxy ioProxy, AssetStoreProductInfo productInfo, AssetStoreLocalInfo localInfo = null)
        {
            if (productInfo == null)
            {
                throw new ArgumentNullException(nameof(productInfo));
            }

            ResolveDependencies(assetStoreUtils, ioProxy);

            m_Errors          = new List <UIError>();
            m_Tag             = PackageTag.Downloadable | PackageTag.Importable;
            m_PackageUniqueId = productInfo.id;

            m_Description = productInfo.description;
            m_Author      = productInfo.author;
            m_PublisherId = productInfo.publisherId;

            m_Category = productInfo.category;

            m_PublishNotes = localInfo?.publishNotes ?? productInfo.publishNotes ?? string.Empty;

            m_VersionString = localInfo?.versionString ?? productInfo.versionString ?? string.Empty;
            m_VersionId     = localInfo?.versionId ?? productInfo.versionId ?? string.Empty;
            SemVersionParser.TryParse(m_VersionString.Trim(), out m_Version);

            var publishDateString = localInfo?.publishedDate ?? productInfo.publishedDate ?? string.Empty;

            m_PublishedDateTicks = !string.IsNullOrEmpty(publishDateString) ? DateTime.Parse(publishDateString).Ticks : 0;
            m_DisplayName        = !string.IsNullOrEmpty(productInfo.displayName) ? productInfo.displayName : $"Package {m_PackageUniqueId}@{m_VersionId}";

            m_SupportedUnityVersions = new List <SemVersion>();
            if (localInfo != null)
            {
                var simpleVersion = Regex.Replace(localInfo.supportedVersion, @"(?<major>\d+)\.(?<minor>\d+).(?<patch>\d+)[abfp].+", "${major}.${minor}.${patch}");
                SemVersionParser.TryParse(simpleVersion.Trim(), out m_SupportedUnityVersion);
                m_SupportedUnityVersionString = m_SupportedUnityVersion?.ToString();
            }
            else if (productInfo.supportedVersions?.Any() ?? false)
            {
                foreach (var supportedVersion in productInfo.supportedVersions)
                {
                    SemVersion?version;
                    bool       isVersionParsed = SemVersionParser.TryParse(supportedVersion, out version);

                    if (isVersionParsed)
                    {
                        m_SupportedUnityVersions.Add((SemVersion)version);
                    }
                }

                m_SupportedUnityVersions.Sort((left, right) => (left).CompareTo(right));
                m_SupportedUnityVersion       = m_SupportedUnityVersions.LastOrDefault();
                m_SupportedUnityVersionString = m_SupportedUnityVersion?.ToString();
            }

            m_SizeInfos = new List <PackageSizeInfo>(productInfo.sizeInfos);
            m_SizeInfos.Sort((left, right) => left.supportedUnityVersion.CompareTo(right.supportedUnityVersion));

            var state = productInfo.state ?? string.Empty;

            if (state.Equals("published", StringComparison.InvariantCultureIgnoreCase))
            {
                m_Tag |= PackageTag.Published;
            }
            else if (state.Equals("deprecated", StringComparison.InvariantCultureIgnoreCase))
            {
                m_Tag |= PackageTag.Deprecated;
            }
            else if (state.Equals("disabled", StringComparison.InvariantCultureIgnoreCase))
            {
                m_Tag |= PackageTag.Disabled;
            }

            SetLocalPath(localInfo?.packagePath);
        }