public void RegisterBar(Range range, IPCIePeripheral peripheral, uint bar) { //This has to be improved greatly. //1. have fast search //2. invalidate overlaps var previousRegistration = memoryMap.Where(x => x.Value.BarNumber == bar && x.Value.TargetPeripheral == peripheral).Select(x => x.Key); if (previousRegistration.Any()) { memoryMap.Remove(previousRegistration.SingleOrDefault()); } memoryMap[range] = new TargetBar { BarNumber = bar, TargetPeripheral = peripheral }; }
void Awake() { ins = this; }