public static Color GetApplicationTreemapColor(ApplicationUninstallerEntry entry)
        {
            if (entry.UninstallerKind == UninstallerType.WindowsFeature)
            {
                return(WindowsFeatureColor);
            }

            if (entry.UninstallerKind == UninstallerType.StoreApp)
            {
                return(WindowsStoreAppColor);
            }

            if (entry.IsOrphaned)
            {
                return(UnregisteredColor);
            }

            if (!entry.IsValid)
            {
                return(InvalidColor);
            }

            if (Settings.Default.AdvancedTestCertificates)
            {
                var result = entry.IsCertificateValid(true);
                if (result.HasValue)
                {
                    return(result.Value
                        ? VerifiedColor
                        : UnverifiedColor);
                }
            }

            return(Color.White);
        }
Example #2
0
        private X509Certificate2 GetCert(ApplicationUninstallerEntry uninstaller)
        {
            var id = uninstaller.GetCacheId();

            if (_certificateCache.ContainsKey(id))
            {
                var cert = _certificateCache.GetCachedItem(id);
                uninstaller.SetCertificate(cert?.Cert, cert?.Valid ?? false);
                return(cert?.Cert);
            }
            else
            {
                var cert = uninstaller.GetCertificate();
                _certificateCache.AddItem(id, cert, uninstaller.IsCertificateValid(true) == true);
                return(cert);
            }
        }
        public static Color GetApplicationBackColor(ApplicationUninstallerEntry entry)
        {
            if (Settings.Default.AdvancedHighlightSpecial)
            {
                if (entry.UninstallerKind == UninstallerType.WindowsFeature)
                {
                    return(Colors.WindowsFeatureColor);
                }

                if (entry.UninstallerKind == UninstallerType.StoreApp)
                {
                    return(Colors.WindowsStoreAppColor);
                }

                if (entry.IsOrphaned)
                {
                    return(Colors.UnregisteredColor);
                }
            }

            if (!entry.IsValid && Settings.Default.AdvancedTestInvalid)
            {
                return(Colors.InvalidColor);
            }

            if (Settings.Default.AdvancedTestCertificates)
            {
                var result = entry.IsCertificateValid(true);
                if (result.HasValue)
                {
                    return(result.Value
                        ? Colors.VerifiedColor
                        : Colors.UnverifiedColor);
                }
            }

            return(Color.Empty);
        }