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);
     }
 }
		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);
		}
Esempio n. 3
0
        /// <summary>
        /// Set the permissions on a photo.
        /// </summary>
        /// <param name="photoId">The id of the photo to update.</param>
        /// <param name="isPublic">True if the photo is public, False if it is not.</param>
        /// <param name="isFriend">True if the photo is viewable by friends, False if it is not.</param>
        /// <param name="isFamily">True if the photo is viewable by family, False if it is not.</param>
        /// <param name="permComment">Who can add comments. See <see cref="PermissionComment"/> for more details.</param>
        /// <param name="permAddMeta">Who can add metadata (notes and tags). See <see cref="PermissionAddMeta"/> for more details.</param>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public void PhotosSetPermsAsync(string photoId, bool isPublic, bool isFriend, bool isFamily, PermissionComment permComment, PermissionAddMeta permAddMeta, Action<FlickrResult<NoResponse>> callback)
        {
            Dictionary<string, string> parameters = new Dictionary<string, string>();
            parameters.Add("method", "flickr.photos.setPerms");
            parameters.Add("photo_id", photoId);
            parameters.Add("is_public", (isPublic ? "1" : "0"));
            parameters.Add("is_friend", (isFriend ? "1" : "0"));
            parameters.Add("is_family", (isFamily ? "1" : "0"));
            parameters.Add("perm_comment", permComment.ToString("d"));
            parameters.Add("perm_addmeta", permAddMeta.ToString("d"));

            GetResponseAsync<NoResponse>(parameters, callback);
        }
Esempio n. 4
0
 /// <summary>
 /// Set the permissions on a photo.
 /// </summary>
 /// <param name="photoId">The id of the photo to update.</param>
 /// <param name="isPublic">1 if the photo is public, 0 if it is not.</param>
 /// <param name="isFriend">1 if the photo is viewable by friends, 0 if it is not.</param>
 /// <param name="isFamily">1 if the photo is viewable by family, 0 if it is not.</param>
 /// <param name="permComment">Who can add comments. See <see cref="PermissionComment"/> for more details.</param>
 /// <param name="permAddMeta">Who can add metadata (notes and tags). See <see cref="PermissionAddMeta"/> for more details.</param>
 /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
 public void PhotosSetPermsAsync(string photoId, int isPublic, int isFriend, int isFamily, PermissionComment permComment, PermissionAddMeta permAddMeta, Action<FlickrResult<NoResponse>> callback)
 {
     PhotosSetPermsAsync(photoId, (isPublic == 1), (isFriend == 1), (isFamily == 1), permComment, permAddMeta, callback);
 }
Esempio n. 5
0
        /// <summary>
        /// Set the permissions on a photo.
        /// </summary>
        /// <param name="photoId">The id of the photo to update.</param>
        /// <param name="isPublic">True if the photo is public, False if it is not.</param>
        /// <param name="isFriend">True if the photo is viewable by friends, False if it is not.</param>
        /// <param name="isFamily">True if the photo is viewable by family, False if it is not.</param>
        /// <param name="permComment">Who can add comments. See <see cref="PermissionComment"/> for more details.</param>
        /// <param name="permAddMeta">Who can add metadata (notes and tags). See <see cref="PermissionAddMeta"/> for more details.</param>
        public void PhotosSetPerms(string photoId, bool isPublic, bool isFriend, bool isFamily, PermissionComment permComment, PermissionAddMeta permAddMeta)
        {
            var parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.photos.setPerms");
            parameters.Add("photo_id", photoId);
            parameters.Add("is_public", (isPublic ? "1" : "0"));
            parameters.Add("is_friend", (isFriend ? "1" : "0"));
            parameters.Add("is_family", (isFamily ? "1" : "0"));
            parameters.Add("perm_comment", permComment.ToString("d"));
            parameters.Add("perm_addmeta", permAddMeta.ToString("d"));

            GetResponseNoCache <NoResponse>(parameters);
        }
Esempio n. 6
0
 /// <summary>
 /// Set the permissions on a photo.
 /// </summary>
 /// <param name="photoId">The id of the photo to update.</param>
 /// <param name="isPublic">1 if the photo is public, 0 if it is not.</param>
 /// <param name="isFriend">1 if the photo is viewable by friends, 0 if it is not.</param>
 /// <param name="isFamily">1 if the photo is viewable by family, 0 if it is not.</param>
 /// <param name="permComment">Who can add comments. See <see cref="PermissionComment"/> for more details.</param>
 /// <param name="permAddMeta">Who can add metadata (notes and tags). See <see cref="PermissionAddMeta"/> for more details.</param>
 public void PhotosSetPerms(string photoId, int isPublic, int isFriend, int isFamily, PermissionComment permComment, PermissionAddMeta permAddMeta)
 {
     PhotosSetPerms(photoId, (isPublic == 1), (isFriend == 1), (isFamily == 1), permComment, permAddMeta);
 }
