コード例 #1
0
        public void AddMediaTag(MediaItem mediaItem, MediaTag tag)
        {
            string relativePath = GenerateRelativeMediaTagUrl(mediaItem.Url);

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_format, "xml"));
            paramaters.Add(new QueryParameter("topleftx", tag.TopLeftX.ToString()));
            paramaters.Add(new QueryParameter("toplefty", tag.TopLeftY.ToString()));
            paramaters.Add(new QueryParameter("bottomrightx", tag.BottomRightX.ToString()));
            paramaters.Add(new QueryParameter("bottomrighty", tag.BottomRightY.ToString()));
            paramaters.Add(new QueryParameter("tag", tag.Name));

            if (string.IsNullOrEmpty(tag.Contact) == false)
            {
                paramaters.Add(new QueryParameter("contact", tag.Contact));
            }
            if (string.IsNullOrEmpty(tag.Url) == false)
            {
                paramaters.Add(new QueryParameter("tagurl", tag.Url));
            }

            string addMediaTagUrl = OAuth.GenerateURL(ApiUrl, relativePath, _addMediaTagMethod, Token, paramaters);

            XmlResponseMessage addMediaTagResponseMessage = GetXmlResponseMessageFromUrl(addMediaTagUrl, _addMediaTagMethod);
        }
コード例 #2
0
        private MediaItem UploadMediaItemToAlbum(MediaItem mediaItem, string albumPath)
        {
            string relativeUploadUrl = GenerateRelativeUploadUrl(albumPath);

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_format, "xml"));
            paramaters.Add(new QueryParameter(_type, mediaItem.Type));
            if (string.IsNullOrEmpty(mediaItem.Description) == false)
            {
                paramaters.Add(new QueryParameter(_description, OAuth.UrlEncode(mediaItem.Description)));
            }
            if (string.IsNullOrEmpty(mediaItem.Title) == false)
            {
                paramaters.Add(new QueryParameter(_title, OAuth.UrlEncode(mediaItem.Title)));
            }

            QueryParameterList mediaParamaters = OAuth.GenerateOAuthParamaters(relativeUploadUrl, _uploadMediaMethod, Token, paramaters);

            string uploadMediaItemUrl = ApiUrl + relativeUploadUrl + "?format=xml";

            XmlResponseMessage uploadMediaItemResponse = GetResponseForUploadMediaItem(uploadMediaItemUrl, mediaItem, mediaParamaters);

            MediaItem newMediaItem = new MediaItem(uploadMediaItemResponse.ResponseXml);

            _currentUser.MediaList.Add(newMediaItem);
            return(newMediaItem);
        }
コード例 #3
0
        public void RotateImage(MediaItem mediaItem, int degrees)
        {
            string relativePath = GenerateRelativeRotateImageUrl(mediaItem.Url);

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_format, "xml"));

            string rotateImageUrl = OAuth.GenerateURL(ApiUrl, relativePath, _rotateImageMethod, Token, paramaters);

            XmlResponseMessage rotateImageResponseMessage = GetXmlResponseMessageFromUrl(rotateImageUrl, _rotateImageMethod);
        }
コード例 #4
0
        private void DeleteAlbum(string albumPath)
        {
            string relativePath = GenerateRelativeAlbumUrl(albumPath);

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_format, "xml"));

            string deleteAlbumUrl = OAuth.GenerateURL(ApiUrl, relativePath, _deleteAlbumMethod, Token, paramaters);

            XmlResponseMessage deleteAlbumResponseMessage = GetXmlResponseMessageFromUrl(deleteAlbumUrl, _deleteAlbumMethod);
        }
コード例 #5
0
        private void RenameAlbum(string origAlbumPath, string newAlbumName)
        {
            string relativePath = GenerateRelativeAlbumUrl(origAlbumPath);

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_name, newAlbumName));
            paramaters.Add(new QueryParameter(_format, "xml"));

            string renameAlbumUrl = OAuth.GenerateURL(ApiUrl, relativePath, _renameAlbumMethod, Token, paramaters);

            XmlResponseMessage renameAlbumResponseMessage = GetXmlResponseMessageFromUrl(renameAlbumUrl, _renameAlbumMethod);
        }
