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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user