From 1c8df12c9ad7930509f2304357a4ccadfaa3939f Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 31 Dec 2019 19:47:18 +0000 Subject: [PATCH] Split subchannel check from CD dump method. --- .../.idea/contentModel.xml | 5 +- .../{CompactDisc.cs => CompactDisc/Dump.cs} | 22 +---- .../Devices/Dumping/CompactDisc/Subchannel.cs | 87 +++++++++++++++++++ DiscImageChef.Core/DiscImageChef.Core.csproj | 3 +- DiscImageChef.sln.DotSettings | 2 + 5 files changed, 96 insertions(+), 23 deletions(-) rename DiscImageChef.Core/Devices/Dumping/{CompactDisc.cs => CompactDisc/Dump.cs} (99%) create mode 100644 DiscImageChef.Core/Devices/Dumping/CompactDisc/Subchannel.cs diff --git a/.idea/.idea.DiscImageChef/.idea/contentModel.xml b/.idea/.idea.DiscImageChef/.idea/contentModel.xml index 68876f183..484e03fbd 100644 --- a/.idea/.idea.DiscImageChef/.idea/contentModel.xml +++ b/.idea/.idea.DiscImageChef/.idea/contentModel.xml @@ -233,7 +233,10 @@ - + + + + diff --git a/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs b/DiscImageChef.Core/Devices/Dumping/CompactDisc/Dump.cs similarity index 99% rename from DiscImageChef.Core/Devices/Dumping/CompactDisc.cs rename to DiscImageChef.Core/Devices/Dumping/CompactDisc/Dump.cs index 3edfbe8dd..5bd21a5f6 100644 --- a/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs +++ b/DiscImageChef.Core/Devices/Dumping/CompactDisc/Dump.cs @@ -1,4 +1,4 @@ -// /*************************************************************************** +// /*************************************************************************** // The Disc Image Chef // ---------------------------------------------------------------------------- // @@ -2520,25 +2520,5 @@ namespace DiscImageChef.Core.Devices.Dumping Statistics.AddMedia(dskType, true); } - - bool SupportsRwSubchannel() - { - _dumpLog.WriteLine("Checking if drive supports full raw subchannel reading..."); - UpdateStatus?.Invoke("Checking if drive supports full raw subchannel reading..."); - - return!_dev.ReadCd(out _, out _, 0, 2352 + 96, 1, MmcSectorTypes.AllTypes, false, false, true, - MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.Raw, - _dev.Timeout, out _); - } - - bool SupportsPqSubchannel() - { - _dumpLog.WriteLine("Checking if drive supports PQ subchannel reading..."); - UpdateStatus?.Invoke("Checking if drive supports PQ subchannel reading..."); - - return!_dev.ReadCd(out _, out _, 0, 2352 + 16, 1, MmcSectorTypes.AllTypes, false, false, true, - MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.Q16, - _dev.Timeout, out _); - } } } \ No newline at end of file diff --git a/DiscImageChef.Core/Devices/Dumping/CompactDisc/Subchannel.cs b/DiscImageChef.Core/Devices/Dumping/CompactDisc/Subchannel.cs new file mode 100644 index 000000000..bc242446b --- /dev/null +++ b/DiscImageChef.Core/Devices/Dumping/CompactDisc/Subchannel.cs @@ -0,0 +1,87 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : CompactDisc.cs +// Author(s) : Natalia Portillo +// +// Component : Core algorithms. +// +// --[ Description ] ---------------------------------------------------------- +// +// Dumps CDs and DDCDs. +// +// --[ License ] -------------------------------------------------------------- +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2019 Natalia Portillo +// ****************************************************************************/ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Xml.Serialization; +using DiscImageChef.CommonTypes; +using DiscImageChef.CommonTypes.Enums; +using DiscImageChef.CommonTypes.Extents; +using DiscImageChef.CommonTypes.Interfaces; +using DiscImageChef.CommonTypes.Metadata; +using DiscImageChef.CommonTypes.Structs; +using DiscImageChef.Console; +using DiscImageChef.Core.Logging; +using DiscImageChef.Core.Media.Detection; +using DiscImageChef.Decoders.CD; +using DiscImageChef.Decoders.SCSI; +using DiscImageChef.Decoders.SCSI.MMC; +using DiscImageChef.Devices; +using Schemas; +using CdOffset = DiscImageChef.Database.Models.CdOffset; +using MediaType = DiscImageChef.CommonTypes.MediaType; +using PlatformID = DiscImageChef.CommonTypes.Interop.PlatformID; +using Session = DiscImageChef.Decoders.CD.Session; +using TrackType = DiscImageChef.CommonTypes.Enums.TrackType; + +// ReSharper disable JoinDeclarationAndInitializer +// ReSharper disable InlineOutVariableDeclaration +// ReSharper disable TooWideLocalVariableScope + +namespace DiscImageChef.Core.Devices.Dumping +{ + partial class Dump + { + bool SupportsRwSubchannel() + { + _dumpLog.WriteLine("Checking if drive supports full raw subchannel reading..."); + UpdateStatus?.Invoke("Checking if drive supports full raw subchannel reading..."); + + return!_dev.ReadCd(out _, out _, 0, 2352 + 96, 1, MmcSectorTypes.AllTypes, false, false, true, + MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.Raw, + _dev.Timeout, out _); + } + + bool SupportsPqSubchannel() + { + _dumpLog.WriteLine("Checking if drive supports PQ subchannel reading..."); + UpdateStatus?.Invoke("Checking if drive supports PQ subchannel reading..."); + + return!_dev.ReadCd(out _, out _, 0, 2352 + 16, 1, MmcSectorTypes.AllTypes, false, false, true, + MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.Q16, + _dev.Timeout, out _); + } + } +} \ No newline at end of file diff --git a/DiscImageChef.Core/DiscImageChef.Core.csproj b/DiscImageChef.Core/DiscImageChef.Core.csproj index 0aefb933b..faa12d05d 100644 --- a/DiscImageChef.Core/DiscImageChef.Core.csproj +++ b/DiscImageChef.Core/DiscImageChef.Core.csproj @@ -47,6 +47,8 @@ + + @@ -97,7 +99,6 @@ - diff --git a/DiscImageChef.sln.DotSettings b/DiscImageChef.sln.DotSettings index 12e24a480..45f3e0a61 100644 --- a/DiscImageChef.sln.DotSettings +++ b/DiscImageChef.sln.DotSettings @@ -186,6 +186,7 @@ True True True + True True True True @@ -209,6 +210,7 @@ True True True + True True True True