コード例 #6
0
        /// <summary>
        /// Get the User object that represents the user currently logged on
        /// </summary>
        /// <returns></returns>
        private User GetUser(string username)
        {
            string relativePath = GenerateRelativeUserUrl(username);

            QueryParameterList paramaters = new QueryParameterList( );

            paramaters.Add(new QueryParameter(_format, "xml"));

            string getUserUrl = OAuth.GenerateURL(ApiUrl, relativePath, _getUserMethod, Token, paramaters);

            XmlResponseMessage getUserResponseMessage = GetXmlResponseMessageFromUrl(getUserUrl, _getUserMethod);

            return(new User(getUserResponseMessage.ResponseXml));
        }
コード例 #7
0
        public void ShareMediaViaEmail(MediaItem mediaItem, string email, string body)
        {
            string relativePath = GenerateRelativeShareUrl(mediaItem.Url);

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_format, "xml"));
            paramaters.Add(new QueryParameter("body", body));
            paramaters.Add(new QueryParameter("email", email));

            string shareMediaViaEmailUrl = OAuth.GenerateURL(ApiUrl, relativePath, _shareMediaViaEmailMethod, Token, paramaters);

            XmlResponseMessage shareMediaViaEmailResponseMessage = GetXmlResponseMessageFromUrl(shareMediaViaEmailUrl, _shareMediaViaEmailMethod);
        }
コード例 #8
0
        public void DeleteMediaDescription(ref MediaItem mediaItem)
        {
            string relativePath = GenerateRelativeMediaDescriptionUrl(mediaItem.Url);

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_format, "xml"));

            string deleteMediaDescriptionUrl = OAuth.GenerateURL(ApiUrl, relativePath, _deleteMediaDescriptionMethod, Token, paramaters);

            XmlResponseMessage deleteMediaDescriptionResponseMessage = GetXmlResponseMessageFromUrl(deleteMediaDescriptionUrl, _deleteMediaDescriptionMethod);

            mediaItem.Description = String.Empty;
        }
コード例 #9
0
        public void DeleteMediaTag(MediaItem mediaItem, MediaTag tag)
        {
            string relativePath = GenerateRelativeMediaTagUrl(mediaItem.Url);

            relativePath = relativePath + "/" + tag.TagId.ToString();

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_format, "xml"));

            string deleteMediaTagUrl = OAuth.GenerateURL(ApiUrl, relativePath, _deleteMediaTagMethod, Token, paramaters);

            XmlResponseMessage deleteMediaTagResponseMessage = GetXmlResponseMessageFromUrl(deleteMediaTagUrl, _deleteMediaTagMethod);
        }
コード例 #10
0
        private XmlDocument GetMediaLinks(MediaItem mediaItem)
        {
            string relativePath = GenerateRelativeMediaLinksUrl(mediaItem.Url);

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_format, "xml"));

            string getMediaLinksUrl = OAuth.GenerateURL(ApiUrl, relativePath, _getMediaLinksMethod, Token, paramaters);

            XmlResponseMessage getMediaLinksResponseMessage = GetXmlResponseMessageFromUrl(getMediaLinksUrl, _getMediaLinksMethod);

            return(getMediaLinksResponseMessage.ResponseXml);
        }
コード例 #11
0
        private Privacy GetAlbumsPrivacySettings(string albumPath)
        {
            string relativePath = GenerateRelativeAlbumPrivacyUrl(albumPath);

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_format, "xml"));

            string getAlbumPrivacySettingsUrl = OAuth.GenerateURL(ApiUrl, relativePath, _getAlbumPrivacyMethod, Token, paramaters);

            XmlResponseMessage getAlbumPrivacySettingsResponseMessage = GetXmlResponseMessageFromUrl(getAlbumPrivacySettingsUrl, _getAlbumPrivacyMethod);

            return(GetPrivacyFromResponseMessage(getAlbumPrivacySettingsResponseMessage));
        }
