private List <RoutedItem> ReadRouteItemsByPath(DcmtkConnection connection, string folderName) { Throw.IfNull(connection); Throw.IfNullOrWhiteSpace(folderName); var profile = _profileStorage.Current; string dir = profile.tempPath + Path.DirectorySeparatorChar + connection.name + Path.DirectorySeparatorChar + folderName + Path.DirectorySeparatorChar + Constants.Dirs.Meta; Directory.CreateDirectory(dir); var fileEntries = _util.DirSearch(dir, Constants.Extensions.MetaExt.ToSearchPattern()); List <RoutedItem> result = new List <RoutedItem>(); foreach (string file in fileEntries) { var st = _routedItemLoader.LoadFromFile(file); if (st == null) { continue; } st.fromConnection = connection.name; result.Add(st); } return(result); }
public override void Init() { lock (InitLock) { _logger.Log(LogLevel.Information, "Exists Certs Names and Locations"); _logger.Log(LogLevel.Information, "------ ----- -------------------------"); if (Connection.useTLS) { foreach (StoreLocation storeLocation in (StoreLocation[]) Enum.GetValues(typeof(StoreLocation))) { foreach (StoreName storeName in (StoreName[]) Enum.GetValues(typeof(StoreName))) { bool entryExists = stores.TryGetValue($"{storeName} + {storeLocation}", out bool exists); if (!entryExists || exists) { X509Store store = new X509Store(storeName, storeLocation); try { store.Open(OpenFlags.OpenExistingOnly); stores.TryAdd($"{storeName} + {storeLocation}", true); _logger.Log(LogLevel.Information, $"Yes {0,4}{store.Certificates.Count}{1}{store.Name}{2}{store.Location}"); foreach (var cert in store.Certificates) { _logger.Log(LogLevel.Information, $"Subject: {0,6}{cert.Subject}"); } store.Close(); } catch (CryptographicException) { stores.TryAdd($"{storeName} + {storeLocation}", false); _logger.Log(LogLevel.Information, $"No {0}{store.Name} {1}{store.Location}"); } } } } } string dir = null; List <string> fileEntries; //read the persisted ResponseCache entries dir = _profileStorage.Current.tempPath + Path.DirectorySeparatorChar + Constants.Dirs.ResponseCache + Path.DirectorySeparatorChar + Constants.Dirs.Cache + Path.DirectorySeparatorChar + Constants.Dirs.Meta; Directory.CreateDirectory(dir); fileEntries = _util.DirSearch(dir, Constants.Extensions.MetaExt.ToSearchPattern()); foreach (string file in fileEntries) { var st = _routedItemLoader.LoadFromFile(file); if (st == null) { continue; } var list = new List <RoutedItem> { st }; var success = cache.TryAdd(st.id, list); if (!success) { cache[st.id].Add(st); } } } }