clean up null checks on CameraModel/LensModel

This commit is contained in:
Colin McMillen 2023-07-24 18:55:59 -04:00
parent cdc2cb336d
commit d52e8fce79

View File

@ -144,8 +144,8 @@ void main() {
public class Photo { public class Photo {
public string File; public string File;
public bool Loaded = false; public bool Loaded = false;
public string? CameraModel; public string CameraModel = "";
public string? LensModel; public string LensModel = "";
public string FocalLength = "<unk>"; public string FocalLength = "<unk>";
public string FNumber = "<unk>"; public string FNumber = "<unk>";
public string ExposureTime = "<unk>"; public string ExposureTime = "<unk>";
@ -166,15 +166,16 @@ public class Photo {
ExifProfile? exifs = image.Metadata.ExifProfile; ExifProfile? exifs = image.Metadata.ExifProfile;
if (exifs != null) { if (exifs != null) {
// FIXME: handle Orientation // FIXME: handle Orientation
// FIXME: handle date shot / edited (and sort by shot date?)
IExifValue<string>? model; IExifValue<string>? model;
if (exifs.TryGetValue(ExifTag.Model, out model)) { if (exifs.TryGetValue(ExifTag.Model, out model)) {
CameraModel = model.Value; CameraModel = model.Value ?? "";
} }
IExifValue<string>? lensModel; IExifValue<string>? lensModel;
if (exifs.TryGetValue(ExifTag.LensModel, out lensModel)) { if (exifs.TryGetValue(ExifTag.LensModel, out lensModel)) {
LensModel = lensModel.Value; LensModel = lensModel.Value ?? "";
} }
IExifValue<Rational>? focalLength; IExifValue<Rational>? focalLength;