コード例 #12
0
        public UserUrls GetUsersUrls(string username)
        {
            string relativePath = GenerateRelativeUserUrl(username);

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_format, "xml"));

            string getUsersUrlsUrl = OAuth.GenerateURL(ApiUrl, relativePath, _getUsersUrlMethod, Token, paramaters);

            XmlResponseMessage getUsersUrlsResponseMessage = GetXmlResponseMessageFromUrl(getUsersUrlsUrl, _getUsersUrlMethod);

            return(UserUrls.CreateFromXmlResponseMessage(getUsersUrlsResponseMessage));
        }
コード例 #13
0
        public MediaItemList GetFeaturedMedia()
        {
            string relativePath = GenerateRelativeFeaturedUrl();

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_format, "xml"));

            string getFeaturedMediaUrl = OAuth.GenerateURL(_apiUrl, relativePath, _featuredMediaMethod, Token, paramaters);

            XmlResponseMessage getFeaturedMediaResponseMessage = GetXmlResponseMessageFromUrl(getFeaturedMediaUrl, _featuredMediaMethod);

            return(MediaItemList.CreateFromXmlResponseMessage(getFeaturedMediaResponseMessage));
        }
コード例 #14
0
        private Album CreateNewAlbum(string albumName, string albumPath)
        {
            string relativePath = GenerateRelativeAlbumUrl(albumPath);

            QueryParameterList paramaters = new QueryParameterList( );

            paramaters.Add(new QueryParameter(_name, albumName));
            paramaters.Add(new QueryParameter(_format, "xml"));

            string createNewAlbumUrl = OAuth.GenerateURL(ApiUrl, relativePath, _createAlbumMethod, Token, paramaters);

            XmlResponseMessage createNewAlbumResponseMessage = GetXmlResponseMessageFromUrl(createNewAlbumUrl, _createAlbumMethod);

            return(new Album(albumName, albumPath));
        }
コード例 #15
0
        public UploadOptions GetCurrentUsersUploadOptions()
        {
            string relativePath = GenerateRelativeUsersUploadOptionsUrl();

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_format, "xml"));

            string getCurrentUsersUploadOptionsUrl = OAuth.GenerateURL(ApiUrl, relativePath, _getUsersUploadOptionsMethod, Token, paramaters);

            XmlResponseMessage getCurrentUsersUploadOptionsResponseMessage = GetXmlResponseMessageFromUrl(getCurrentUsersUploadOptionsUrl, _getUsersUploadOptionsMethod);

            CurrentUser.SetUploadOptions = UploadOptions.CreateFromXmlResponseMessage(getCurrentUsersUploadOptionsResponseMessage);
            return(CurrentUser.UploadOptions);
        }
コード例 #16
0
        public MediaItem GetMediaInformation(ref MediaItem mediaItem)
        {
            string relativePath = GenerateRelativeMediaInformationUrl(mediaItem.Url);

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_format, "xml"));

            string getMediaInformationUrl = OAuth.GenerateURL(ApiUrl, relativePath, _getMediaInformationMethod, Token, paramaters);

            XmlResponseMessage getMediaInformationResponseMessage = GetXmlResponseMessageFromUrl(getMediaInformationUrl, _getMediaInformationMethod);

            mediaItem = MediaItem.CreateFromXmlNode(mediaItem.MediaType, getMediaInformationResponseMessage.ResponseXml.SelectSingleNode("descendant::media"));
            return(mediaItem);
        }
