示例#1
0
 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);
             }
         }
     }
 }
示例#2
0
 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);
 }