diff options
author | Daniel Smith <rdnlsmith@gmail.com> | 2018-08-26 21:22:32 -0400 |
---|---|---|
committer | Daniel Smith <rdnlsmith@gmail.com> | 2018-08-26 21:22:32 -0400 |
commit | 2ecbe281b0351e630c7730b44c1f4a9c3b3062a5 (patch) | |
tree | 4c9ab179dd654230b4f9b29da8437bee9b0fffac /src/Photo.cs |
Initial commit
Diffstat (limited to 'src/Photo.cs')
-rw-r--r-- | src/Photo.cs | 52 |
1 files changed, 52 insertions, 0 deletions
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<PhotoPath> _relativePaths; + + public int Id { get; } + public string Caption { get; set; } + public string AlbumName { get; set; } + public IEnumerable<PhotoPath> RelativePaths => _relativePaths; + + public Photo(int id, string caption = null, string albumName = null) + { + Id = id; + Caption = caption; + AlbumName = albumName; + _relativePaths = new List<PhotoPath>(); + } + + 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<string> GetUniquePaths(PhotoPathType pathType) + { + return RelativePaths? + .Where(p => p.PathType == pathType) + .Select(p => p.RelativePath) + .Distinct() + .ToList(); + } + } +}
\ No newline at end of file |