From 2ecbe281b0351e630c7730b44c1f4a9c3b3062a5 Mon Sep 17 00:00:00 2001 From: Daniel Smith Date: Sun, 26 Aug 2018 21:22:32 -0400 Subject: Initial commit --- src/Photo.cs | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/Photo.cs (limited to 'src/Photo.cs') diff --git a/src/Photo.cs b/src/Photo.cs new file mode 100644 index 0000000..513c0b8 --- /dev/null +++ b/src/Photo.cs @@ -0,0 +1,52 @@ +using System.Collections.Generic; +using System.Linq; + +namespace iPhotoExtractor +{ + class Photo + { + private readonly List _relativePaths; + + public int Id { get; } + public string Caption { get; set; } + public string AlbumName { get; set; } + public IEnumerable RelativePaths => _relativePaths; + + public Photo(int id, string caption = null, string albumName = null) + { + Id = id; + Caption = caption; + AlbumName = albumName; + _relativePaths = new List(); + } + + public void AddPath(string relativePath) + { + _relativePaths.Add(new PhotoPath(relativePath)); + } + + public void AddPath(PhotoPath path) + { + _relativePaths.Add(path); + } + + public bool HasOriginalVersion() + { + return RelativePaths?.Any(p => p.PathType == PhotoPathType.Original) ?? false; + } + + public bool HasModifiedVersion() + { + return RelativePaths?.Any(p => p.PathType == PhotoPathType.Modified) ?? false; + } + + public List GetUniquePaths(PhotoPathType pathType) + { + return RelativePaths? + .Where(p => p.PathType == pathType) + .Select(p => p.RelativePath) + .Distinct() + .ToList(); + } + } +} \ No newline at end of file -- cgit v1.2.3