using System; using SHJX.Service.ServerClient; using System.Collections.Concurrent; using SHJX.Service.Control.PortOperate.Interface; namespace SHJX.Service.Control.PortOperate.Content { public class StorageContent { private readonly ConcurrentDictionary _storages; public StorageContent(OptClient client) { _storages = new ConcurrentDictionary(); _storages.TryAdd("Timer", new TimerOperate(client)); _storages.TryAdd("DripNozzle", new DripNozzleOperate(client)); //_storages.TryAdd("DripNozzle2", new DripNozzleOperateHigh(client)); //_storages.TryAdd("TitrationStir2", new TitrationStirOperateHigh(client)); //_storages.TryAdd("Indicator2", new IndicatorOperateHigh(client)); _storages.TryAdd("SilverSulfatePipe", new SilverSulfatePipeOperate(client)); _storages.TryAdd("Mercury", new MercuryOperate(client)); _storages.TryAdd("Water", new WaterOperate(client)); _storages.TryAdd("Indicator", new IndicatorOperate(client)); _storages.TryAdd("SampleFan", new SampleFanOperate(client)); _storages.TryAdd("DissolveFan", new DissolveFanOperate(client)); _storages.TryAdd("LiquidStir", new LiquidStirOperate(client)); _storages.TryAdd("TitrationStir", new TitrationStirOperate(client)); } public StorageOperateImp Factory(string pumpName) { if (_storages.TryGetValue(pumpName, out var storage)) { return storage; } throw new ArgumentNullException(pumpName); } } }