mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
General refactor.
This commit is contained in:
@@ -224,7 +224,7 @@ namespace DiscImageChef.Commands
|
||||
else Settings.Settings.Current.Stats = null;
|
||||
#endregion Statistics
|
||||
|
||||
Settings.Settings.Current.GdprCompliance = Settings.DicSettings.GdprLevel;
|
||||
Settings.Settings.Current.GdprCompliance = DicSettings.GdprLevel;
|
||||
Settings.Settings.SaveSettings();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,12 +230,10 @@ namespace DiscImageChef.Commands
|
||||
|
||||
if(options.SectorTags)
|
||||
{
|
||||
ulong length;
|
||||
|
||||
if(options.Length.ToLowerInvariant() == "all") length = inputFormat.Info.Sectors - 1;
|
||||
if(options.Length.ToLowerInvariant() == "all") { }
|
||||
else
|
||||
{
|
||||
if(!ulong.TryParse(options.Length, out length))
|
||||
if(!ulong.TryParse(options.Length, out ulong _))
|
||||
{
|
||||
DicConsole.WriteLine("Value \"{0}\" is not a valid number for length.", options.Length);
|
||||
DicConsole.WriteLine("Not decoding sectors tags");
|
||||
|
||||
@@ -63,7 +63,8 @@ namespace DiscImageChef.Commands
|
||||
DicConsole.DebugWriteLine("Dump-Media command", "--debug={0}", options.Debug);
|
||||
DicConsole.DebugWriteLine("Dump-Media command", "--verbose={0}", options.Verbose);
|
||||
DicConsole.DebugWriteLine("Dump-Media command", "--device={0}", options.DevicePath);
|
||||
DicConsole.DebugWriteLine("Dump-Media command", "--raw={0}", options.Raw);
|
||||
// TODO: Disabled temporarily
|
||||
//DicConsole.DebugWriteLine("Dump-Media command", "--raw={0}", options.Raw);
|
||||
DicConsole.DebugWriteLine("Dump-Media command", "--stop-on-error={0}", options.StopOnError);
|
||||
DicConsole.DebugWriteLine("Dump-Media command", "--force={0}", options.Force);
|
||||
DicConsole.DebugWriteLine("Dump-Media command", "--retry-passes={0}", options.RetryPasses);
|
||||
@@ -205,7 +206,7 @@ namespace DiscImageChef.Commands
|
||||
switch(dev.Type)
|
||||
{
|
||||
case DeviceType.ATA:
|
||||
Ata.Dump(dev, options.DevicePath, outputFormat, options.RetryPasses, options.Force, options.Raw,
|
||||
Ata.Dump(dev, options.DevicePath, outputFormat, options.RetryPasses, options.Force, false, /*options.Raw,*/
|
||||
options.Persistent, options.StopOnError, ref resume, ref dumpLog, encoding, outputPrefix,
|
||||
options.OutputFile, parsedOptions, sidecar, (uint)options.Skip, options.NoMetadata,
|
||||
options.NoTrim);
|
||||
@@ -213,19 +214,19 @@ namespace DiscImageChef.Commands
|
||||
case DeviceType.MMC:
|
||||
case DeviceType.SecureDigital:
|
||||
SecureDigital.Dump(dev, options.DevicePath, outputFormat, options.RetryPasses, options.Force,
|
||||
options.Raw, options.Persistent, options.StopOnError, ref resume, ref dumpLog,
|
||||
false, /*options.Raw,*/ options.Persistent, options.StopOnError, ref resume, ref dumpLog,
|
||||
encoding, outputPrefix, options.OutputFile, parsedOptions, sidecar,
|
||||
(uint)options.Skip, options.NoMetadata, options.NoTrim);
|
||||
break;
|
||||
case DeviceType.NVMe:
|
||||
NvMe.Dump(dev, options.DevicePath, outputFormat, options.RetryPasses, options.Force, options.Raw,
|
||||
NvMe.Dump(dev, options.DevicePath, outputFormat, options.RetryPasses, options.Force, false, /*options.Raw,*/
|
||||
options.Persistent, options.StopOnError, ref resume, ref dumpLog, encoding, outputPrefix,
|
||||
options.OutputFile, parsedOptions, sidecar, (uint)options.Skip, options.NoMetadata,
|
||||
options.NoTrim);
|
||||
break;
|
||||
case DeviceType.ATAPI:
|
||||
case DeviceType.SCSI:
|
||||
Scsi.Dump(dev, options.DevicePath, outputFormat, options.RetryPasses, options.Force, options.Raw,
|
||||
Scsi.Dump(dev, options.DevicePath, outputFormat, options.RetryPasses, options.Force, false, /*options.Raw,*/
|
||||
options.Persistent, options.StopOnError, ref resume, ref dumpLog, options.LeadIn,
|
||||
encoding, outputPrefix, options.OutputFile, parsedOptions, sidecar, (uint)options.Skip,
|
||||
options.NoMetadata, options.NoTrim);
|
||||
|
||||
@@ -172,28 +172,23 @@ namespace DiscImageChef.Commands
|
||||
error = fs.Mount(imageFormat, partitions[i], encoding, parsedOptions);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
List<string> rootDir = new List<string>();
|
||||
error = fs.ReadDir("/", out rootDir);
|
||||
error = fs.ReadDir("/", out List<string> rootDir);
|
||||
if(error == Errno.NoError)
|
||||
foreach(string entry in rootDir)
|
||||
{
|
||||
FileEntryInfo stat = new FileEntryInfo();
|
||||
|
||||
string volumeName =
|
||||
string.IsNullOrEmpty(fs.XmlFsType.VolumeName)
|
||||
? "NO NAME"
|
||||
: fs.XmlFsType.VolumeName;
|
||||
|
||||
error = fs.Stat(entry, out stat);
|
||||
error = fs.Stat(entry, out FileEntryInfo stat);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
string outputPath;
|
||||
FileStream outputFile;
|
||||
if(options.Xattrs)
|
||||
{
|
||||
List<string> xattrs = new List<string>();
|
||||
|
||||
error = fs.ListXAttr(entry, out xattrs);
|
||||
error = fs.ListXAttr(entry, out List<string> xattrs);
|
||||
if(error == Errno.NoError)
|
||||
foreach(string xattr in xattrs)
|
||||
{
|
||||
@@ -328,28 +323,23 @@ namespace DiscImageChef.Commands
|
||||
error = fs.Mount(imageFormat, partitions[i], encoding, parsedOptions);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
List<string> rootDir = new List<string>();
|
||||
error = fs.ReadDir("/", out rootDir);
|
||||
error = fs.ReadDir("/", out List<string> rootDir);
|
||||
if(error == Errno.NoError)
|
||||
foreach(string entry in rootDir)
|
||||
{
|
||||
FileEntryInfo stat = new FileEntryInfo();
|
||||
|
||||
string volumeName =
|
||||
string.IsNullOrEmpty(fs.XmlFsType.VolumeName)
|
||||
? "NO NAME"
|
||||
: fs.XmlFsType.VolumeName;
|
||||
|
||||
error = fs.Stat(entry, out stat);
|
||||
error = fs.Stat(entry, out FileEntryInfo stat);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
FileStream outputFile;
|
||||
string outputPath;
|
||||
if(options.Xattrs)
|
||||
{
|
||||
List<string> xattrs = new List<string>();
|
||||
|
||||
error = fs.ListXAttr(entry, out xattrs);
|
||||
error = fs.ListXAttr(entry, out List<string> xattrs);
|
||||
if(error == Errno.NoError)
|
||||
foreach(string xattr in xattrs)
|
||||
{
|
||||
@@ -489,28 +479,23 @@ namespace DiscImageChef.Commands
|
||||
error = fs.Mount(imageFormat, wholePart, encoding, parsedOptions);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
List<string> rootDir = new List<string>();
|
||||
error = fs.ReadDir("/", out rootDir);
|
||||
error = fs.ReadDir("/", out List<string> rootDir);
|
||||
if(error == Errno.NoError)
|
||||
foreach(string entry in rootDir)
|
||||
{
|
||||
FileEntryInfo stat = new FileEntryInfo();
|
||||
|
||||
string volumeName =
|
||||
string.IsNullOrEmpty(fs.XmlFsType.VolumeName)
|
||||
? "NO NAME"
|
||||
: fs.XmlFsType.VolumeName;
|
||||
|
||||
error = fs.Stat(entry, out stat);
|
||||
error = fs.Stat(entry, out FileEntryInfo stat);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
FileStream outputFile;
|
||||
string outputPath;
|
||||
if(options.Xattrs)
|
||||
{
|
||||
List<string> xattrs = new List<string>();
|
||||
|
||||
error = fs.ListXAttr(entry, out xattrs);
|
||||
error = fs.ListXAttr(entry, out List<string> xattrs);
|
||||
if(error == Errno.NoError)
|
||||
foreach(string xattr in xattrs)
|
||||
{
|
||||
@@ -634,27 +619,22 @@ namespace DiscImageChef.Commands
|
||||
error = fs.Mount(imageFormat, wholePart, encoding, parsedOptions);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
List<string> rootDir = new List<string>();
|
||||
error = fs.ReadDir("/", out rootDir);
|
||||
error = fs.ReadDir("/", out List<string> rootDir);
|
||||
if(error == Errno.NoError)
|
||||
foreach(string entry in rootDir)
|
||||
{
|
||||
FileEntryInfo stat = new FileEntryInfo();
|
||||
|
||||
string volumeName = string.IsNullOrEmpty(fs.XmlFsType.VolumeName)
|
||||
? "NO NAME"
|
||||
: fs.XmlFsType.VolumeName;
|
||||
|
||||
error = fs.Stat(entry, out stat);
|
||||
error = fs.Stat(entry, out FileEntryInfo stat);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
string outputPath;
|
||||
FileStream outputFile;
|
||||
if(options.Xattrs)
|
||||
{
|
||||
List<string> xattrs = new List<string>();
|
||||
|
||||
error = fs.ListXAttr(entry, out xattrs);
|
||||
error = fs.ListXAttr(entry, out List<string> xattrs);
|
||||
if(error == Errno.NoError)
|
||||
foreach(string xattr in xattrs)
|
||||
{
|
||||
|
||||
@@ -161,8 +161,7 @@ namespace DiscImageChef.Commands
|
||||
error = fs.Mount(imageFormat, partitions[i], encoding, parsedOptions);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
List<string> rootDir = new List<string>();
|
||||
error = fs.ReadDir("/", out rootDir);
|
||||
error = fs.ReadDir("/", out List<string> rootDir);
|
||||
if(error == Errno.NoError)
|
||||
foreach(string entry in rootDir)
|
||||
DicConsole.WriteLine("{0}", entry);
|
||||
@@ -191,8 +190,7 @@ namespace DiscImageChef.Commands
|
||||
error = fs.Mount(imageFormat, partitions[i], encoding, parsedOptions);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
List<string> rootDir = new List<string>();
|
||||
error = fs.ReadDir("/", out rootDir);
|
||||
error = fs.ReadDir("/", out List<string> rootDir);
|
||||
if(error == Errno.NoError)
|
||||
foreach(string entry in rootDir)
|
||||
DicConsole.WriteLine("{0}", entry);
|
||||
@@ -231,8 +229,7 @@ namespace DiscImageChef.Commands
|
||||
error = fs.Mount(imageFormat, wholePart, encoding, parsedOptions);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
List<string> rootDir = new List<string>();
|
||||
error = fs.ReadDir("/", out rootDir);
|
||||
error = fs.ReadDir("/", out List<string> rootDir);
|
||||
if(error == Errno.NoError)
|
||||
foreach(string entry in rootDir)
|
||||
DicConsole.WriteLine("{0}", entry);
|
||||
@@ -258,22 +255,18 @@ namespace DiscImageChef.Commands
|
||||
error = fs.Mount(imageFormat, wholePart, encoding, parsedOptions);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
List<string> rootDir = new List<string>();
|
||||
error = fs.ReadDir("/", out rootDir);
|
||||
error = fs.ReadDir("/", out List<string> rootDir);
|
||||
if(error == Errno.NoError)
|
||||
foreach(string entry in rootDir)
|
||||
if(options.Long)
|
||||
{
|
||||
FileEntryInfo stat = new FileEntryInfo();
|
||||
List<string> xattrs = new List<string>();
|
||||
|
||||
error = fs.Stat(entry, out stat);
|
||||
error = fs.Stat(entry, out FileEntryInfo stat);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
DicConsole.WriteLine("{0}\t{1}\t{2} bytes\t{3}", stat.CreationTimeUtc,
|
||||
stat.Inode, stat.Length, entry);
|
||||
|
||||
error = fs.ListXAttr(entry, out xattrs);
|
||||
error = fs.ListXAttr(entry, out List<string> xattrs);
|
||||
if(error != Errno.NoError) continue;
|
||||
|
||||
foreach(string xattr in xattrs)
|
||||
|
||||
@@ -1283,12 +1283,10 @@ namespace DiscImageChef.Commands
|
||||
case MediaType.XGD2:
|
||||
case MediaType.XGD3:
|
||||
// We need to get INQUIRY to know if it is a Kreon drive
|
||||
Inquiry.SCSIInquiry? inq;
|
||||
|
||||
sense = dev.ScsiInquiry(out byte[] inqBuffer, out senseBuf);
|
||||
if(!sense)
|
||||
{
|
||||
inq = Inquiry.Decode(inqBuffer);
|
||||
Inquiry.SCSIInquiry? inq = Inquiry.Decode(inqBuffer);
|
||||
if(inq.HasValue && inq.Value.KreonPresent)
|
||||
{
|
||||
sense = dev.KreonExtractSs(out cmdBuf, out senseBuf, dev.Timeout, out _);
|
||||
@@ -1302,8 +1300,6 @@ namespace DiscImageChef.Commands
|
||||
if(SS.Decode(cmdBuf).HasValue)
|
||||
DicConsole.WriteLine("Xbox Security Sector:\n{0}", SS.Prettify(cmdBuf));
|
||||
|
||||
ulong l0Video, l1Video, middleZone, gameSize, totalSize, layerBreak;
|
||||
|
||||
// Get video partition size
|
||||
DicConsole.DebugWriteLine("Dump-media command", "Getting video partition size");
|
||||
sense = dev.KreonLock(out senseBuf, dev.Timeout, out _);
|
||||
@@ -1320,7 +1316,7 @@ namespace DiscImageChef.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
totalSize = (ulong)((cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + cmdBuf[3]);
|
||||
ulong totalSize = (ulong)((cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + cmdBuf[3]);
|
||||
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
|
||||
MmcDiscStructureFormat.PhysicalInformation, 0, 0, out _);
|
||||
if(sense)
|
||||
@@ -1331,9 +1327,9 @@ namespace DiscImageChef.Commands
|
||||
|
||||
DicConsole.DebugWriteLine("Dump-media command", "Video partition total size: {0} sectors",
|
||||
totalSize);
|
||||
l0Video = PFI.Decode(cmdBuf).Value.Layer0EndPSN -
|
||||
PFI.Decode(cmdBuf).Value.DataAreaStartPSN + 1;
|
||||
l1Video = totalSize - l0Video + 1;
|
||||
ulong l0Video = PFI.Decode(cmdBuf).Value.Layer0EndPSN -
|
||||
PFI.Decode(cmdBuf).Value.DataAreaStartPSN + 1;
|
||||
ulong l1Video = totalSize - l0Video + 1;
|
||||
|
||||
// Get game partition size
|
||||
DicConsole.DebugWriteLine("Dump-media command", "Getting game partition size");
|
||||
@@ -1351,8 +1347,8 @@ namespace DiscImageChef.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
gameSize = (ulong)((cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + cmdBuf[3]) +
|
||||
1;
|
||||
ulong gameSize = (ulong)((cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + cmdBuf[3]) +
|
||||
1;
|
||||
DicConsole.DebugWriteLine("Dump-media command", "Game partition total size: {0} sectors",
|
||||
gameSize);
|
||||
|
||||
@@ -1383,13 +1379,12 @@ namespace DiscImageChef.Commands
|
||||
|
||||
DicConsole.DebugWriteLine("Dump-media command", "Unlocked total size: {0} sectors",
|
||||
totalSize);
|
||||
middleZone =
|
||||
totalSize -
|
||||
(PFI.Decode(cmdBuf).Value.Layer0EndPSN -
|
||||
PFI.Decode(cmdBuf).Value.DataAreaStartPSN + 1) - gameSize + 1;
|
||||
ulong middleZone = totalSize -
|
||||
(PFI.Decode(cmdBuf).Value.Layer0EndPSN -
|
||||
PFI.Decode(cmdBuf).Value.DataAreaStartPSN + 1) - gameSize + 1;
|
||||
|
||||
totalSize = l0Video + l1Video + middleZone * 2 + gameSize;
|
||||
layerBreak = l0Video + middleZone + gameSize / 2;
|
||||
ulong layerBreak = l0Video + middleZone + gameSize / 2;
|
||||
|
||||
DicConsole.WriteLine("Video layer 0 size: {0} sectors", l0Video);
|
||||
DicConsole.WriteLine("Video layer 1 size: {0} sectors", l1Video);
|
||||
|
||||
@@ -267,9 +267,10 @@ namespace DiscImageChef
|
||||
[Option('i', "device", Required = true, HelpText = "Device path.")]
|
||||
public string DevicePath { get; set; }
|
||||
|
||||
[Option('r', "raw", Default = false,
|
||||
// TODO: Disabled temporarily
|
||||
/* [Option('r', "raw", Default = false,
|
||||
HelpText = "Dump sectors with tags included. For optical media, dump scrambled sectors")]
|
||||
public bool Raw { get; set; }
|
||||
public bool Raw { get; set; }*/
|
||||
|
||||
[Option('s', "stop-on-error", Default = false, HelpText = "Stop media dump on first error.")]
|
||||
public bool StopOnError { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user