-
Notifications
You must be signed in to change notification settings - Fork 0
/
FlickrPhotoState.cs
58 lines (54 loc) · 1.49 KB
/
FlickrPhotoState.cs
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
53
54
55
56
57
58
using FlickrNet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Backupr
{
class FlickrPhotoState
{
public FlickrPhotoState()
{
Tags = new HashSet<string>();
}
public FlickrPhotoState(Photo p)
: this()
{
PhotoId = p.PhotoId;
Title = p.Title;
Description = p.Description;
DateTaken = p.DateTaken;
Tags = new HashSet<string>(p.Tags);
}
public FlickrPhotoState(Photo p, string photosetId)
: this(p)
{
PhotosetId = photosetId;
}
public string PhotoId { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public DateTime DateTaken { get; set; }
public string PhotosetId { get; set; }
public HashSet<string> Tags { get; private set; }
public string OriginalLocation
{
get
{
//tags are somehow mangled by server... return Tags.FirstOrDefault(t => t.StartsWith("#"));
return Description;
}
}
public void MergeFrom(FlickrPhotoState p2)
{
if (String.IsNullOrEmpty(Title))
Title = p2.Title;
foreach (var tag in p2.Tags)
{
Tags.Add(tag);
}
PhotosetId = p2.PhotosetId;
}
}
}