mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Get device information from database when dumping Compact Disc.
This commit is contained in:
@@ -45,15 +45,19 @@ using DiscImageChef.CommonTypes.Structs;
|
|||||||
using DiscImageChef.Console;
|
using DiscImageChef.Console;
|
||||||
using DiscImageChef.Core.Logging;
|
using DiscImageChef.Core.Logging;
|
||||||
using DiscImageChef.Core.Media.Detection;
|
using DiscImageChef.Core.Media.Detection;
|
||||||
|
using DiscImageChef.Database;
|
||||||
using DiscImageChef.Decoders.CD;
|
using DiscImageChef.Decoders.CD;
|
||||||
using DiscImageChef.Decoders.SCSI;
|
using DiscImageChef.Decoders.SCSI;
|
||||||
using DiscImageChef.Decoders.SCSI.MMC;
|
using DiscImageChef.Decoders.SCSI.MMC;
|
||||||
using DiscImageChef.Devices;
|
using DiscImageChef.Devices;
|
||||||
using Schemas;
|
using Schemas;
|
||||||
|
using CdOffset = DiscImageChef.Database.Models.CdOffset;
|
||||||
|
using Device = DiscImageChef.Database.Models.Device;
|
||||||
using MediaType = DiscImageChef.CommonTypes.MediaType;
|
using MediaType = DiscImageChef.CommonTypes.MediaType;
|
||||||
using PlatformID = DiscImageChef.CommonTypes.Interop.PlatformID;
|
using PlatformID = DiscImageChef.CommonTypes.Interop.PlatformID;
|
||||||
using Session = DiscImageChef.Decoders.CD.Session;
|
using Session = DiscImageChef.Decoders.CD.Session;
|
||||||
using TrackType = DiscImageChef.CommonTypes.Enums.TrackType;
|
using TrackType = DiscImageChef.CommonTypes.Enums.TrackType;
|
||||||
|
// ReSharper disable JoinDeclarationAndInitializer
|
||||||
|
|
||||||
namespace DiscImageChef.Core.Devices.Dumping
|
namespace DiscImageChef.Core.Devices.Dumping
|
||||||
{
|
{
|
||||||
@@ -66,6 +70,13 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
/// <param name="dskType">Disc type as detected in MMC layer</param>
|
/// <param name="dskType">Disc type as detected in MMC layer</param>
|
||||||
internal void CompactDisc(ref MediaType dskType)
|
internal void CompactDisc(ref MediaType dskType)
|
||||||
{
|
{
|
||||||
|
// Master database context
|
||||||
|
DicContext ctx;
|
||||||
|
// Device database entry
|
||||||
|
Device dbDev;
|
||||||
|
// Read offset from database
|
||||||
|
CdOffset cdOffset;
|
||||||
|
|
||||||
if(dumpRaw)
|
if(dumpRaw)
|
||||||
{
|
{
|
||||||
dumpLog.WriteLine("Raw CD dumping not yet implemented");
|
dumpLog.WriteLine("Raw CD dumping not yet implemented");
|
||||||
@@ -73,6 +84,40 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Open master database
|
||||||
|
ctx = DicContext.Create(Settings.Settings.MasterDbPath);
|
||||||
|
|
||||||
|
// Search for device in master database
|
||||||
|
dbDev = ctx.Devices.FirstOrDefault(d => d.Manufacturer == dev.Manufacturer &&
|
||||||
|
d.Model == dev.Model &&
|
||||||
|
d.Revision == dev.Revision);
|
||||||
|
|
||||||
|
if(dbDev is null)
|
||||||
|
{
|
||||||
|
dumpLog.WriteLine("Device not in database, please create a device report and attach it to a Github issue.");
|
||||||
|
UpdateStatus?.Invoke("Device not in database, please create a device report and attach it to a Github issue.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dumpLog.WriteLine($"Device in database since {dbDev.LastSynchronized}.");
|
||||||
|
UpdateStatus?.Invoke($"Device in database since {dbDev.LastSynchronized}.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search for read offset in master database
|
||||||
|
cdOffset =
|
||||||
|
ctx.CdOffsets.FirstOrDefault(d => d.Manufacturer == dev.Manufacturer && d.Model == dev.Model);
|
||||||
|
|
||||||
|
if(cdOffset is null)
|
||||||
|
{
|
||||||
|
dumpLog.WriteLine("CD reading offset not found in database.");
|
||||||
|
UpdateStatus?.Invoke("CD reading offset not found in database.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dumpLog.WriteLine($"CD reading offset is {cdOffset.Offset} samples.");
|
||||||
|
UpdateStatus?.Invoke($"CD reading offset is {cdOffset.Offset} samples.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Dumps a compact disc</summary>
|
/// <summary>Dumps a compact disc</summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user