Ensure not adding duplicate seen devices to database. Fixes #312.

This commit is contained in:
2020-04-18 19:18:15 +01:00
parent c6b23648cb
commit 7d5ca346f7

View File

@@ -1341,6 +1341,12 @@ namespace Aaru.Core
using var ctx = AaruContext.Create(Settings.Settings.LocalDbPath);
if(ctx.SeenDevices.Any(d => d.Manufacturer == dev.Manufacturer &&
d.Model == dev.Model &&
d.Revision == dev.FirmwareRevision &&
d.Bus == deviceBus))
return;
ctx.SeenDevices.Add(new DeviceStat
{
Bus = deviceBus, Manufacturer = dev.Manufacturer, Model = dev.Model,