コード例 #17
0
        public void SetMediaTitle(ref MediaItem mediaItem, string title)
        {
            string relativePath = GenerateRelativeMediaTitleUrl(mediaItem.Url);

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_format, "xml"));
            paramaters.Add(new QueryParameter(_title, title));

            string setMediaTitleUrl = OAuth.GenerateURL(ApiUrl, relativePath, _setMediaTitleMethod, Token, paramaters);

            XmlResponseMessage setMediaTitleResponseMessage = GetXmlResponseMessageFromUrl(setMediaTitleUrl, _setMediaTitleMethod);

            mediaItem.Title = title;
        }
コード例 #18
0
        public MetaData GetMediaMetaData(ref MediaItem mediaItem)
        {
            string relativePath = GenerateRelativeMediaMetaDataUrl(mediaItem.Url);

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_format, "xml"));

            string getMediaMetaDataUrl = OAuth.GenerateURL(ApiUrl, relativePath, _getMediaMetaDataMethod, Token, paramaters);

            XmlResponseMessage getMediaMetaDataResponseMessage = GetXmlResponseMessageFromUrl(getMediaMetaDataUrl, _getMediaMetaDataMethod);

            mediaItem.SetMetaData = MetaData.CreateFromXmlResponseMessage(getMediaMetaDataResponseMessage);
            return(mediaItem.MetaData);
        }
コード例 #19
0
        internal static UploadOptions CreateFromXmlResponseMessage(XmlResponseMessage responseMessage)
        {
            UploadOptions userUploadOptions = new UploadOptions();
            XmlNode       uploadOptionsNode = responseMessage.ResponseXml.SelectSingleNode("descendant::content");

            XmlNode defaultImageSizeNode = uploadOptionsNode.SelectSingleNode("descendant::defaultimagesize");

            userUploadOptions.SetDefaultImageSize = PhotobucketImageSize.CreateFromString(defaultImageSizeNode.InnerText);

            XmlNode autoTaggingNode = uploadOptionsNode.SelectSingleNode("descendant::autotagging");

            userUploadOptions._autoTagging = Boolean.Parse(autoTaggingNode.InnerText);

            return(userUploadOptions);
        }
コード例 #20
0
        public UserContactList GetCurrentUsersContacts()
        {
            string relativePath = GenerateRelativeUsersContactsUrl(_currentUser.Username);

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_format, "xml"));

            string getUsersContactsUrl = OAuth.GenerateURL(ApiUrl, relativePath, _getUserContactsMethod, Token, paramaters);

            XmlResponseMessage getUsersContactsResponseMessage = GetXmlResponseMessageFromUrl(getUsersContactsUrl, _getUserContactsMethod);

            _currentUser.SetContact = UserContactList.CreateFromXmlResponseMessage(getUsersContactsResponseMessage);
            return(_currentUser.Contacts);
        }
コード例 #21
0
        public MediaTag GetMediaTag(MediaItem mediaItem, int tagId)
        {
            string relativePath = GenerateRelativeMediaTagUrl(mediaItem.Url);

            relativePath = relativePath + "/" + tagId.ToString();

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_format, "xml"));

            string getMediaTagUrl = OAuth.GenerateURL(ApiUrl, relativePath, _getMediaTagMethod, Token, paramaters);

            XmlResponseMessage getMediaTagResponseMessage = GetXmlResponseMessageFromUrl(getMediaTagUrl, _getMediaTagMethod);

            return(MediaTag.CreateFromXmlNode(getMediaTagResponseMessage.ResponseXml.SelectSingleNode("descendant::content")));
        }
コード例 #22
0
        public MediaItemList GetUsersRecentMedia(string username, MediaType type, int page, int perPage)
        {
            string relativePath = GenerateRelativeUserSearchUrl(username);

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_format, "xml"));
            paramaters.Add(new QueryParameter(_type, type.ToString().ToLower()));
            paramaters.Add(new QueryParameter(_page, page.ToString()));
            paramaters.Add(new QueryParameter(_perpage, perPage.ToString()));

            string getUsersRecentMediaUrl = OAuth.GenerateURL(ApiUrl, relativePath, _getUserMediaMethod, Token, paramaters);

            XmlResponseMessage getUsersRecentMediaResponseMessage = GetXmlResponseMessageFromUrl(getUsersRecentMediaUrl, _getUserMediaMethod);

            return(MediaItemList.CreateFromXmlResponseMessage(getUsersRecentMediaResponseMessage));
        }
