Ejemplo n.º 1
0
        public ApplicationUninstallerEntry TryGetCachedItem(ApplicationUninstallerEntry notCachedEntry)
        {
            ApplicationUninstallerEntry matchedEntry;

            Cache.TryGetValue(notCachedEntry.GetCacheId(), out matchedEntry);
            return(matchedEntry);
        }
Ejemplo n.º 2
0
        public void TryCacheItem(ApplicationUninstallerEntry item)
        {
            var id = item.GetCacheId();

            if (!string.IsNullOrEmpty(id))
            {
                Cache[id] = item;
            }
        }
        public ApplicationUninstallerEntry TryGetCachedItem(ApplicationUninstallerEntry notCachedEntry)
        {
            var id = notCachedEntry?.GetCacheId();

            if (!string.IsNullOrEmpty(id) && Cache.TryGetValue(id, out var matchedEntry))
            {
                return(matchedEntry);
            }

            return(null);
        }
Ejemplo n.º 4
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);
            }
        }
        private X509Certificate2 GetCert(ApplicationUninstallerEntry uninstaller)
        {
            var id = uninstaller.GetCacheId();

            if (_dictionaryCahe != null && !string.IsNullOrEmpty(id) && _dictionaryCahe.ContainsKey(id))
            {
                var cert = _dictionaryCahe[id];
                uninstaller.SetCertificate(cert);
                return(cert);
            }
            else
            {
                var cert = uninstaller.GetCertificate();
                if (_dictionaryCahe != null && id != null)
                {
                    _dictionaryCahe.Add(id, cert);
                }
                return(cert);
            }
        }