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 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
using System;
using System.Xml;
namespace FlickrNet
{
/// <summary>
/// Permissions for the selected photo.
/// </summary>
[System.Serializable]
public class PhotoPermissions
{
private string _photoId;
private bool _isPublic;
private bool _isFriend;
private bool _isFamily;
private PermissionAddMeta _permAddMeta;
private PermissionComment _permComment;
internal PhotoPermissions(XmlElement element)
{
if( element.Attributes.GetNamedItem("id") != null )
_photoId = element.Attributes.GetNamedItem("id").Value;
if( element.Attributes.GetNamedItem("ispublic") != null )
_isPublic = element.Attributes.GetNamedItem("ispublic").Value=="1";
if( element.Attributes.GetNamedItem("isfamily") != null )
_isFamily = element.Attributes.GetNamedItem("isfamily").Value=="1";
if( element.Attributes.GetNamedItem("isfriend") != null )
_isFriend = element.Attributes.GetNamedItem("isfriend").Value=="1";
if( element.Attributes.GetNamedItem("permcomment") != null )
_permComment = (PermissionComment)Enum.Parse(typeof(PermissionComment), element.Attributes.GetNamedItem("permcomment").Value, true);
if( element.Attributes.GetNamedItem("permaddmeta") != null )
_permAddMeta = (PermissionAddMeta)Enum.Parse(typeof(PermissionAddMeta), element.Attributes.GetNamedItem("permaddmeta").Value, true);
}
/// <remarks/>
public string PhotoId
{
get { return _photoId; }
}
/// <remarks/>
public bool IsPublic
{
get { return _isPublic; }
}
/// <remarks/>
public bool IsFriend
{
get { return _isFriend; }
}
/// <remarks/>
public bool IsFamily
{
get { return _isFamily; }
}
/// <remarks/>
public PermissionComment PermissionComment
{
get { return _permComment; }
}
/// <remarks/>
public PermissionAddMeta PermissionAddMeta
{
get { return _permAddMeta; }
}
}
}
|