コード例 #23
0
        public AlbumList GetAllUsersAlbums(string username)
        {
            string relativePath = GenerateRelativeAlbumUrl(username);

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_format, "xml"));
            paramaters.Add(new QueryParameter(_recurse, "1"));
            paramaters.Add(new QueryParameter(_view, "flat"));
            paramaters.Add(new QueryParameter(_media, "none"));

            string getAllUsersAlbumsUrl = OAuth.GenerateURL(ApiUrl, relativePath, _getAlbumMethod, Token, paramaters);

            XmlResponseMessage getAllUsersAlbumsResponseMessage = GetXmlResponseMessageFromUrl(getAllUsersAlbumsUrl, _getAlbumMethod);

            return(AlbumList.CreateFromXmlResponseMessage(getAllUsersAlbumsResponseMessage));
        }
コード例 #24
0
        public string GetMediaDescription(ref MediaItem mediaItem)
        {
            string relativePath = GenerateRelativeMediaDescriptionUrl(mediaItem.Url);

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_format, "xml"));

            string getMediaDescriptionUrl = OAuth.GenerateURL(ApiUrl, relativePath, _getMediaDescriptionMethod, Token, paramaters);

            XmlResponseMessage getMediaDescriptionResponseMessage = GetXmlResponseMessageFromUrl(getMediaDescriptionUrl, _getMediaDescriptionMethod);

            XmlNode descriptionNode = getMediaDescriptionResponseMessage.ResponseXml.SelectSingleNode("descendant::description");

            mediaItem.Description = descriptionNode.InnerText;

            return(mediaItem.Description);
        }
コード例 #25
0
        public MediaItemList GetRelatedMedia(MediaItem mediaItem, int num, MediaType mediaType)
        {
            string relativePath = GenerateRelativeRelatedMediaUrl(mediaItem.Url);

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_format, "xml"));
            paramaters.Add(new QueryParameter(_num, num.ToString()));

            string type = mediaType == MediaType.Image ? "images" : "videos";

            paramaters.Add(new QueryParameter(_type, type));

            string getRelatedMediaUrl = OAuth.GenerateURL(ApiUrl, relativePath, _getRelatedMediaMethod, Token, paramaters);

            XmlResponseMessage getRelatedMediaResponseMessage = GetXmlResponseMessageFromUrl(getRelatedMediaUrl, _getRelatedMediaMethod);

            return(MediaItemList.CreateFromXmlNodeList(getRelatedMediaResponseMessage.ResponseXml.SelectNodes("descendant::media")));
        }
コード例 #26
0
        private Album GetAlbum(string albumPath, bool recurse, string view, string media, bool paginated, int page, int perpage)
        {
            string relativePath = GenerateRelativeAlbumUrl(albumPath);

            QueryParameterList paramaters = new QueryParameterList( );

            paramaters.Add(new QueryParameter(_format, "xml"));
            paramaters.Add(new QueryParameter(_recurse, recurse ? "1" : "0"));
            paramaters.Add(new QueryParameter(_view, view));
            paramaters.Add(new QueryParameter(_media, media));
            paramaters.Add(new QueryParameter(_paginated, paginated ? "1" : "0"));
            paramaters.Add(new QueryParameter(_page, page.ToString()));
            paramaters.Add(new QueryParameter(_perpage, perpage.ToString()));

            string getUsersAlbumUrl = OAuth.GenerateURL(ApiUrl, relativePath, _getAlbumMethod, Token, paramaters);

            XmlResponseMessage getUsersAlbumResponseMessage = GetXmlResponseMessageFromUrl(getUsersAlbumUrl, _getAlbumMethod);

            return(new Album(getUsersAlbumResponseMessage.ResponseXml.SelectSingleNode("descendant::album")));
        }
