C# Class FlickrNet.UtilityMethods

Internal class providing certain utility functions to other classes.
Exibir arquivo Open project: liquidboy/X Class Usage Examples

Public Methods

Method Description
AuthLevelToString ( AuthLevel level ) : string

Converts AuthLevel to a string.

BuddyIcon ( string server, string farm, string userId ) : string

Returns the buddy icon for a given set of server, farm and userid. If no server is present then returns the standard buddy icon.

DateToUnixTimestamp ( System.DateTime date ) : string

Converts a DateTime object into a unix timestamp number.

EscapeOAuthString ( string text ) : string

Escapes a string for use with OAuth.

The only valid characters are Alphanumerics and "-", "_", "." and "~". Everything else is hex encoded.

ExtrasToString ( PhotoSearchExtras extras ) : string

Utility method to convert the PhotoSearchExtras enum to a string.

MD5Hash ( string data ) : string

Generates an MD5 Hash of the passed in string.

MachineTagModeToString ( MachineTagMode machineTagMode ) : string

Convert a MachineTagMode to a string used when passing to Flickr.

MediaTypeToString ( MediaType mediaType ) : string

Converts a MediaType enumeration into a string used by Flickr.

ParseDateWithGranularity ( string date ) : System.DateTime

Parses a date which may contain only a vald year component.

PartialOptionsIntoArray ( PartialSearchOptions options, string>.Dictionary parameters ) : void

Adds the partial options to the passed in Hashtable.

Sha1Encrypt ( string baseString, string keyString ) : string
SortOrderToString ( PhotoSearchSortOrder order ) : string

Converts a PhotoSearchSortOrder into a string for use by the Flickr API.

SortOrderToString ( PopularitySort sortOrder ) : string

Converts a PopularitySort enum to a string.

StringToDictionary ( string response ) : string>.Dictionary

Converts a URL parameter encoded string into a dictionary.

e.g. ab=cd&ef=gh will return a dictionary of { "ab" => "cd", "ef" => "gh" }.

TagModeToString ( TagMode tagMode ) : string

Convert a TagMode to a string used when passing to Flickr.

UnixTimestampToDate ( long timestamp ) : System.DateTime

Converts a long, representing a unix timestamp number into a DateTime object.

UnixTimestampToDate ( string timestamp ) : System.DateTime

Converts a string, representing a unix timestamp number into a DateTime object.

UrlEncode ( string data ) : string

Encodes a URL quesrystring data component.

Private Methods

Method Description
CheckParsingException ( XmlReader reader ) : void
DateToMySql ( System.DateTime date ) : string
MemberTypeToString ( MemberTypes memberTypes ) : string
ParseIdToMemberType ( string memberTypeId ) : MemberTypes
ReadInt32 ( Stream s ) : int
ReadString ( Stream s ) : string
UrlFormat ( Photo p, string size, string extension ) : string
UrlFormat ( PhotoInfo p, string size, string extension ) : string
UrlFormat ( Photoset p, string size, string extension ) : string
UrlFormat ( string format ) : string
UrlFormat ( string farm, string server, string photoid, string secret, string size, string extension ) : string
UtilityMethods ( ) : System
WriteInt32 ( Stream s, int i ) : void
WriteString ( Stream s, string str ) : void

Method Details

AuthLevelToString() public static method

Converts AuthLevel to a string.
public static AuthLevelToString ( AuthLevel level ) : string
level AuthLevel The level to convert.
return string

BuddyIcon() public static method

Returns the buddy icon for a given set of server, farm and userid. If no server is present then returns the standard buddy icon.
public static BuddyIcon ( string server, string farm, string userId ) : string
server string
farm string
userId string
return string

DateToUnixTimestamp() public static method

Converts a DateTime object into a unix timestamp number.
public static DateToUnixTimestamp ( System.DateTime date ) : string
date System.DateTime The date to convert.
return string

EscapeOAuthString() public static method

Escapes a string for use with OAuth.
The only valid characters are Alphanumerics and "-", "_", "." and "~". Everything else is hex encoded.
public static EscapeOAuthString ( string text ) : string
text string The text to escape.
return string

ExtrasToString() public static method

Utility method to convert the PhotoSearchExtras enum to a string.
public static ExtrasToString ( PhotoSearchExtras extras ) : string
extras PhotoSearchExtras
return string

MD5Hash() public static method

Generates an MD5 Hash of the passed in string.
public static MD5Hash ( string data ) : string
data string The unhashed string.
return string

MachineTagModeToString() public static method

Convert a MachineTagMode to a string used when passing to Flickr.
public static MachineTagModeToString ( MachineTagMode machineTagMode ) : string
machineTagMode MachineTagMode The machine tag mode to convert.
return string

MediaTypeToString() public static method

Converts a MediaType enumeration into a string used by Flickr.
public static MediaTypeToString ( MediaType mediaType ) : string
mediaType MediaType The value to convert.
return string

ParseDateWithGranularity() public static method

Parses a date which may contain only a vald year component.
public static ParseDateWithGranularity ( string date ) : System.DateTime
date string The date, as a string, to be parsed.
return System.DateTime

PartialOptionsIntoArray() public static method

Adds the partial options to the passed in Hashtable.
public static PartialOptionsIntoArray ( PartialSearchOptions options, string>.Dictionary parameters ) : void
options PartialSearchOptions The options to convert to an array.
parameters string>.Dictionary The to add the option key value pairs to.
return void

Sha1Encrypt() public static method

public static Sha1Encrypt ( string baseString, string keyString ) : string
baseString string
keyString string
return string

SortOrderToString() public static method

Converts a PhotoSearchSortOrder into a string for use by the Flickr API.
public static SortOrderToString ( PhotoSearchSortOrder order ) : string
order PhotoSearchSortOrder The sort order to convert.
return string

SortOrderToString() public static method

Converts a PopularitySort enum to a string.
public static SortOrderToString ( PopularitySort sortOrder ) : string
sortOrder PopularitySort The value to convert.
return string

StringToDictionary() public static method

Converts a URL parameter encoded string into a dictionary.
e.g. ab=cd&ef=gh will return a dictionary of { "ab" => "cd", "ef" => "gh" }.
public static StringToDictionary ( string response ) : string>.Dictionary
response string
return string>.Dictionary

TagModeToString() public static method

Convert a TagMode to a string used when passing to Flickr.
public static TagModeToString ( TagMode tagMode ) : string
tagMode TagMode The tag mode to convert.
return string

UnixTimestampToDate() public static method

Converts a long, representing a unix timestamp number into a DateTime object.
public static UnixTimestampToDate ( long timestamp ) : System.DateTime
timestamp long The unix timestamp.
return System.DateTime

UnixTimestampToDate() public static method

Converts a string, representing a unix timestamp number into a DateTime object.
public static UnixTimestampToDate ( string timestamp ) : System.DateTime
timestamp string The timestamp, as a string.
return System.DateTime

UrlEncode() public static method

Encodes a URL quesrystring data component.
public static UrlEncode ( string data ) : string
data string The data to encode.
return string