Ejemplo n.º 1
0
 /// <summary>
 /// Adds a new device to the dispatch table.
 /// Will throw if conflicts are found.
 /// </summary>
 /// <param name="device"></param>
 private void UpdateDispatchTable(IIODevice device)
 {
     for (int i = 0; i < 255; i++)
     {
         if (device.HandlesPort((byte)i))
         {
             if (_deviceDispatch[i] != null)
             {
                 throw new InvalidOperationException(
                           String.Format("IO Port conflict at {0:x2} between {1} and {2}",
                                         i, device, _deviceDispatch[i]));
             }
             else
             {
                 _deviceDispatch[i] = device;
             }
         }
     }
 }