public void LoadCertificateCache() { _dictionaryCache = new Dictionary <string, CertCacheEntry>(); if (!File.Exists(CacheFilename)) { return; } try { _dictionaryCache = SerializationTools.DeserializeDictionary <string, CertCacheEntry>(CacheFilename); } catch (SystemException e) { Console.WriteLine(e); File.Delete(CacheFilename); } }
public void LoadCertificateCache() { _dictionaryCahe = new Dictionary <string, X509Certificate2>(); if (!File.Exists(CacheFilename)) { return; } try { var l = SerializationTools.DeserializeDictionary <string, byte[]>(CacheFilename); _dictionaryCahe = l.ToDictionary(x => x.Key, x => x.Value != null ? new X509Certificate2(x.Value) : null); } catch (SystemException e) { Console.WriteLine(e); File.Delete(CacheFilename); _dictionaryCahe.Clear(); } }