blob: 513c0b86a04010c3ef1cf39fb2ca57e48e2c3dff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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();
}
}
}
|