Example #1
0
        private string GetPackageSize(CatalogUpdate package)
        {
            string unit = string.Empty;

            if (package.SDP.InstallableItems != null && package.SDP.InstallableItems.Count != 0)
            {
                long size = package.SDP.InstallableItems[0].OriginalSourceFile.Size;
                if (size > 1024)
                {
                    size /= 1024;
                    unit  = " KB";
                }
                if (size > 1024)
                {
                    size /= 1024;
                    unit  = " MB";
                }
                if (size > 1024)
                {
                    size /= 1024;
                    unit  = " GB";
                }

                return(size.ToString() + unit);
            }

            return(string.Empty);
        }
        private void ParseSDP(List <SoftwareDistributionPackage> extractedSDP)
        {
            Logger.EnteringMethod(extractedSDP.Count.ToString());

            foreach (SoftwareDistributionPackage sdp in extractedSDP)
            {
                if (sdp != null)
                {
                    CatalogUpdate newUpdate = new CatalogUpdate(sdp);
                    CatalogVendor newVendor;
                    if (Vendors.ContainsKey(sdp.VendorName))
                    {
                        newVendor = Vendors[sdp.VendorName];
                    }
                    else
                    {
                        newVendor = new CatalogVendor(sdp.VendorName);
                        Vendors.Add(sdp.VendorName, newVendor);
                    }
                    CatalogProduct newProduct;
                    if (newVendor.Products.ContainsKey(sdp.ProductNames[0]))
                    {
                        newProduct = newVendor.Products[sdp.ProductNames[0]];
                    }
                    else
                    {
                        newProduct = new CatalogProduct(sdp.ProductNames[0]);
                        newVendor.AddProduct(newProduct);
                    }
                    newProduct.AddUpdate(newUpdate);
                }
            }
        }
Example #3
0
        private void FillUpdateInformations(CatalogUpdate updateToDisplay)
        {
            txtBxVendorName.Text         = updateToDisplay.VendorName;
            txtBxProductName.Text        = updateToDisplay.ProductName;
            txtBxTitle.Text              = updateToDisplay.Title;
            txtBxDescription.Text        = updateToDisplay.Description;
            txtBxSupportUrl.Text         = updateToDisplay.SupportUrl;
            txtBxSecurityBulletinId.Text = updateToDisplay.SecurityBulletinId;
            txtBxSecurityRating.Text     = updateToDisplay.SecurityRating;
            txtBxPackageId.Text          = updateToDisplay.PackageId;
            txtBxSize.Text       = GetPackageSize(updateToDisplay);
            dtCreationDate.Value = updateToDisplay.CreationDate;

            cmbBxAdditionnalInformation.Items.Clear();
            foreach (Uri url in updateToDisplay.AdditionnalInformationsUrls)
            {
                cmbBxAdditionnalInformation.Items.Add(url.ToString());
            }
            if (cmbBxAdditionnalInformation.Items.Count != 0)
            {
                cmbBxAdditionnalInformation.SelectedIndex = 0;
            }
            cmbBxCVE.Items.Clear();
            foreach (string cve in updateToDisplay.CveIds)
            {
                cmbBxCVE.Items.Add(cve);
            }
            if (cmbBxCVE.Items.Count != 0)
            {
                cmbBxCVE.SelectedIndex = 0;
            }
            cmbBxLanguages.Items.Clear();
            foreach (string langue in updateToDisplay.Languages)
            {
                cmbBxLanguages.Items.Add(langue);
            }
            if (cmbBxLanguages.Items.Count != 0)
            {
                cmbBxLanguages.SelectedIndex = 0;
            }

            cmbBxPrerequisites.Items.Clear();
            if (updateToDisplay.SDP.Prerequisites != null && updateToDisplay.SDP.Prerequisites.Count != 0)
            {
                string prerequisiteName = string.Empty;
                foreach (Guid prerequisite in updateToDisplay.SDP.Prerequisites[0].Ids)
                {
                    prerequisiteName = GetPrerequisiteName(prerequisite);
                    cmbBxPrerequisites.Items.Add(prerequisiteName == string.Empty ? prerequisite.ToString() : prerequisiteName);
                }
                if (cmbBxPrerequisites.Items.Count != 0)
                {
                    cmbBxPrerequisites.SelectedIndex = 0;
                }
            }
        }
Example #4
0
 private void DisplayUpdateInformation(CatalogUpdate updateToDisplay)
 {
     if (!string.IsNullOrEmpty(updateToDisplay.VendorName))
     {
         txtBxVendor.Text = updateToDisplay.VendorName;
     }
     if (!string.IsNullOrEmpty(updateToDisplay.ProductName))
     {
         txtBxProduct.Text = updateToDisplay.ProductName;
     }
     if (!string.IsNullOrEmpty(updateToDisplay.Title))
     {
         txtBxTitle.Text = updateToDisplay.Title;
     }
     if (!string.IsNullOrEmpty(updateToDisplay.Description))
     {
         txtBxDescription.Text = updateToDisplay.Description;
     }
 }
Example #5
0
 internal void AddUpdate(CatalogUpdate updateToAdd)
 {
     Updates.Add(updateToAdd);
 }
 internal CatalogItem(CatalogUpdate update)
 {
     ItemType = CatalogItemTypes.Update;
     Update = update;
 }