コード例 #1
0
        public WPIProduct GetWPIProductById(string productdId)
        {
            try
            {
                Log.WriteStart("GetWPIProductById");
                WpiHelper wpi = GetWpiFeed();

                Product    product    = wpi.GetWPIProductById(productdId);
                WPIProduct wpiProduct = ProductToWPIProduct(product);

                if (wpiProduct.ProductId == "HeliconZooModule")
                {
                    /*null string = HeliconZooModule in registry*/
                    CheckProductForUpdate("", wpiProduct);
                }

                Log.WriteEnd("GetWPIProductById");
                return(wpiProduct);
            }
            catch (Exception ex)
            {
                Log.WriteError("GetWPIProductById", ex);
                throw;
            }
        }
コード例 #2
0
        private void CheckProductForUpdate(string hostingPackageName, WPIProduct product)
        {
            string installedHostingPackageVersion = GetInstalledHostingPackageVersion(hostingPackageName);

            if (!string.IsNullOrEmpty(installedHostingPackageVersion))
            {
                //6
                //3.0.90.383
                if (CompareVersions(product.Version, installedHostingPackageVersion) > 0)
                {
                    product.IsUpgrade   = true;
                    product.IsInstalled = false;
                }
            }
        }
コード例 #3
0
        private WPIProduct ProductToWPIProduct(Product product)
        {
            WPIProduct p = new WPIProduct();

            p.ProductId       = product.ProductId;
            p.Summary         = product.Summary;
            p.LongDescription = Linkify(product.LongDescription);
            p.Published       = product.Published;
            p.Author          = product.Author;
            p.AuthorUri       = (product.AuthorUri != null) ? product.AuthorUri.ToString() : "";
            p.Title           = product.Title;
            p.Link            = (product.Link != null) ? product.Link.ToString() : "";
            p.Version         = product.Version;

            if (product.Installers.Count > 0)
            {
                if (product.Installers[0].EulaUrl != null)
                {
                    p.EulaUrl = product.Installers[0].EulaUrl.ToString();
                }

                if (product.Installers[0].InstallerFile != null)
                {
                    if (product.Installers[0].InstallerFile.InstallerUrl != null)
                    {
                        p.DownloadedLocation = product.Installers[0].InstallerFile.InstallerUrl.ToString();
                    }
                    p.FileSize = product.Installers[0].InstallerFile.FileSize;
                }
            }

            if (product.IconUrl != null)
            {
                p.Logo = product.IconUrl.ToString();
            }

            p.IsInstalled = product.IsInstalled(true);

            return(p);
        }