namespace LootDumpProcessor.Process.Reader.PreProcess; public static class PreProcessReaderFactory { private static readonly Dictionary _proProcessReaders = new(); private static object lockObject = new object(); public static IPreProcessReader GetInstance(PreProcessReaderTypes type) { if (!_proProcessReaders.TryGetValue(type, out var preProcessReader)) { preProcessReader = type switch { PreProcessReaderTypes.SevenZip => new SevenZipPreProcessReader(), _ => throw new ArgumentOutOfRangeException(nameof(type), type, null) }; _proProcessReaders.Add(type, preProcessReader); } return preProcessReader; } }