Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Code Quality / Tiding #390

Merged
merged 16 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public sealed class OlympusFocusInfoMakernoteDescriptor(OlympusFocusInfoMakernot
OlympusFocusInfoMakernoteDirectory.TagMacroLed => GetMacroLedDescription(),
OlympusFocusInfoMakernoteDirectory.TagSensorTemperature => GetSensorTemperatureDescription(),
OlympusFocusInfoMakernoteDirectory.TagImageStabilization => GetImageStabilizationDescription(),
_ => base.GetDescription(tagType),
_ => base.GetDescription(tagType)
};
}

Expand Down Expand Up @@ -107,15 +107,13 @@ public sealed class OlympusFocusInfoMakernoteDescriptor(OlympusFocusInfoMakernot
if (values.Length == 0)
return null;

var join = $"{values[0]}" + (values.Length > 1 ? $"{values[1]}" : "");

return join switch
return (values[0], values.Length > 1 ? values[1] : -1) switch
{
"0" => "Off",
"1" => "On",
"0 0" => "Off",
"1 0" => "On",
_ => "Unknown (" + join + ")",
(0, -1) => "Off",
(1, -1) => "On",
(0, 0) => "Off",
(1, 0) => "On",
_ => $"Unknown ({string.Join(" ", values)})"
drewnoakes marked this conversation as resolved.
Show resolved Hide resolved
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class HeicImagePropertyDescriptor(HeicImagePropertiesDirectory directory)
return Directory.GetString(tagType) + " degrees";
case HeicImagePropertiesDirectory.TagPixelDepths:
var o = Directory.GetObject(HeicImagePropertiesDirectory.TagPixelDepths);
return o is null ? null : string.Join(" ", ((byte[])o).Select(i => i.ToString()));
return o is byte[] bytes ? string.Join(" ", bytes) : null;
case HeicImagePropertiesDirectory.TagColorFormat:
return TypeStringConverter.ToTypeString(Directory.GetUInt32(HeicImagePropertiesDirectory.TagColorFormat));
case HeicImagePropertiesDirectory.TagColorPrimaries:
Expand Down
2 changes: 1 addition & 1 deletion MetadataExtractor/Formats/Photoshop/PhotoshopDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public sealed class PhotoshopDescriptor(PhotoshopDirectory directory)

return bytes is null
? null
: Encoding.UTF8.GetString(bytes, 0, bytes.Length);
: Encoding.UTF8.GetString(bytes);
}

private string? GetBinaryDataString(int tagType)
Expand Down
Loading