Esempio n. 7
0
 /// <summary>
 /// Set the permissions on a photo.
 /// </summary>
 /// <param name="photoId">The id of the photo to update.</param>
 /// <param name="isPublic">1 if the photo is public, 0 if it is not.</param>
 /// <param name="isFriend">1 if the photo is viewable by friends, 0 if it is not.</param>
 /// <param name="isFamily">1 if the photo is viewable by family, 0 if it is not.</param>
 /// <param name="permComment">Who can add comments. See <see cref="PermissionComment"/> for more details.</param>
 /// <param name="permAddMeta">Who can add metadata (notes and tags). See <see cref="PermissionAddMeta"/> for more details.</param>
 public void PhotosSetPerms(string photoId, int isPublic, int isFriend, int isFamily, PermissionComment permComment, PermissionAddMeta permAddMeta)
 {
     PhotosSetPerms(photoId, (isPublic==1), (isFriend==1), (isFamily==1), permComment, permAddMeta);
 }
Esempio n. 8
0
        /// <summary>
        /// Set the permissions on a photo.
        /// </summary>
        /// <param name="photoId">The id of the photo to update.</param>
        /// <param name="isPublic">True if the photo is public, False if it is not.</param>
        /// <param name="isFriend">True if the photo is viewable by friends, False if it is not.</param>
        /// <param name="isFamily">True if the photo is viewable by family, False if it is not.</param>
        /// <param name="permComment">Who can add comments. See <see cref="PermissionComment"/> for more details.</param>
        /// <param name="permAddMeta">Who can add metadata (notes and tags). See <see cref="PermissionAddMeta"/> for more details.</param>
        public void PhotosSetPerms(string photoId, bool isPublic, bool isFriend, bool isFamily, PermissionComment permComment, PermissionAddMeta permAddMeta)
        {
            Hashtable parameters = new Hashtable();
            parameters.Add("method", "flickr.photos.setPerms");
            parameters.Add("photo_id", photoId);
            parameters.Add("is_public", (isPublic?"1":"0"));
            parameters.Add("is_friend", (isFriend?"1":"0"));
            parameters.Add("is_family", (isFamily?"1":"0"));
            parameters.Add("perm_comment", permComment.ToString("d"));
            parameters.Add("perm_addmeta", permAddMeta.ToString("d"));

            FlickrNet.Response response = GetResponseNoCache(parameters);

            if( response.Status == ResponseStatus.OK )
            {
                return;
            }
            else
            {
                throw new FlickrException(response.Error);
            }
        }
 public void PhotosSetPerms(string photoId, bool isPublic, bool isFriend, bool isFamily, PermissionComment permComments, PermissionAddMeta permAddMeta)
 {
     var dictionary = new Dictionary<string, string>();
     dictionary.Add("method", "flickr.photos.setPerms");
     dictionary.Add("photo_id", photoId);
     dictionary.Add("is_public", isPublic ? "1" : "0");
     dictionary.Add("is_friend", isFriend ? "1" : "0");
     dictionary.Add("is_family", isFamily ? "1" : "0");
     dictionary.Add("perm_comments", permComments.ToString().ToLower());
     dictionary.Add("perm_add_meta", permAddMeta.ToString().ToLower());
     GetResponse<NoResponse>(dictionary);
 }
Esempio n. 10
0
 public override void VisitPermission(PermissionComment comment, StringBuilder context)
 {
     context.AppendFormat("<permission cref=\"{0}\">", comment.Member);
     base.VisitPermission(comment, context);
     context.Append("</permission>");
 }
Esempio n. 11
0
 /// <summary>
 /// Visits a <c>permission</c> comment.
 /// </summary>
 /// <param name="comment">The comment.</param>
 /// <param name="context">The context.</param>
 public virtual void VisitPermission(PermissionComment comment, TContext context)
 {
     VisitChildren(comment, context);
 }
Esempio n. 12
0
 /// <summary>
 /// Set the permissions on a photo.
 /// </summary>
 /// <param name="photoId">The id of the photo to update.</param>
 /// <param name="isPublic">1 if the photo is public, 0 if it is not.</param>
 /// <param name="isFriend">1 if the photo is viewable by friends, 0 if it is not.</param>
 /// <param name="isFamily">1 if the photo is viewable by family, 0 if it is not.</param>
 /// <param name="permComment">Who can add comments. See <see cref="PermissionComment"/> for more details.</param>
 /// <param name="permAddMeta">Who can add metadata (notes and tags). See <see cref="PermissionAddMeta"/> for more details.</param>
 /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
 public async Task<FlickrResult<NoResponse>> PhotosSetPermsAsync(string photoId, int isPublic, int isFriend, int isFamily, PermissionComment permComment, PermissionAddMeta permAddMeta)
 {
     return await PhotosSetPermsAsync(photoId, (isPublic == 1), (isFriend == 1), (isFamily == 1), permComment, permAddMeta);
 }
 public void PhotosSetPerms(string photoId, bool isPublic, bool isFriend, bool isFamily,
                            PermissionComment permComment, PermissionAddMeta permAddMeta);