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,
|
||||
ref maxSpeed, ref totalDuration, scsiReader, mhddLog, ibgLog, ref imageWriteDuration,
|
||||
ref newTrim, ref dvdDecrypt,
|
||||
mediaTags.ContainsKey(MediaTagType.DVD_DiscKey_Decrypted)
|
||||
? mediaTags[MediaTagType.DVD_DiscKey_Decrypted]
|
||||
mediaTags.TryGetValue(MediaTagType.DVD_DiscKey_Decrypted, out byte[] tag)
|
||||
? tag
|
||||
: null);
|
||||
}
|
||||
|
||||
@@ -860,8 +860,8 @@ partial class Dump
|
||||
_retryPasses > 0 &&
|
||||
Settings.Settings.Current.EnableDecryption &&
|
||||
_titleKeys &&
|
||||
mediaTags.ContainsKey(MediaTagType.DVD_DiscKey_Decrypted))
|
||||
RetryTitleKeys(dvdDecrypt, mediaTags[MediaTagType.DVD_DiscKey_Decrypted], ref totalDuration);
|
||||
mediaTags.TryGetValue(MediaTagType.DVD_DiscKey_Decrypted, out byte[] mediaTag))
|
||||
RetryTitleKeys(dvdDecrypt, mediaTag, ref totalDuration);
|
||||
|
||||
#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 not, we go from index 0.
|
||||
if(!smallestPregapLbaPerTrack.ContainsKey(trackNo))
|
||||
smallestPregapLbaPerTrack[trackNo] = dumping ? 1 : 0;
|
||||
smallestPregapLbaPerTrack.TryAdd(trackNo, dumping ? 1 : 0);
|
||||
|
||||
uint firstTrackNumberInSameSession = tracks.
|
||||
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);
|
||||
|
||||
if(!_catalogCache.ContainsKey(filename))
|
||||
_catalogCache.Add(filename, ts);
|
||||
|
||||
if(!_fileTypeCache.ContainsKey(filename))
|
||||
_fileTypeCache.Add(filename, (byte)(entry.typeAndFlags & 0x7F));
|
||||
_catalogCache.TryAdd(filename, ts);
|
||||
_fileTypeCache.TryAdd(filename, (byte)(entry.typeAndFlags & 0x7F));
|
||||
|
||||
if((entry.typeAndFlags & 0x80) == 0x80 &&
|
||||
!_lockedFiles.Contains(filename))
|
||||
|
||||
@@ -351,8 +351,7 @@ public sealed partial class ISO9660
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!entries.ContainsKey(entry.Filename))
|
||||
entries.Add(entry.Filename, entry);
|
||||
entries.TryAdd(entry.Filename, entry);
|
||||
|
||||
entryOff += record.length;
|
||||
}
|
||||
@@ -1123,7 +1122,7 @@ public sealed partial class ISO9660
|
||||
while(currentPiece < pieces.Length)
|
||||
{
|
||||
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)
|
||||
break;
|
||||
|
||||
@@ -242,8 +242,7 @@ public sealed partial class Alcohol120
|
||||
track.startLba = 0;
|
||||
}
|
||||
|
||||
if(!sesToc.ContainsKey(track.point))
|
||||
sesToc.Add(track.point, track);
|
||||
sesToc.TryAdd(track.point, track);
|
||||
|
||||
if(track.point < 0xA0)
|
||||
_alcTracks.Add(track.point, track);
|
||||
|
||||
@@ -509,14 +509,14 @@ public sealed partial class BlindWrite4
|
||||
|
||||
track.Filter = filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder,
|
||||
bwTrack.filename.ToLower(CultureInfo.
|
||||
CurrentCulture)));
|
||||
CurrentCulture)));
|
||||
|
||||
if(track.Filter != null)
|
||||
break;
|
||||
|
||||
track.Filter = filtersList.GetFilter(Path.Combine(imageFilter.ParentFolder,
|
||||
bwTrack.filename.ToUpper(CultureInfo.
|
||||
CurrentCulture)));
|
||||
CurrentCulture)));
|
||||
|
||||
if(track.Filter != null)
|
||||
break;
|
||||
@@ -535,7 +535,7 @@ public sealed partial class BlindWrite4
|
||||
StringSplitOptions.
|
||||
RemoveEmptyEntries).
|
||||
Last().ToLower(CultureInfo.
|
||||
CurrentCulture)));
|
||||
CurrentCulture)));
|
||||
|
||||
if(track.Filter != null)
|
||||
break;
|
||||
@@ -545,7 +545,7 @@ public sealed partial class BlindWrite4
|
||||
StringSplitOptions.
|
||||
RemoveEmptyEntries).
|
||||
Last().ToUpper(CultureInfo.
|
||||
CurrentCulture)));
|
||||
CurrentCulture)));
|
||||
|
||||
track.Filter = _dataFilter;
|
||||
} while(true);
|
||||
@@ -685,11 +685,9 @@ public sealed partial class BlindWrite4
|
||||
else
|
||||
_offsetMap[track.Sequence] = 0;
|
||||
|
||||
if(!_offsetMap.ContainsKey(track.Sequence))
|
||||
_offsetMap.Add(track.Sequence, track.StartSector);
|
||||
_offsetMap.TryAdd(track.Sequence, track.StartSector);
|
||||
|
||||
if(!_trackFlags.ContainsKey(track.Sequence))
|
||||
_trackFlags.Add(track.Sequence, (byte)(bwTrack.adrCtl & 0x0F));
|
||||
_trackFlags.TryAdd(track.Sequence, (byte)(bwTrack.adrCtl & 0x0F));
|
||||
|
||||
if(bwTrack.lastSector > _imageInfo.Sectors)
|
||||
_imageInfo.Sectors = bwTrack.lastSector + 1;
|
||||
|
||||
@@ -232,9 +232,8 @@ public sealed partial class Cdrdao
|
||||
{
|
||||
currentSector += currentTrack.Sectors;
|
||||
|
||||
if(currentTrack.Pregap != currentTrack.Sectors &&
|
||||
!currentTrack.Indexes.ContainsKey(1))
|
||||
currentTrack.Indexes.Add(1, currentTrack.StartSector + currentTrack.Pregap);
|
||||
if(currentTrack.Pregap != currentTrack.Sectors)
|
||||
currentTrack.Indexes.TryAdd(1, currentTrack.StartSector + currentTrack.Pregap);
|
||||
|
||||
_discimage.Tracks.Add(currentTrack);
|
||||
|
||||
@@ -569,9 +568,8 @@ public sealed partial class Cdrdao
|
||||
|
||||
if(currentTrack.Sequence != 0)
|
||||
{
|
||||
if(currentTrack.Pregap != currentTrack.Sectors &&
|
||||
!currentTrack.Indexes.ContainsKey(1))
|
||||
currentTrack.Indexes.Add(1, currentTrack.StartSector + currentTrack.Pregap);
|
||||
if(currentTrack.Pregap != currentTrack.Sectors)
|
||||
currentTrack.Indexes.TryAdd(1, currentTrack.StartSector + currentTrack.Pregap);
|
||||
|
||||
_discimage.Tracks.Add(currentTrack);
|
||||
}
|
||||
|
||||
@@ -553,8 +553,7 @@ public sealed partial class CloneCd
|
||||
else
|
||||
currentTrack.Type = TrackType.Audio;
|
||||
|
||||
if(!_trackFlags.ContainsKey(descriptor.POINT))
|
||||
_trackFlags.Add(descriptor.POINT, descriptor.CONTROL);
|
||||
_trackFlags.TryAdd(descriptor.POINT, descriptor.CONTROL);
|
||||
|
||||
if(_subFilter != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user