Skip to content

Commit

Permalink
Use equality operator.
Browse files Browse the repository at this point in the history
  • Loading branch information
drewnoakes committed Jul 6, 2015
1 parent c0b6f8a commit 465e445
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions MetadataExtractor/Formats/Png/PngMetadataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private static IEnumerable<Directory> ProcessChunk([NotNull] PngChunk chunk)
var chunkType = chunk.ChunkType;
var bytes = chunk.Bytes;

if (chunkType.Equals(PngChunkType.IHDR))
if (chunkType == PngChunkType.IHDR)
{
var header = new PngHeader(bytes);
var directory = new PngDirectory(PngChunkType.IHDR);
Expand All @@ -115,26 +115,26 @@ private static IEnumerable<Directory> ProcessChunk([NotNull] PngChunk chunk)
directory.Set(PngDirectory.TagInterlaceMethod, header.InterlaceMethod);
yield return directory;
}
else if (chunkType.Equals(PngChunkType.PLTE))
else if (chunkType == PngChunkType.PLTE)
{
var directory = new PngDirectory(PngChunkType.PLTE);
directory.Set(PngDirectory.TagPaletteSize, bytes.Length / 3);
yield return directory;
}
else if (chunkType.Equals(PngChunkType.tRNS))
else if (chunkType == PngChunkType.tRNS)
{
var directory = new PngDirectory(PngChunkType.tRNS);
directory.Set(PngDirectory.TagPaletteHasTransparency, 1);
yield return directory;
}
else if (chunkType.Equals(PngChunkType.sRGB))
else if (chunkType == PngChunkType.sRGB)
{
int srgbRenderingIntent = unchecked((sbyte)bytes[0]);
var directory = new PngDirectory(PngChunkType.sRGB);
directory.Set(PngDirectory.TagSrgbRenderingIntent, srgbRenderingIntent);
yield return directory;
}
else if (chunkType.Equals(PngChunkType.cHRM))
else if (chunkType == PngChunkType.cHRM)
{
var chromaticities = new PngChromaticities(bytes);
var directory = new PngChromaticitiesDirectory();
Expand All @@ -148,14 +148,14 @@ private static IEnumerable<Directory> ProcessChunk([NotNull] PngChunk chunk)
directory.Set(PngChromaticitiesDirectory.TagBlueY, chromaticities.BlueY);
yield return directory;
}
else if (chunkType.Equals(PngChunkType.gAMA))
else if (chunkType == PngChunkType.gAMA)
{
var gammaInt = ByteConvert.ToInt32BigEndian(bytes);
var directory = new PngDirectory(PngChunkType.gAMA);
directory.Set(PngDirectory.TagGamma, gammaInt / 100000.0);
yield return directory;
}
else if (chunkType.Equals(PngChunkType.iCCP))
else if (chunkType == PngChunkType.iCCP)
{
var reader = new SequentialByteArrayReader(bytes);
var profileName = reader.GetNullTerminatedString(maxLengthBytes: 79);
Expand All @@ -177,13 +177,13 @@ private static IEnumerable<Directory> ProcessChunk([NotNull] PngChunk chunk)
}
yield return directory;
}
else if (chunkType.Equals(PngChunkType.bKGD))
else if (chunkType == PngChunkType.bKGD)
{
var directory = new PngDirectory(PngChunkType.bKGD);
directory.Set(PngDirectory.TagBackgroundColor, bytes);
yield return directory;
}
else if (chunkType.Equals(PngChunkType.tEXt))
else if (chunkType == PngChunkType.tEXt)
{
var reader = new SequentialByteArrayReader(bytes);
var keyword = reader.GetNullTerminatedString(maxLengthBytes: 79);
Expand All @@ -194,7 +194,7 @@ private static IEnumerable<Directory> ProcessChunk([NotNull] PngChunk chunk)
directory.Set(PngDirectory.TagTextualData, textPairs);
yield return directory;
}
else if (chunkType.Equals(PngChunkType.iTXt))
else if (chunkType == PngChunkType.iTXt)
{
var reader = new SequentialByteArrayReader(bytes);
var keyword = reader.GetNullTerminatedString(maxLengthBytes: 79);
Expand Down Expand Up @@ -245,7 +245,7 @@ private static IEnumerable<Directory> ProcessChunk([NotNull] PngChunk chunk)
}
}
}
else if (chunkType.Equals(PngChunkType.tIME))
else if (chunkType == PngChunkType.tIME)
{
var reader = new SequentialByteArrayReader(bytes);
var year = reader.GetUInt16();
Expand All @@ -266,7 +266,7 @@ private static IEnumerable<Directory> ProcessChunk([NotNull] PngChunk chunk)
}
yield return directory;
}
else if (chunkType.Equals(PngChunkType.pHYs))
else if (chunkType == PngChunkType.pHYs)
{
var reader = new SequentialByteArrayReader(bytes);
var pixelsPerUnitX = reader.GetInt32();
Expand Down

0 comments on commit 465e445

Please sign in to comment.