コード例 #27
0
ファイル: MetaData.cs プロジェクト: darocha/Photobucket.NET
      internal static MetaData CreateFromXmlResponseMessage(XmlResponseMessage responseMessage)
      {
         MetaData metaData = new MetaData();

         XmlNode exifNode = responseMessage.ResponseXml.SelectSingleNode("descendant::exif");
         
         XmlNode resolutionNode = exifNode.SelectSingleNode("descendant::Resolution");
         metaData._resolution = resolutionNode.InnerText;

         XmlNode commentNode = exifNode.SelectSingleNode("descendant::Comment");
         metaData._comment = commentNode.InnerText;

         XmlNode widthNode = responseMessage.ResponseXml.SelectSingleNode("descendant::width");
         metaData._width = Convert.ToInt32(widthNode.InnerText);

         XmlNode heightNode = responseMessage.ResponseXml.SelectSingleNode("descendant::height");
         metaData._height = Convert.ToInt32(heightNode.InnerText);

         return metaData;
      }
コード例 #28
0
        public MediaItemList GetUsersMediaWithTag(string username, string tagname, int page, int perPage)
        {
            if (string.IsNullOrEmpty(tagname))
            {
                throw new PhotobucketApiException("tagname is null");
            }

            string relativePath = GenerateRelativeUsersMediaWithTagUrl(username, tagname);

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_format, "xml"));
            paramaters.Add(new QueryParameter(_page, page.ToString()));
            paramaters.Add(new QueryParameter(_perpage, perPage.ToString()));

            string getUsersMediaWithTagTagsUrl = OAuth.GenerateURL(ApiUrl, relativePath, _getUsersMediaTagsMethod, Token, paramaters);

            XmlResponseMessage getUsersMediaWithTagResponseMessage = GetXmlResponseMessageFromUrl(getUsersMediaWithTagTagsUrl, _getUsersMediaTagsMethod);

            return(MediaItemList.CreateFromXmlResponseMessage(getUsersMediaWithTagResponseMessage));
        }
コード例 #29
0
        public MediaItemList SearchMedia(string query, int num, int perpage, int page, int offset, int secondaryperpage, string type, bool recentFirst)
        {
            string relativePath = GenerateRelativeSearchUrl(query);

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_format, "xml"));
            paramaters.Add(new QueryParameter(_num, num.ToString()));
            paramaters.Add(new QueryParameter(_perpage, perpage.ToString()));
            paramaters.Add(new QueryParameter(_page, page.ToString()));
            paramaters.Add(new QueryParameter(_offset, offset.ToString()));
            paramaters.Add(new QueryParameter(_secondaryperpage, secondaryperpage.ToString()));
            paramaters.Add(new QueryParameter(_type, type));
            paramaters.Add(new QueryParameter(_recentfirst, recentFirst ? "1" : "0"));

            string searchMediaUrl = OAuth.GenerateURL(_apiUrl, relativePath, _searchMediaMethod, Token, paramaters);

            XmlResponseMessage searchMediaResponseMessage = GetXmlResponseMessageFromUrl(searchMediaUrl, _searchMediaMethod);

            return(MediaItemList.CreateFromXmlResponseMessage(searchMediaResponseMessage));
        }
コード例 #30
0
        public UploadOptions UpdateCurrentUsersUploadOptions(ImageSize imageSize, bool autoTagging)
        {
            string relativePath = GenerateRelativeUsersUploadOptionsUrl();

            QueryParameterList paramaters = new QueryParameterList();

            paramaters.Add(new QueryParameter(_format, "xml"));
            paramaters.Add(new QueryParameter(_defaultimagesize, Convert.ToString(imageSize)));
            paramaters.Add(new QueryParameter(_autotagging, autoTagging ? "1" : "0"));

            string updateCurrentUsersUploadOptionsUrl = OAuth.GenerateURL(ApiUrl, relativePath, _updateUsersUploadOptionsMethod, Token, paramaters);

            XmlResponseMessage updateCurrentUsersUploadOptionsResponseMessage = GetXmlResponseMessageFromUrl(updateCurrentUsersUploadOptionsUrl, _updateUsersUploadOptionsMethod);

            UploadOptions userUploadOptions = new UploadOptions();

            userUploadOptions.SetDefaultImageSize = imageSize;
            userUploadOptions.SetAutoTagging      = autoTagging;

            CurrentUser.SetUploadOptions = userUploadOptions;
            return(_currentUser.UploadOptions);
        }
