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);
     }
 }
Beispiel #2
0
        void IFlickrParsable.Load(XmlReader reader)
        {
            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                    case "id":
                        PhotoId = reader.Value;
                        break;
                    case "ispublic":
                        IsPublic = reader.Value == "1";
                        break;
                    case "isfamily":
                        IsFamily = reader.Value == "1";
                        break;
                    case "isfriend":
                        IsFriend = reader.Value == "1";
                        break;
                    case "permcomment":
                        PermissionComment = (PermissionComment)Enum.Parse(typeof(PermissionComment), reader.Value, true);
                        break;
                    case "permaddmeta":
                        PermissionAddMeta = (PermissionAddMeta)Enum.Parse(typeof(PermissionAddMeta), reader.Value, true);
                        break;
                    default:
                        UtilityMethods.CheckParsingException(reader);
                        break;
                }
            }

            reader.Read();
        }
		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);
		}
Beispiel #4
0
        void IFlickrParsable.Load(XmlReader reader)
        {
            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                case "id":
                    PhotoId = reader.Value;
                    break;

                case "ispublic":
                    IsPublic = reader.Value == "1";
                    break;

                case "isfamily":
                    IsFamily = reader.Value == "1";
                    break;

                case "isfriend":
                    IsFriend = reader.Value == "1";
                    break;

                case "permcomment":
                    PermissionComment =
                        (PermissionComment)Enum.Parse(typeof(PermissionComment), reader.Value, true);
                    break;

                case "permaddmeta":
                    PermissionAddMeta =
                        (PermissionAddMeta)Enum.Parse(typeof(PermissionAddMeta), reader.Value, true);
                    break;

                default:
                    UtilityMethods.CheckParsingException(reader);
                    break;
                }
            }

            reader.Read();
        }
        /// <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);
        }
 /// <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);
 }
Beispiel #7
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);
        }
Beispiel #8
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);
 }
Beispiel #9
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);
            }
        }
Beispiel #10
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);
 }
 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);
 }
Beispiel #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);