public IoDeviceManager() { foreach (var mem in ConfigManager.Instance.HardWareConfigrationMuster.SingleIoDeviceConfigs) { if (!mem.Enable) { continue; } IOBaseDevice.SingleIoDevice singleIoDevice; if (m_IoDevices.ContainsKey(mem.DeviceName)) { //show error info in this place continue; } foreach (var iocard in IoCardManager.Instance.IoCards) { HardwareBase hardwareBase = (HardwareBase)iocard.Value; if (hardwareBase.Guid == mem.BindDeviceGuid) { singleIoDevice = new IOBaseDevice.SingleIoDevice(iocard.Value, mem.IsInput, mem.IoIndex, mem.DeviceName, mem.Guid); m_IoDevices.Add(mem.DeviceName, singleIoDevice); } } } }
public void Add(string key, IOBaseDevice.SingleIoDevice value) { if (m_IoDevices.ContainsKey(key)) { throw new Exception($"the keyname {key} is already exist"); } m_IoDevices.Add(key, value); }