mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Simplify IDictionary accesses.
This commit is contained in:
@@ -786,8 +786,8 @@ partial class Dump
|
|||||||
ReadSbcData(blocks, blocksToRead, blockSize, currentTry, extents, ref currentSpeed, ref minSpeed,
|
ReadSbcData(blocks, blocksToRead, blockSize, currentTry, extents, ref currentSpeed, ref minSpeed,
|
||||||
ref maxSpeed, ref totalDuration, scsiReader, mhddLog, ibgLog, ref imageWriteDuration,
|
ref maxSpeed, ref totalDuration, scsiReader, mhddLog, ibgLog, ref imageWriteDuration,
|
||||||
ref newTrim, ref dvdDecrypt,
|
ref newTrim, ref dvdDecrypt,
|
||||||
mediaTags.ContainsKey(MediaTagType.DVD_DiscKey_Decrypted)
|
mediaTags.TryGetValue(MediaTagType.DVD_DiscKey_Decrypted, out byte[] tag)
|
||||||
? mediaTags[MediaTagType.DVD_DiscKey_Decrypted]
|
? tag
|
||||||
: null);
|
: null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -860,8 +860,8 @@ partial class Dump
|
|||||||
_retryPasses > 0 &&
|
_retryPasses > 0 &&
|
||||||
Settings.Settings.Current.EnableDecryption &&
|
Settings.Settings.Current.EnableDecryption &&
|
||||||
_titleKeys &&
|
_titleKeys &&
|
||||||
mediaTags.ContainsKey(MediaTagType.DVD_DiscKey_Decrypted))
|
mediaTags.TryGetValue(MediaTagType.DVD_DiscKey_Decrypted, out byte[] mediaTag))
|
||||||
RetryTitleKeys(dvdDecrypt, mediaTags[MediaTagType.DVD_DiscKey_Decrypted], ref totalDuration);
|
RetryTitleKeys(dvdDecrypt, mediaTag, ref totalDuration);
|
||||||
|
|
||||||
#endregion Error handling
|
#endregion Error handling
|
||||||
|
|
||||||
|
|||||||
@@ -427,8 +427,7 @@ public static class CompactDisc
|
|||||||
|
|
||||||
// When we are dumping we calculate the pregap in reverse from index 1 back.
|
// When we are dumping we calculate the pregap in reverse from index 1 back.
|
||||||
// When we are not, we go from index 0.
|
// When we are not, we go from index 0.
|
||||||
if(!smallestPregapLbaPerTrack.ContainsKey(trackNo))
|
smallestPregapLbaPerTrack.TryAdd(trackNo, dumping ? 1 : 0);
|
||||||
smallestPregapLbaPerTrack[trackNo] = dumping ? 1 : 0;
|
|
||||||
|
|
||||||
uint firstTrackNumberInSameSession = tracks.
|
uint firstTrackNumberInSameSession = tracks.
|
||||||
Where(t => t.Session == tracks[i].Session).
|
Where(t => t.Session == tracks[i].Session).
|
||||||
|
|||||||
Submodule Aaru.Decoders updated: 58394ad73d...d3efb58222
@@ -164,11 +164,8 @@ public sealed partial class AppleDOS
|
|||||||
|
|
||||||
string filename = StringHandlers.SpacePaddedToString(filenameB, _encoding);
|
string filename = StringHandlers.SpacePaddedToString(filenameB, _encoding);
|
||||||
|
|
||||||
if(!_catalogCache.ContainsKey(filename))
|
_catalogCache.TryAdd(filename, ts);
|
||||||
_catalogCache.Add(filename, ts);
|
_fileTypeCache.TryAdd(filename, (byte)(entry.typeAndFlags & 0x7F));
|
||||||
|
|
||||||
if(!_fileTypeCache.ContainsKey(filename))
|
|
||||||
_fileTypeCache.Add(filename, (byte)(entry.typeAndFlags & 0x7F));
|
|
||||||
|
|
||||||
if((entry.typeAndFlags & 0x80) == 0x80 &&
|
if((entry.typeAndFlags & 0x80) == 0x80 &&
|
||||||
!_lockedFiles.Contains(filename))
|
!_lockedFiles.Contains(filename))
|
||||||
|
|||||||
@@ -351,8 +351,7 @@ public sealed partial class ISO9660
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!entries.ContainsKey(entry.Filename))
|
entries.TryAdd(entry.Filename, entry);
|
||||||
entries.Add(entry.Filename, entry);
|
|
||||||
|
|
||||||
entryOff += record.length;
|
entryOff += record.length;
|
||||||
}
|
}
|
||||||
@@ -1123,7 +1122,7 @@ public sealed partial class ISO9660
|
|||||||
while(currentPiece < pieces.Length)
|
while(currentPiece < pieces.Length)
|
||||||
{
|
{
|
||||||
PathTableEntryInternal currentEntry = _pathTable.FirstOrDefault(p => p.Parent == currentParent &&
|
PathTableEntryInternal currentEntry = _pathTable.FirstOrDefault(p => p.Parent == currentParent &&
|
||||||
p.Name.Equals(pieces[currentPiece], StringComparison.CurrentCultureIgnoreCase));
|
p.Name.Equals(pieces[currentPiece], StringComparison.CurrentCultureIgnoreCase));
|
||||||
|
|
||||||
if(currentEntry is null)
|
if(currentEntry is null)
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -242,8 +242,7 @@ public sealed partial class Alcohol120
|
|||||||
track.startLba = 0;
|
track.startLba = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!sesToc.ContainsKey(track.point))
|
sesToc.TryAdd(track.point, track);
|
||||||
sesToc.Add(track.point, track);
|
|
||||||
|
|
||||||
if(track.point < 0xA0)
|
if(track.point < 0xA0)
|
||||||
_alcTracks.Add(track.point, track);
|
_alcTracks.Add(track.point, track);
|
||||||
|
|||||||
@@ -509,14 +509,14 @@ public sealed partial class BlindWrite4
|
|||||||
|
|
||||||
track.Filter = filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder,
|
track.Filter = filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder,
|
||||||
bwTrack.filename.ToLower(CultureInfo.
|
bwTrack.filename.ToLower(CultureInfo.
|
||||||
CurrentCulture)));
|
CurrentCulture)));
|
||||||
|
|
||||||
if(track.Filter != null)
|
if(track.Filter != null)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
track.Filter = filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder,
|
track.Filter = filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder,
|
||||||
bwTrack.filename.ToUpper(CultureInfo.
|
bwTrack.filename.ToUpper(CultureInfo.
|
||||||
CurrentCulture)));
|
CurrentCulture)));
|
||||||
|
|
||||||
if(track.Filter != null)
|
if(track.Filter != null)
|
||||||
break;
|
break;
|
||||||
@@ -535,7 +535,7 @@ public sealed partial class BlindWrite4
|
|||||||
StringSplitOptions.
|
StringSplitOptions.
|
||||||
RemoveEmptyEntries).
|
RemoveEmptyEntries).
|
||||||
Last().ToLower(CultureInfo.
|
Last().ToLower(CultureInfo.
|
||||||
CurrentCulture)));
|
CurrentCulture)));
|
||||||
|
|
||||||
if(track.Filter != null)
|
if(track.Filter != null)
|
||||||
break;
|
break;
|
||||||
@@ -545,7 +545,7 @@ public sealed partial class BlindWrite4
|
|||||||
StringSplitOptions.
|
StringSplitOptions.
|
||||||
RemoveEmptyEntries).
|
RemoveEmptyEntries).
|
||||||
Last().ToUpper(CultureInfo.
|
Last().ToUpper(CultureInfo.
|
||||||
CurrentCulture)));
|
CurrentCulture)));
|
||||||
|
|
||||||
track.Filter = _dataFilter;
|
track.Filter = _dataFilter;
|
||||||
} while(true);
|
} while(true);
|
||||||
@@ -685,11 +685,9 @@ public sealed partial class BlindWrite4
|
|||||||
else
|
else
|
||||||
_offsetMap[track.Sequence] = 0;
|
_offsetMap[track.Sequence] = 0;
|
||||||
|
|
||||||
if(!_offsetMap.ContainsKey(track.Sequence))
|
_offsetMap.TryAdd(track.Sequence, track.StartSector);
|
||||||
_offsetMap.Add(track.Sequence, track.StartSector);
|
|
||||||
|
|
||||||
if(!_trackFlags.ContainsKey(track.Sequence))
|
_trackFlags.TryAdd(track.Sequence, (byte)(bwTrack.adrCtl & 0x0F));
|
||||||
_trackFlags.Add(track.Sequence, (byte)(bwTrack.adrCtl & 0x0F));
|
|
||||||
|
|
||||||
if(bwTrack.lastSector > _imageInfo.Sectors)
|
if(bwTrack.lastSector > _imageInfo.Sectors)
|
||||||
_imageInfo.Sectors = bwTrack.lastSector + 1;
|
_imageInfo.Sectors = bwTrack.lastSector + 1;
|
||||||
|
|||||||
@@ -232,9 +232,8 @@ public sealed partial class Cdrdao
|
|||||||
{
|
{
|
||||||
currentSector += currentTrack.Sectors;
|
currentSector += currentTrack.Sectors;
|
||||||
|
|
||||||
if(currentTrack.Pregap != currentTrack.Sectors &&
|
if(currentTrack.Pregap != currentTrack.Sectors)
|
||||||
!currentTrack.Indexes.ContainsKey(1))
|
currentTrack.Indexes.TryAdd(1, currentTrack.StartSector + currentTrack.Pregap);
|
||||||
currentTrack.Indexes.Add(1, currentTrack.StartSector + currentTrack.Pregap);
|
|
||||||
|
|
||||||
_discimage.Tracks.Add(currentTrack);
|
_discimage.Tracks.Add(currentTrack);
|
||||||
|
|
||||||
@@ -569,9 +568,8 @@ public sealed partial class Cdrdao
|
|||||||
|
|
||||||
if(currentTrack.Sequence != 0)
|
if(currentTrack.Sequence != 0)
|
||||||
{
|
{
|
||||||
if(currentTrack.Pregap != currentTrack.Sectors &&
|
if(currentTrack.Pregap != currentTrack.Sectors)
|
||||||
!currentTrack.Indexes.ContainsKey(1))
|
currentTrack.Indexes.TryAdd(1, currentTrack.StartSector + currentTrack.Pregap);
|
||||||
currentTrack.Indexes.Add(1, currentTrack.StartSector + currentTrack.Pregap);
|
|
||||||
|
|
||||||
_discimage.Tracks.Add(currentTrack);
|
_discimage.Tracks.Add(currentTrack);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -553,8 +553,7 @@ public sealed partial class CloneCd
|
|||||||
else
|
else
|
||||||
currentTrack.Type = TrackType.Audio;
|
currentTrack.Type = TrackType.Audio;
|
||||||
|
|
||||||
if(!_trackFlags.ContainsKey(descriptor.POINT))
|
_trackFlags.TryAdd(descriptor.POINT, descriptor.CONTROL);
|
||||||
_trackFlags.Add(descriptor.POINT, descriptor.CONTROL);
|
|
||||||
|
|
||||||
if(_subFilter != null)
|
if(_subFilter != null)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user