Simplify IDictionary accesses.

This commit is contained in:
2023-10-04 09:48:08 +01:00
parent 58394ad73d
commit d3efb58222
2 changed files with 4 additions and 8 deletions

View File

@@ -638,12 +638,9 @@ public static class FullTOC
toc.LastCompleteSession = (byte)track.Session;
}
if(!sessionEndingTrack.ContainsKey(toc.LastCompleteSession))
{
sessionEndingTrack[toc.LastCompleteSession] = (byte)tracks.
Where(t => t.Session == toc.LastCompleteSession).
Max(t => t.Sequence);
}
sessionEndingTrack.TryAdd(toc.LastCompleteSession, (byte)tracks.
Where(t => t.Session == toc.LastCompleteSession).
Max(t => t.Sequence));
byte currentSession = 0;

View File

@@ -340,8 +340,7 @@ public static class Sense
Array.Copy(sense, offset, desc, 0, descLen);
if(!decoded.Descriptors.ContainsKey(descType))
decoded.Descriptors.Add(descType, desc);
decoded.Descriptors.TryAdd(descType, desc);
offset += descLen;
}