FlickrNet.UnknownResponse.GetElementValue C# (CSharp) Method

GetElementValue() public method

Gets a text value of an element from the given response.
public GetElementValue ( string element ) : string
element string The element name to find.
return string
        public string GetElementValue(string element)
        {
            System.Xml.Linq.XDocument doc = GetXDocument();
            return doc.Descendants(element).First().Value;
        }

Usage Example

コード例 #1
0
ファイル: Flickr_Upload.cs プロジェクト: vittichy/Flup
        /// <summary>
        /// Replace an existing photo on Flickr.
        /// </summary>
        /// <param name="stream">The <see cref="Stream"/> object containing the photo to be uploaded.</param>
        /// <param name="fileName">The filename of the file to replace the existing item with.</param>
        /// <param name="photoId">The ID of the photo to replace.</param>
        /// <returns>The id of the photograph after successful uploading.</returns>
        public string ReplacePicture(Stream stream, string fileName, string photoId)
        {
            var replaceUri = new Uri(ReplaceUrl);

            var parameters = new Dictionary <string, string>
            {
                { "photo_id", photoId }
            };

            if (!string.IsNullOrEmpty(OAuthAccessToken))
            {
                OAuthGetBasicParameters(parameters);
                parameters.Add("oauth_token", OAuthAccessToken);

                var sig = OAuthCalculateSignature("POST", replaceUri.AbsoluteUri, parameters, OAuthAccessTokenSecret);
                parameters.Add("oauth_signature", sig);
            }
            else
            {
                parameters.Add("api_key", apiKey);
                parameters.Add("auth_token", apiToken);
            }

            var responseXml = UploadData(stream, fileName, replaceUri, parameters);

            var t = new UnknownResponse();

            ((IFlickrParsable)t).Load(responseXml);
            return(t.GetElementValue("photoid"));
        }
All Usage Examples Of FlickrNet.UnknownResponse::GetElementValue