mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[Refactor] Use collection expressions.
This commit is contained in:
@@ -103,7 +103,7 @@ public partial class Dump
|
||||
double currentSpeed = 0;
|
||||
double maxSpeed = double.MinValue;
|
||||
double minSpeed = double.MaxValue;
|
||||
cmdBuf = Array.Empty<byte>();
|
||||
cmdBuf = [];
|
||||
|
||||
// Initialize reader
|
||||
UpdateStatus?.Invoke(Localization.Core.Initializing_reader);
|
||||
@@ -895,7 +895,9 @@ public partial class Dump
|
||||
$"{version.MajorVersion}.{version.MinorVersion}";
|
||||
|
||||
sidecar.BlockMedias[0].Pcmcia.AdditionalInformation =
|
||||
new List<string>(version.AdditionalInformation);
|
||||
[
|
||||
..version.AdditionalInformation
|
||||
];
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -937,7 +939,7 @@ public partial class Dump
|
||||
.Per(totalChkDuration.Milliseconds())
|
||||
.Humanize());
|
||||
|
||||
List<(ulong start, string type)> filesystems = new();
|
||||
List<(ulong start, string type)> filesystems = [];
|
||||
|
||||
if(sidecar.BlockMedias[0].FileSystemInformation != null)
|
||||
{
|
||||
|
||||
@@ -58,10 +58,7 @@ partial class Dump
|
||||
{
|
||||
if(sector?.Length != 2352) return false;
|
||||
|
||||
byte[] syncMark =
|
||||
{
|
||||
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00
|
||||
};
|
||||
byte[] syncMark = [0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00];
|
||||
|
||||
var testMark = new byte[12];
|
||||
Array.Copy(sector, 0, testMark, 0, 12);
|
||||
@@ -80,10 +77,7 @@ partial class Dump
|
||||
|
||||
if(sector?.Length != 2352) return false;
|
||||
|
||||
byte[] syncMark =
|
||||
{
|
||||
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00
|
||||
};
|
||||
byte[] syncMark = [0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00];
|
||||
|
||||
var testMark = new byte[12];
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ sealed partial class Dump
|
||||
var bcdSubchannel = false; // Subchannel positioning is in BCD
|
||||
Dictionary<byte, string> isrcs = new();
|
||||
string mcn = null;
|
||||
HashSet<int> subchannelExtents = new();
|
||||
HashSet<int> subchannelExtents = [];
|
||||
var cdiReadyReadAsAudio = false;
|
||||
uint firstLba;
|
||||
var outputOptical = _outputPlugin as IWritableOpticalImage;
|
||||
@@ -647,8 +647,8 @@ sealed partial class Dump
|
||||
return;
|
||||
}
|
||||
|
||||
List<Track> trkList = new()
|
||||
{
|
||||
List<Track> trkList =
|
||||
[
|
||||
new Track
|
||||
{
|
||||
Sequence = (uint)(tracks.Any(t => t.Sequence == 1) ? 0 : 1),
|
||||
@@ -660,7 +660,7 @@ sealed partial class Dump
|
||||
SubchannelType = subType,
|
||||
EndSector = tracks.First(t => t.Sequence >= 1).StartSector - 1
|
||||
}
|
||||
};
|
||||
];
|
||||
|
||||
trkList.AddRange(tracks);
|
||||
tracks = trkList.ToArray();
|
||||
@@ -1068,12 +1068,7 @@ sealed partial class Dump
|
||||
_dumpLog.WriteLine(Localization.Core.Setting_flags_for_track_0, track.Sequence);
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Setting_flags_for_track_0, track.Sequence));
|
||||
|
||||
outputOptical.WriteSectorTag(new[]
|
||||
{
|
||||
kvp.Value
|
||||
},
|
||||
kvp.Key,
|
||||
SectorTagType.CdTrackFlags);
|
||||
outputOptical.WriteSectorTag([kvp.Value], kvp.Key, SectorTagType.CdTrackFlags);
|
||||
}
|
||||
|
||||
// Set MCN
|
||||
@@ -1108,16 +1103,15 @@ sealed partial class Dump
|
||||
|
||||
if(supportedSubchannel != MmcSubchannel.None && desiredSubchannel != MmcSubchannel.None)
|
||||
{
|
||||
subchannelExtents = new HashSet<int>();
|
||||
subchannelExtents = [];
|
||||
|
||||
_resume.BadSubchannels ??= new List<int>();
|
||||
_resume.BadSubchannels ??= [];
|
||||
|
||||
foreach(int sub in _resume.BadSubchannels) subchannelExtents.Add(sub);
|
||||
|
||||
if(_resume.NextBlock < blocks)
|
||||
{
|
||||
for(ulong i = _resume.NextBlock; i < blocks; i++) subchannelExtents.Add((int)i);
|
||||
}
|
||||
for(ulong i = _resume.NextBlock; i < blocks; i++)
|
||||
subchannelExtents.Add((int)i);
|
||||
}
|
||||
|
||||
if(_resume.NextBlock > 0)
|
||||
@@ -1606,9 +1600,8 @@ sealed partial class Dump
|
||||
supportsLongSectors);
|
||||
|
||||
foreach(Tuple<ulong, ulong> leadoutExtent in leadOutExtents.ToArray())
|
||||
{
|
||||
for(ulong e = leadoutExtent.Item1; e <= leadoutExtent.Item2; e++) subchannelExtents.Remove((int)e);
|
||||
}
|
||||
for(ulong e = leadoutExtent.Item1; e <= leadoutExtent.Item2; e++)
|
||||
subchannelExtents.Remove((int)e);
|
||||
|
||||
if(subchannelExtents.Count > 0 && _retryPasses > 0 && _retrySubchannel)
|
||||
{
|
||||
@@ -1655,7 +1648,7 @@ sealed partial class Dump
|
||||
|
||||
currentTry.Extents = ExtentsConverter.ToMetadata(extents);
|
||||
|
||||
_resume.BadSubchannels = new List<int>();
|
||||
_resume.BadSubchannels = [];
|
||||
_resume.BadSubchannels.AddRange(subchannelExtents);
|
||||
_resume.BadSubchannels.Sort();
|
||||
|
||||
|
||||
@@ -182,15 +182,15 @@ partial class Dump
|
||||
var md = new Modes.DecodedMode
|
||||
{
|
||||
Header = new Modes.ModeHeader(),
|
||||
Pages = new[]
|
||||
{
|
||||
Pages =
|
||||
[
|
||||
new Modes.ModePage
|
||||
{
|
||||
Page = 0x01,
|
||||
Subpage = 0x00,
|
||||
PageResponse = Modes.EncodeModePage_01_MMC(pgMmc)
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
|
||||
@@ -219,7 +219,7 @@ partial class Dump
|
||||
InitProgress?.Invoke();
|
||||
cdRepeatRetry:
|
||||
ulong[] tmpArray = _resume.BadBlocks.ToArray();
|
||||
List<ulong> sectorsNotEvenPartial = new();
|
||||
List<ulong> sectorsNotEvenPartial = [];
|
||||
|
||||
for(var i = 0; i < tmpArray.Length; i++)
|
||||
{
|
||||
@@ -469,9 +469,8 @@ partial class Dump
|
||||
|
||||
// MEDIUM ERROR, retry with ignore error below
|
||||
if(decSense is { ASC: 0x11 })
|
||||
{
|
||||
if(!sectorsNotEvenPartial.Contains(badSector)) sectorsNotEvenPartial.Add(badSector);
|
||||
}
|
||||
if(!sectorsNotEvenPartial.Contains(badSector))
|
||||
sectorsNotEvenPartial.Add(badSector);
|
||||
}
|
||||
|
||||
// Because one block has been partially used to fix the offset
|
||||
@@ -587,15 +586,15 @@ partial class Dump
|
||||
var md = new Modes.DecodedMode
|
||||
{
|
||||
Header = new Modes.ModeHeader(),
|
||||
Pages = new[]
|
||||
{
|
||||
Pages =
|
||||
[
|
||||
new Modes.ModePage
|
||||
{
|
||||
Page = 0x01,
|
||||
Subpage = 0x00,
|
||||
PageResponse = Modes.EncodeModePage_01_MMC(pgMmc)
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
|
||||
@@ -717,10 +716,7 @@ partial class Dump
|
||||
var md = new Modes.DecodedMode
|
||||
{
|
||||
Header = new Modes.ModeHeader(),
|
||||
Pages = new[]
|
||||
{
|
||||
currentModePage.Value
|
||||
}
|
||||
Pages = [currentModePage.Value]
|
||||
};
|
||||
|
||||
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
|
||||
@@ -778,7 +774,7 @@ partial class Dump
|
||||
|
||||
cdRepeatRetry:
|
||||
|
||||
_resume.BadSubchannels = new List<int>();
|
||||
_resume.BadSubchannels = [];
|
||||
_resume.BadSubchannels.AddRange(subchannelExtents);
|
||||
_resume.BadSubchannels.Sort();
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ partial class Dump
|
||||
HashSet<int> subchannelExtents, SubchannelLog subLog, bool supportsLongSectors,
|
||||
Dictionary<byte, byte> trackFlags, Track[] tracks)
|
||||
{
|
||||
List<ulong> runOutSectors = new();
|
||||
List<ulong> runOutSectors = [];
|
||||
|
||||
if(_outputPlugin is not IWritableOpticalImage outputOptical) return;
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ partial class Dump
|
||||
byte[] cmdBuf; // Data buffer
|
||||
const uint sectorSize = 2352; // Full sector size
|
||||
bool sense; // Sense indicator
|
||||
List<Track> trackList = new(); // Tracks in disc
|
||||
List<Track> trackList = []; // Tracks in disc
|
||||
byte[] tmpBuf; // Temporary buffer
|
||||
toc = null;
|
||||
lastSector = 0;
|
||||
|
||||
@@ -1131,9 +1131,9 @@ partial class Dump
|
||||
case MediaTagType.Xbox_SecuritySector:
|
||||
sidecar.OpticalDiscs[0].Xbox ??= new Xbox();
|
||||
|
||||
sidecar.OpticalDiscs[0].Xbox.SecuritySectors = new List<XboxSecuritySector>
|
||||
{
|
||||
new()
|
||||
sidecar.OpticalDiscs[0].Xbox.SecuritySectors =
|
||||
[
|
||||
new XboxSecuritySector
|
||||
{
|
||||
RequestNumber = 0,
|
||||
RequestVersion = 1,
|
||||
@@ -1144,7 +1144,7 @@ partial class Dump
|
||||
Checksums = Checksum.GetChecksums(tag)
|
||||
}
|
||||
}
|
||||
};
|
||||
];
|
||||
|
||||
break;
|
||||
case MediaTagType.Xbox_PFI:
|
||||
@@ -1206,27 +1206,27 @@ partial class Dump
|
||||
|
||||
break;
|
||||
case MediaTagType.CD_FirstTrackPregap:
|
||||
sidecar.OpticalDiscs[0].FirstTrackPregrap = new List<Border>
|
||||
{
|
||||
new()
|
||||
sidecar.OpticalDiscs[0].FirstTrackPregrap =
|
||||
[
|
||||
new Border
|
||||
{
|
||||
Image = outputPath,
|
||||
Size = (ulong)tag.Length,
|
||||
Checksums = Checksum.GetChecksums(tag)
|
||||
}
|
||||
};
|
||||
];
|
||||
|
||||
break;
|
||||
case MediaTagType.CD_LeadIn:
|
||||
sidecar.OpticalDiscs[0].LeadIn = new List<Border>
|
||||
{
|
||||
new()
|
||||
sidecar.OpticalDiscs[0].LeadIn =
|
||||
[
|
||||
new Border
|
||||
{
|
||||
Image = outputPath,
|
||||
Size = (ulong)tag.Length,
|
||||
Checksums = Checksum.GetChecksums(tag)
|
||||
}
|
||||
};
|
||||
];
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ partial class Dump
|
||||
sidecar = _preSidecar;
|
||||
}
|
||||
|
||||
List<(ulong start, string type)> filesystems = new();
|
||||
List<(ulong start, string type)> filesystems = [];
|
||||
|
||||
if(sidecar.OpticalDiscs[0].Track != null)
|
||||
{
|
||||
|
||||
@@ -613,15 +613,15 @@ partial class Dump
|
||||
var md = new Modes.DecodedMode
|
||||
{
|
||||
Header = new Modes.ModeHeader(),
|
||||
Pages = new[]
|
||||
{
|
||||
Pages =
|
||||
[
|
||||
new Modes.ModePage
|
||||
{
|
||||
Page = 0x01,
|
||||
Subpage = 0x00,
|
||||
PageResponse = Modes.EncodeModePage_01(pg)
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
|
||||
@@ -724,10 +724,7 @@ partial class Dump
|
||||
var md = new Modes.DecodedMode
|
||||
{
|
||||
Header = new Modes.ModeHeader(),
|
||||
Pages = new[]
|
||||
{
|
||||
currentModePage.Value
|
||||
}
|
||||
Pages = [currentModePage.Value]
|
||||
};
|
||||
|
||||
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
|
||||
@@ -840,7 +837,7 @@ partial class Dump
|
||||
sidecar = _preSidecar;
|
||||
}
|
||||
|
||||
List<(ulong start, string type)> filesystems = new();
|
||||
List<(ulong start, string type)> filesystems = [];
|
||||
|
||||
if(sidecar.BlockMedias[0].FileSystemInformation != null)
|
||||
{
|
||||
|
||||
@@ -497,15 +497,15 @@ public partial class Dump
|
||||
var md = new Modes.DecodedMode
|
||||
{
|
||||
Header = new Modes.ModeHeader(),
|
||||
Pages = new[]
|
||||
{
|
||||
Pages =
|
||||
[
|
||||
new Modes.ModePage
|
||||
{
|
||||
Page = 0x01,
|
||||
Subpage = 0x00,
|
||||
PageResponse = Modes.EncodeModePage_01(pg)
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
|
||||
@@ -616,10 +616,7 @@ public partial class Dump
|
||||
var md = new Modes.DecodedMode
|
||||
{
|
||||
Header = new Modes.ModeHeader(),
|
||||
Pages = new[]
|
||||
{
|
||||
currentModePage.Value
|
||||
}
|
||||
Pages = [currentModePage.Value]
|
||||
};
|
||||
|
||||
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
|
||||
@@ -732,7 +729,7 @@ public partial class Dump
|
||||
sidecar = _preSidecar;
|
||||
}
|
||||
|
||||
List<(ulong start, string type)> filesystems = new();
|
||||
List<(ulong start, string type)> filesystems = [];
|
||||
|
||||
if(sidecar.BlockMedias[0].FileSystemInformation != null)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -186,19 +185,18 @@ public partial class Dump
|
||||
_dumpStopwatch.Restart();
|
||||
double imageWriteDuration = 0;
|
||||
|
||||
outputOptical.SetTracks(new List<Track>
|
||||
{
|
||||
new()
|
||||
{
|
||||
BytesPerSector = (int)blockSize,
|
||||
EndSector = blocks - 1,
|
||||
Sequence = 1,
|
||||
RawBytesPerSector = (int)blockSize,
|
||||
SubchannelType = TrackSubchannelType.None,
|
||||
Session = 1,
|
||||
Type = TrackType.Data
|
||||
}
|
||||
});
|
||||
outputOptical.SetTracks([
|
||||
new Track
|
||||
{
|
||||
BytesPerSector = (int)blockSize,
|
||||
EndSector = blocks - 1,
|
||||
Sequence = 1,
|
||||
RawBytesPerSector = (int)blockSize,
|
||||
SubchannelType = TrackSubchannelType.None,
|
||||
Session = 1,
|
||||
Type = TrackType.Data
|
||||
}
|
||||
]);
|
||||
|
||||
DumpHardware currentTry = null;
|
||||
ExtentsULong extents = null;
|
||||
@@ -517,15 +515,15 @@ public partial class Dump
|
||||
var md = new Modes.DecodedMode
|
||||
{
|
||||
Header = new Modes.ModeHeader(),
|
||||
Pages = new[]
|
||||
{
|
||||
Pages =
|
||||
[
|
||||
new Modes.ModePage
|
||||
{
|
||||
Page = 0x01,
|
||||
Subpage = 0x00,
|
||||
PageResponse = Modes.EncodeModePage_01(pg)
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
|
||||
@@ -635,10 +633,7 @@ public partial class Dump
|
||||
var md = new Modes.DecodedMode
|
||||
{
|
||||
Header = new Modes.ModeHeader(),
|
||||
Pages = new[]
|
||||
{
|
||||
currentModePage.Value
|
||||
}
|
||||
Pages = [currentModePage.Value]
|
||||
};
|
||||
|
||||
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Metadata;
|
||||
@@ -179,9 +178,9 @@ static class ResumeSupport
|
||||
{
|
||||
resume = new Resume
|
||||
{
|
||||
Tries = new List<DumpHardware>(),
|
||||
Tries = [],
|
||||
CreationDate = DateTime.UtcNow,
|
||||
BadBlocks = new List<ulong>(),
|
||||
BadBlocks = [],
|
||||
LastBlock = isTape ? 0 : blocks - 1,
|
||||
Tape = isTape
|
||||
};
|
||||
|
||||
@@ -285,9 +285,8 @@ partial class Dump
|
||||
Modes.DecodedMode? decMode = null;
|
||||
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
if(Modes.DecodeMode10(cmdBuf, _dev.ScsiType).HasValue) decMode = Modes.DecodeMode10(cmdBuf, _dev.ScsiType);
|
||||
}
|
||||
if(Modes.DecodeMode10(cmdBuf, _dev.ScsiType).HasValue)
|
||||
decMode = Modes.DecodeMode10(cmdBuf, _dev.ScsiType);
|
||||
|
||||
UpdateStatus?.Invoke(Localization.Core.Requesting_MODE_SENSE_6);
|
||||
|
||||
@@ -315,9 +314,8 @@ partial class Dump
|
||||
if(sense || _dev.Error) sense = _dev.ModeSense(out cmdBuf, out senseBuf, 5, out duration);
|
||||
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
if(Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue) decMode = Modes.DecodeMode6(cmdBuf, _dev.ScsiType);
|
||||
}
|
||||
if(Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue)
|
||||
decMode = Modes.DecodeMode6(cmdBuf, _dev.ScsiType);
|
||||
|
||||
// TODO: Check partitions page
|
||||
if(decMode.HasValue)
|
||||
@@ -1530,7 +1528,7 @@ partial class Dump
|
||||
sidecar = _preSidecar;
|
||||
}
|
||||
|
||||
List<(ulong start, string type)> filesystems = new();
|
||||
List<(ulong start, string type)> filesystems = [];
|
||||
|
||||
if(sidecar.BlockMedias[0].FileSystemInformation != null)
|
||||
{
|
||||
|
||||
@@ -126,12 +126,7 @@ partial class Dump
|
||||
|
||||
if(key.All(static k => k == 0))
|
||||
{
|
||||
outputFormat.WriteSectorTag(new byte[]
|
||||
{
|
||||
0, 0, 0, 0, 0
|
||||
},
|
||||
i + j,
|
||||
SectorTagType.DvdTitleKeyDecrypted);
|
||||
outputFormat.WriteSectorTag([0, 0, 0, 0, 0], i + j, SectorTagType.DvdTitleKeyDecrypted);
|
||||
|
||||
_resume.MissingTitleKeys?.Remove(i + j);
|
||||
|
||||
|
||||
@@ -135,12 +135,7 @@ partial class Dump
|
||||
|
||||
if(titleKey.HasValue)
|
||||
{
|
||||
outputFormat.WriteSectorTag(new[]
|
||||
{
|
||||
titleKey.Value.CMI
|
||||
},
|
||||
i + j,
|
||||
SectorTagType.DvdSectorCmi);
|
||||
outputFormat.WriteSectorTag([titleKey.Value.CMI], i + j, SectorTagType.DvdSectorCmi);
|
||||
}
|
||||
else
|
||||
continue;
|
||||
@@ -149,19 +144,9 @@ partial class Dump
|
||||
// not encrypted even if the CMI says it is.
|
||||
if(titleKey.Value.Key.All(static k => k == 0))
|
||||
{
|
||||
outputFormat.WriteSectorTag(new byte[]
|
||||
{
|
||||
0, 0, 0, 0, 0
|
||||
},
|
||||
i + j,
|
||||
SectorTagType.DvdSectorTitleKey);
|
||||
outputFormat.WriteSectorTag([0, 0, 0, 0, 0], i + j, SectorTagType.DvdSectorTitleKey);
|
||||
|
||||
outputFormat.WriteSectorTag(new byte[]
|
||||
{
|
||||
0, 0, 0, 0, 0
|
||||
},
|
||||
i + j,
|
||||
SectorTagType.DvdTitleKeyDecrypted);
|
||||
outputFormat.WriteSectorTag([0, 0, 0, 0, 0], i + j, SectorTagType.DvdTitleKeyDecrypted);
|
||||
|
||||
_resume.MissingTitleKeys.Remove(i + j);
|
||||
|
||||
|
||||
@@ -485,7 +485,7 @@ partial class Dump
|
||||
UpdateStatus?.Invoke(Localization.Core.Building_track_map);
|
||||
_dumpLog.WriteLine(Localization.Core.Building_track_map);
|
||||
|
||||
List<Track> tracks = new();
|
||||
List<Track> tracks = [];
|
||||
|
||||
for(ushort tno = discInformation.Value.FirstTrackNumber;
|
||||
tno <= discInformation?.LastTrackLastSession;
|
||||
@@ -597,19 +597,18 @@ partial class Dump
|
||||
}
|
||||
else
|
||||
{
|
||||
opticalPlugin.SetTracks(new List<Track>
|
||||
{
|
||||
new()
|
||||
{
|
||||
BytesPerSector = (int)blockSize,
|
||||
EndSector = blocks - 1,
|
||||
Sequence = 1,
|
||||
RawBytesPerSector = (int)blockSize,
|
||||
SubchannelType = TrackSubchannelType.None,
|
||||
Session = 1,
|
||||
Type = TrackType.Data
|
||||
}
|
||||
});
|
||||
opticalPlugin.SetTracks([
|
||||
new Track
|
||||
{
|
||||
BytesPerSector = (int)blockSize,
|
||||
EndSector = blocks - 1,
|
||||
Sequence = 1,
|
||||
RawBytesPerSector = (int)blockSize,
|
||||
SubchannelType = TrackSubchannelType.None,
|
||||
Session = 1,
|
||||
Type = TrackType.Data
|
||||
}
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -714,19 +713,18 @@ partial class Dump
|
||||
UpdateStatus?.Invoke(Localization.Core
|
||||
.Creating_single_track_as_could_not_retrieve_track_list_from_drive);
|
||||
|
||||
(outputFormat as IWritableOpticalImage)?.SetTracks(new List<Track>
|
||||
{
|
||||
new()
|
||||
{
|
||||
BytesPerSector = (int)blockSize,
|
||||
EndSector = blocks - 1,
|
||||
Sequence = 1,
|
||||
RawBytesPerSector = (int)blockSize,
|
||||
SubchannelType = TrackSubchannelType.None,
|
||||
Session = 1,
|
||||
Type = TrackType.Data
|
||||
}
|
||||
});
|
||||
(outputFormat as IWritableOpticalImage)?.SetTracks([
|
||||
new Track
|
||||
{
|
||||
BytesPerSector = (int)blockSize,
|
||||
EndSector = blocks - 1,
|
||||
Sequence = 1,
|
||||
RawBytesPerSector = (int)blockSize,
|
||||
SubchannelType = TrackSubchannelType.None,
|
||||
Session = 1,
|
||||
Type = TrackType.Data
|
||||
}
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -816,7 +814,7 @@ partial class Dump
|
||||
(CopyrightType)cmi[0] == CopyrightType.CSS)
|
||||
{
|
||||
UpdateStatus?.Invoke(Localization.Core.Title_keys_dumping_is_enabled_This_will_be_very_slow);
|
||||
_resume.MissingTitleKeys ??= new List<ulong>(Enumerable.Range(0, (int)blocks).Select(n => (ulong)n));
|
||||
_resume.MissingTitleKeys ??= [..Enumerable.Range(0, (int)blocks).Select(n => (ulong)n)];
|
||||
}
|
||||
|
||||
if(_dev.ScsiType == PeripheralDeviceTypes.OpticalDevice)
|
||||
@@ -1431,7 +1429,7 @@ partial class Dump
|
||||
}
|
||||
}
|
||||
|
||||
List<(ulong start, string type)> filesystems = new();
|
||||
List<(ulong start, string type)> filesystems = [];
|
||||
|
||||
if(sidecar.BlockMedias[0].FileSystemInformation != null)
|
||||
{
|
||||
|
||||
@@ -174,15 +174,15 @@ partial class Dump
|
||||
var md = new Modes.DecodedMode
|
||||
{
|
||||
Header = new Modes.ModeHeader(),
|
||||
Pages = new[]
|
||||
{
|
||||
Pages =
|
||||
[
|
||||
new Modes.ModePage
|
||||
{
|
||||
Page = 0x01,
|
||||
Subpage = 0x00,
|
||||
PageResponse = Modes.EncodeModePage_01_MMC(pgMmc)
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
|
||||
@@ -207,15 +207,15 @@ partial class Dump
|
||||
var md = new Modes.DecodedMode
|
||||
{
|
||||
Header = new Modes.ModeHeader(),
|
||||
Pages = new[]
|
||||
{
|
||||
Pages =
|
||||
[
|
||||
new Modes.ModePage
|
||||
{
|
||||
Page = 0x01,
|
||||
Subpage = 0x00,
|
||||
PageResponse = Modes.EncodeModePage_01(pg)
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
|
||||
@@ -340,10 +340,7 @@ partial class Dump
|
||||
var md = new Modes.DecodedMode
|
||||
{
|
||||
Header = new Modes.ModeHeader(),
|
||||
Pages = new[]
|
||||
{
|
||||
currentModePage.Value
|
||||
}
|
||||
Pages = [currentModePage.Value]
|
||||
};
|
||||
|
||||
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
|
||||
@@ -408,30 +405,15 @@ partial class Dump
|
||||
|
||||
if(!titleKey.HasValue) continue;
|
||||
|
||||
outputFormat.WriteSectorTag(new[]
|
||||
{
|
||||
titleKey.Value.CMI
|
||||
},
|
||||
missingKey,
|
||||
SectorTagType.DvdSectorCmi);
|
||||
outputFormat.WriteSectorTag([titleKey.Value.CMI], missingKey, SectorTagType.DvdSectorCmi);
|
||||
|
||||
// If the CMI bit is 1, the sector is using copy protection, else it is not
|
||||
// If the decoded title key is zeroed, there should be no copy protection
|
||||
if((titleKey.Value.CMI & 0x80) >> 7 == 0 || titleKey.Value.Key.All(k => k == 0))
|
||||
{
|
||||
outputFormat.WriteSectorTag(new byte[]
|
||||
{
|
||||
0, 0, 0, 0, 0
|
||||
},
|
||||
missingKey,
|
||||
SectorTagType.DvdSectorTitleKey);
|
||||
outputFormat.WriteSectorTag([0, 0, 0, 0, 0], missingKey, SectorTagType.DvdSectorTitleKey);
|
||||
|
||||
outputFormat.WriteSectorTag(new byte[]
|
||||
{
|
||||
0, 0, 0, 0, 0
|
||||
},
|
||||
missingKey,
|
||||
SectorTagType.DvdTitleKeyDecrypted);
|
||||
outputFormat.WriteSectorTag([0, 0, 0, 0, 0], missingKey, SectorTagType.DvdTitleKeyDecrypted);
|
||||
|
||||
_resume.MissingTitleKeys.Remove(missingKey);
|
||||
|
||||
|
||||
@@ -623,19 +623,18 @@ partial class Dump
|
||||
_mediaGraph?.PaintSectorsBad(_resume.BadBlocks);
|
||||
}
|
||||
|
||||
(outputFormat as IWritableOpticalImage).SetTracks(new List<Track>
|
||||
{
|
||||
new()
|
||||
{
|
||||
BytesPerSector = (int)blockSize,
|
||||
EndSector = blocks - 1,
|
||||
Sequence = 1,
|
||||
RawBytesPerSector = (int)blockSize,
|
||||
SubchannelType = TrackSubchannelType.None,
|
||||
Session = 1,
|
||||
Type = TrackType.Data
|
||||
}
|
||||
});
|
||||
(outputFormat as IWritableOpticalImage).SetTracks([
|
||||
new Track
|
||||
{
|
||||
BytesPerSector = (int)blockSize,
|
||||
EndSector = blocks - 1,
|
||||
Sequence = 1,
|
||||
RawBytesPerSector = (int)blockSize,
|
||||
SubchannelType = TrackSubchannelType.None,
|
||||
Session = 1,
|
||||
Type = TrackType.Data
|
||||
}
|
||||
]);
|
||||
|
||||
ulong currentSector = _resume.NextBlock;
|
||||
|
||||
@@ -785,11 +784,7 @@ partial class Dump
|
||||
i += _skip - blocksToRead;
|
||||
|
||||
string[] senseLines = Sense.PrettifySense(senseBuf)
|
||||
.Split(new[]
|
||||
{
|
||||
Environment.NewLine
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
.Split([Environment.NewLine], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
foreach(string senseLine in senseLines) _dumpLog.WriteLine(senseLine);
|
||||
|
||||
@@ -997,11 +992,7 @@ partial class Dump
|
||||
l1 += _skip - blocksToRead;
|
||||
|
||||
string[] senseLines = Sense.PrettifySense(senseBuf)
|
||||
.Split(new[]
|
||||
{
|
||||
Environment.NewLine
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
.Split([Environment.NewLine], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
foreach(string senseLine in senseLines) _dumpLog.WriteLine(senseLine);
|
||||
}
|
||||
@@ -1152,12 +1143,11 @@ partial class Dump
|
||||
|
||||
if(_resume.BadBlocks.Count > 0 && !_aborted && _retryPasses > 0)
|
||||
{
|
||||
List<ulong> tmpList = new();
|
||||
List<ulong> tmpList = [];
|
||||
|
||||
foreach(ulong ur in _resume.BadBlocks)
|
||||
{
|
||||
for(ulong i = ur; i < ur + blocksToRead; i++) tmpList.Add(i);
|
||||
}
|
||||
for(ulong i = ur; i < ur + blocksToRead; i++)
|
||||
tmpList.Add(i);
|
||||
|
||||
tmpList.Sort();
|
||||
|
||||
@@ -1245,15 +1235,15 @@ partial class Dump
|
||||
var md = new Modes.DecodedMode
|
||||
{
|
||||
Header = new Modes.ModeHeader(),
|
||||
Pages = new[]
|
||||
{
|
||||
Pages =
|
||||
[
|
||||
new Modes.ModePage
|
||||
{
|
||||
Page = 0x01,
|
||||
Subpage = 0x00,
|
||||
PageResponse = Modes.EncodeModePage_01_MMC(pgMmc)
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
|
||||
@@ -1368,10 +1358,7 @@ partial class Dump
|
||||
var md = new Modes.DecodedMode
|
||||
{
|
||||
Header = new Modes.ModeHeader(),
|
||||
Pages = new[]
|
||||
{
|
||||
currentModePage.Value
|
||||
}
|
||||
Pages = [currentModePage.Value]
|
||||
};
|
||||
|
||||
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
|
||||
@@ -1465,13 +1452,13 @@ partial class Dump
|
||||
var layers = new Layers
|
||||
{
|
||||
Type = LayerType.OTP,
|
||||
Sectors = new List<Sectors>
|
||||
{
|
||||
new()
|
||||
Sectors =
|
||||
[
|
||||
new Sectors
|
||||
{
|
||||
Value = layerBreak
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
WriteOpticalSidecar(blockSize, blocks, dskType, layers, mediaTags, 1, out totalChkDuration, null);
|
||||
|
||||
Reference in New Issue
Block a user