コード例 #31
0
        private Privacy GetPrivacyFromResponseMessage(XmlResponseMessage responseMessage)
        {
            XmlNode privacyNode = responseMessage.ResponseXml.SelectSingleNode("descendant::content");

            if (privacyNode == null)
            {
                throw new PhotobucketApiException("Did not find content in xml response from GetAlbumPrivacySettigns");
            }

            if (privacyNode.InnerText == "public")
            {
                return(Privacy.PUBLIC);
            }
            else if (privacyNode.InnerText == "private")
            {
                return(Privacy.PRIVATE);
            }
            else
            {
                throw new PhotobucketApiException("Did not see public or private for privacy settings");
            }
        }
コード例 #32
0
ファイル: User.cs プロジェクト: darocha/Photobucket.NET
      internal static UploadOptions CreateFromXmlResponseMessage(XmlResponseMessage responseMessage)
      {
         UploadOptions userUploadOptions = new UploadOptions();
         XmlNode uploadOptionsNode = responseMessage.ResponseXml.SelectSingleNode("descendant::content");

         XmlNode defaultImageSizeNode = uploadOptionsNode.SelectSingleNode("descendant::defaultimagesize");
         userUploadOptions.SetDefaultImageSize = PhotobucketImageSize.CreateFromString(defaultImageSizeNode.InnerText);

         XmlNode autoTaggingNode = uploadOptionsNode.SelectSingleNode("descendant::autotagging");
         userUploadOptions._autoTagging = Boolean.Parse(autoTaggingNode.InnerText);

         return userUploadOptions;
      }
コード例 #33
0
ファイル: User.cs プロジェクト: darocha/Photobucket.NET
      internal static UserUrls CreateFromXmlResponseMessage(XmlResponseMessage responseMessage)
      {
         UserUrls userUrl = new UserUrls();

         XmlNode subdomainNode = responseMessage.ResponseXml.SelectSingleNode("descendant::subdomain");

         XmlNode albumNode = subdomainNode.SelectSingleNode("descendant::album");
         userUrl._album = albumNode.InnerText;

         XmlNode imageNode = subdomainNode.SelectSingleNode("descendant::image");
         userUrl._image = imageNode.InnerText;

         XmlNode apiNode = subdomainNode.SelectSingleNode("descendant::api");
         userUrl._api = apiNode.InnerText;

         XmlNode feedNode = subdomainNode.SelectSingleNode("descendant::feed");
         userUrl._feed = feedNode.InnerText;

         XmlNode pathNode = responseMessage.ResponseXml.SelectSingleNode("descendant::path");
         userUrl._path = pathNode.InnerText;

         return userUrl;
      }
コード例 #34
0
      private Privacy GetPrivacyFromResponseMessage(XmlResponseMessage responseMessage)
      {
         XmlNode privacyNode = responseMessage.ResponseXml.SelectSingleNode("descendant::content");

         if (privacyNode == null)
         {
            throw new PhotobucketApiException("Did not find content in xml response from GetAlbumPrivacySettigns");
         }

         if (privacyNode.InnerText == "public")
         {
            return Privacy.PUBLIC;
         }
         else if (privacyNode.InnerText == "private")
         {
            return Privacy.PRIVATE;
         }
         else
         {
            throw new PhotobucketApiException("Did not see public or private for privacy settings");
         }
      }