public bool ClaimResources(HardwareResources hardwareResources)
{
spinLock.Enter();
for (byte r = 0; r < hardwareResources.MemoryRegionCount; r++)
{
var region = hardwareResources.GetMemoryRegion(r);
foreach (var memoryRegion in memoryRegions)
{
if ((memoryRegion.Contains(region.BaseAddress) || memoryRegion.Contains(region.BaseAddress + region.Size)))
return false;
}
}
for (byte r = 0; r < hardwareResources.MemoryRegionCount; r++)
{
memoryRegions.AddLast(hardwareResources.GetMemoryRegion(r));
}
spinLock.Exit();
return true;
}