├── .gitignore
├── .nuget
├── NuGet.Config
├── NuGet.exe
└── NuGet.targets
├── FlickrNet.sln
├── FlickrNet.vsmdi
├── FlickrNet
├── ActivityEvent.cs
├── ActivityItem.cs
├── ActivityItemCollection.cs
├── ApiKeyRequiredException.cs
├── AssemblyInfo.cs
├── AssemblyInfoMore.cs
├── Auth.cs
├── AuthenticationRequiredException.cs
├── Blog.cs
├── BlogCollection.cs
├── BlogService.cs
├── BlogServiceCollection.cs
├── BoundaryBox.cs
├── Brand.cs
├── BrandCollection.cs
├── Cache.cs
├── Camera.cs
├── CameraCollection.cs
├── Cluster.cs
├── ClusterCollection.cs
├── CodeAnalysisDictionary.xml
├── Collection.cs
├── CollectionCollection.cs
├── CollectionInfo.cs
├── CollectionSet.cs
├── Contact.cs
├── ContactCollection.cs
├── Context.cs
├── CsvFile.cs
├── CsvFileCollection.cs
├── DateGranularity.cs
├── EchoResponseDictionary.cs
├── Enums.cs
├── ExceptionHandler.cs
├── Exceptions
│ ├── BadUrlFoundException.cs
│ ├── FormatNotFoundException.cs
│ ├── InvalidApiKeyException.cs
│ ├── InvalidSignatureException.cs
│ ├── LoginFailedInvalidTokenException.cs
│ ├── MethodNotFoundException.cs
│ ├── MissingSignatureException.cs
│ ├── PermissionDeniedException.cs
│ ├── PhotoNotFoundException.cs
│ ├── PhotosetNotFoundException.cs
│ ├── ServiceUnavailableException.cs
│ ├── UserNotFoundException.cs
│ └── UserNotLoggedInInsufficientPermissionsException.cs
├── ExifTag.cs
├── ExifTagCollection.cs
├── FavoriteContext.cs
├── FavoriteContextPhoto.cs
├── Flickr.cs
├── FlickrApiException.cs
├── FlickrConfigurationManager.cs
├── FlickrConfigurationSettings.cs
├── FlickrException.cs
├── FlickrNet.csproj
├── FlickrNet.csproj.vspscc
├── FlickrNet.ndoc
├── FlickrNet.snk
├── FlickrNetCF.csproj
├── FlickrNetSilverlight.csproj
├── FlickrNetSilverlight.csproj.vspscc
├── FlickrNetWP7.csproj
├── FlickrNetWP7.csproj.vspscc
├── FlickrResponder.cs
├── FlickrResponderAsync.cs
├── FlickrResponderSync.cs
├── FlickrResult.cs
├── FlickrWebException.cs
├── Flickr_Activity.cs
├── Flickr_ActivityAsync.cs
├── Flickr_Auth.cs
├── Flickr_AuthAsync.cs
├── Flickr_AuthCalc.cs
├── Flickr_Blogs.cs
├── Flickr_BlogsAsync.cs
├── Flickr_Cameras.cs
├── Flickr_CamerasAsync.cs
├── Flickr_Collections.cs
├── Flickr_CollectionsAsync.cs
├── Flickr_Commons.cs
├── Flickr_CommonsAsync.cs
├── Flickr_Contacts.cs
├── Flickr_ContactsAsync.cs
├── Flickr_Favorites.cs
├── Flickr_FavoritesAsync.cs
├── Flickr_Galleries.cs
├── Flickr_GalleriesAsync.cs
├── Flickr_GetResponse.cs
├── Flickr_GetResponseAsync.cs
├── Flickr_Groups.cs
├── Flickr_GroupsAsync.cs
├── Flickr_GroupsDiscuss.cs
├── Flickr_GroupsDiscussAsync.cs
├── Flickr_Interestingness.cs
├── Flickr_InterestingnessAsync.cs
├── Flickr_MachineTags.cs
├── Flickr_MachineTagsAsync.cs
├── Flickr_Notes.cs
├── Flickr_NotesAsync.cs
├── Flickr_OAuth.cs
├── Flickr_OAuthAsync.cs
├── Flickr_OAuthSync.cs
├── Flickr_Panda.cs
├── Flickr_PandaAsync.cs
├── Flickr_People.cs
├── Flickr_PeopleAsync.cs
├── Flickr_Photos.cs
├── Flickr_PhotosAsync.cs
├── Flickr_PhotosComments.cs
├── Flickr_PhotosCommentsAsync.cs
├── Flickr_PhotosGeo.cs
├── Flickr_PhotosGeoAsync.cs
├── Flickr_PhotosMisc.cs
├── Flickr_PhotosMiscAsync.cs
├── Flickr_PhotosPeople.cs
├── Flickr_PhotosPeopleAsync.cs
├── Flickr_PhotosSuggestions.cs
├── Flickr_PhotosSuggestionsAsync.cs
├── Flickr_Photosets.cs
├── Flickr_PhotosetsAsync.cs
├── Flickr_Places.cs
├── Flickr_PlacesAsync.cs
├── Flickr_Prefs.cs
├── Flickr_PrefsAsync.cs
├── Flickr_Profile.cs
├── Flickr_Push.cs
├── Flickr_PushAsync.cs
├── Flickr_Reflection.cs
├── Flickr_ReflectionAsync.cs
├── Flickr_Stats.cs
├── Flickr_StatsAsync.cs
├── Flickr_Tags.cs
├── Flickr_TagsAsync.cs
├── Flickr_Test.cs
├── Flickr_TestAsync.cs
├── Flickr_Upload.cs
├── Flickr_UploadAsync.cs
├── Flickr_Urls.cs
├── Flickr_UrlsAsync.cs
├── Gallery.cs
├── GalleryCollection.cs
├── GalleryPhoto.cs
├── GalleryPhotoCollection.cs
├── GeoAccuracy.cs
├── GeoContext.cs
├── GeoPermissionType.cs
├── GeoPermissions.cs
├── GlobalSuppressions.cs
├── GlobalSuppressions2.cs
├── GroupCategory.cs
├── GroupFullInfo.cs
├── GroupInfo.cs
├── GroupInfoCollection.cs
├── GroupSearchResultCollection.cs
├── Groups.cs
├── HotTag.cs
├── HotTagCollection.cs
├── IFlickrParsable.cs
├── Institution.cs
├── InstitutionCollection.cs
├── License-Apache-2.0.txt
├── License-LGPL-2.1.txt
├── License.txt
├── LicenseCollection.cs
├── LicenseType.cs
├── Licenses.cs
├── LockFile.cs
├── MD5Core.cs
├── MD5Managed.cs
├── MediaType.cs
├── Member.cs
├── MemberCollection.cs
├── MemberGroupInfo.cs
├── MemberGroupInfoCollection.cs
├── MemberTypes.cs
├── MethodCollection.cs
├── Namespace.cs
├── NamespaceCollection.cs
├── NoResponse.cs
├── Notice-Apache-2.0.txt
├── OAuthAccessToken.cs
├── OAuthException.cs
├── OAuthRequestToken.cs
├── OpenCF
│ ├── Cipher.cs
│ ├── Const.cs
│ ├── Context.cs
│ ├── Crypto.cs
│ ├── DiffHell.cs
│ ├── Dsa.cs
│ ├── Enums.cs
│ ├── Error.cs
│ ├── Format.cs
│ ├── HMACSHA1.cs
│ ├── Hash.cs
│ ├── HashAlgorithm.cs
│ ├── Key.cs
│ ├── KeyedHashAlgorithm.cs
│ ├── Mem.cs
│ ├── Prov.cs
│ ├── Rand.cs
│ ├── Rsa.cs
│ ├── Structs.cs
│ └── _NullKey.cs
├── PagedPhotoCollection.cs
├── Pair.cs
├── PairCollection.cs
├── PandaPhotoCollection.cs
├── ParsingException.cs
├── PartialSearchOptions.cs
├── PeoplePhotoCollection.cs
├── PersistentCache.cs
├── Person.cs
├── PersonLimits.cs
├── Photo.cs
├── PhotoCollection.cs
├── PhotoComment.cs
├── PhotoCommentCollection.cs
├── PhotoCountCollection.cs
├── PhotoFavorite.cs
├── PhotoFavoriteCollection.cs
├── PhotoInfo.cs
├── PhotoPermissions.cs
├── PhotoPerson.cs
├── PhotoPersonCollection.cs
├── PhotoSearchExtras.cs
├── PhotoSearchOptions.cs
├── PhotoSearchOrder.cs
├── PhotoSetCollection.cs
├── Photoset.cs
├── PhotosetCommentCollection.cs
├── PhotosetPhotoCollection.cs
├── Place.cs
├── PlaceCollection.cs
├── PlaceInfo.cs
├── PlaceType.cs
├── PlaceTypeInfo.cs
├── PlaceTypeInfoCollection.cs
├── PoolPrivacy.cs
├── PopularPhoto.cs
├── PopularPhotoCollection.cs
├── PopularitySort.cs
├── Predicate.cs
├── PredicateCollection.cs
├── Profile.cs
├── ResponseXmlException.cs
├── SafeNativeMethods.cs
├── SerializableAttribute.cs
├── ShapeData.cs
├── ShapeDataCollection.cs
├── ShapeDataSL.cs
├── SignatureRequiredException.cs
├── Sizes.cs
├── StatDomain.cs
├── StatDomainCollection.cs
├── StatReferrer.cs
├── StatReferrerCollection.cs
├── StatViews.cs
├── Stats.cs
├── Subscription.cs
├── SubscriptionCollection.cs
├── Suggestion.cs
├── SuggestionCollection.cs
├── SuggestionStatus.cs
├── Tags.cs
├── Ticket.cs
├── TicketCollection.cs
├── Topic.cs
├── TopicCollection.cs
├── TopicReply.cs
├── TopicReplyCollection.cs
├── UnknownResponse.cs
├── UnknownResponseSL.cs
├── UploadProgressEvent.cs
├── UploadResponse.cs
├── User.cs
├── UserGeoPermissions.cs
├── UtilityMethods.cs
├── Value.cs
├── ValueCollection.cs
├── VideoInfo.cs
└── example_app.config
├── FlickrNetCF.sln
├── FlickrNetCodeBetter.sln
├── FlickrNetTest
├── ActivityTests.cs
├── Async
│ ├── PhotosAsyncTests.cs
│ ├── PhotosSearchAsyncTests.cs
│ ├── PhotosetsAsyncTests.cs
│ └── StatsAsyncTests.cs
├── Auth
│ ├── AuthHelper.cs
│ └── OAuthTests.cs
├── AuthTests.cs
├── BaseTest.cs
├── BlogTests.cs
├── BoundaryTests.cs
├── CacheTests.cs
├── CameraTests.cs
├── CheckTests.cs
├── CollectionTests.cs
├── CommonsTests.cs
├── ContactsTests.cs
├── FavoritesTests.cs
├── FlickrConfigurationSettingsTest.cs
├── FlickrNet.snk
├── FlickrNetTest.csproj
├── FlickrNetTest.csproj.vspscc
├── GalleriesTests.cs
├── GeoTests.cs
├── GroupsDiscussTests.cs
├── GroupsPoolsTests.cs
├── GroupsTests.cs
├── InterestingnessTests.cs
├── MachinetagsTests.cs
├── PandaTest.cs
├── PeopleTests.cs
├── PhotoOwnerNameTest.cs
├── PhotoSearchOptionsTests.cs
├── PhotosCommentsTests.cs
├── PhotosGeoTests.cs
├── PhotosGetContactsPhotos.cs
├── PhotosGetContactsPublicPhotosTests.cs
├── PhotosGetCountTests.cs
├── PhotosGetFavouritesTests.cs
├── PhotosGetInfoTests.cs
├── PhotosLicensesTests.cs
├── PhotosSearchTests.cs
├── PhotosSerializationTests.cs
├── PhotosSuggestionsTests.cs
├── PhotosTests.cs
├── PhotosUploadTests.cs
├── PhotosetCommentsGetListTests.cs
├── PhotosetsGetPhotosTests.cs
├── PhotosetsOrderSets.cs
├── PhotosetsTests.cs
├── PlacesTests.cs
├── PrefsTests.cs
├── ProfileTests.cs
├── Properties
│ └── AssemblyInfo.cs
├── PushTests.cs
├── ReflectionMethodTests.cs
├── StatsGetDomainsTests.cs
├── StatsGetPopularPhotosTests.cs
├── StatsGetReferrerTests.cs
├── StatsGetTotalViewsTest.cs
├── TagsTests.cs
├── TestData.cs
├── TestTests.cs
├── UrlHelper.cs
├── UrlsTests.cs
├── UtilityMethodsTests.cs
└── packages.config
├── FlickrNetVS10.sln
├── FlickrNetVS10.vssscc
├── FlickrNetWP7.sln
├── LICENSE
├── NuGet
├── FlickrNet.CF.nuspec
├── FlickrNet.Silverlight.nuspec
├── FlickrNet.WP7.nuspec
└── FlickrNet.nuspec
├── README.md
├── Sandcastle
└── Flickr Net Sandcastle File.shfbproj
├── Support
├── Flickr Net Sandcastle File.shfb
└── scriptcs_packages.config
├── deploy.proj
├── help.proj
├── localtestrun-codecoverage.testrunconfig
├── localtestrun.testrunconfig
└── packages
└── repositories.config
/.nuget/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.nuget/NuGet.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samjudson/flickr-net/32386d299740e895cb939e839fe5d5e8044d5a7c/.nuget/NuGet.exe
--------------------------------------------------------------------------------
/FlickrNet.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 10.00
3 | # Visual Studio 2008
4 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B0EA36B8-D7E6-48C8-B27C-0D76852660F2}"
5 | ProjectSection(SolutionItems) = preProject
6 | flickrnet.vsmdi = flickrnet.vsmdi
7 | localtestrun-codecoverage.testrunconfig = localtestrun-codecoverage.testrunconfig
8 | localtestrun.testrunconfig = localtestrun.testrunconfig
9 | EndProjectSection
10 | EndProject
11 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlickrNetCF", "FlickrNet\FlickrNetCF.csproj", "{DACD45D5-ED22-4DD5-9D1D-B1706E0AD1B9}"
12 | EndProject
13 | Global
14 | GlobalSection(SubversionScc) = preSolution
15 | Svn-Managed = True
16 | Manager = AnkhSVN - Subversion Support for Visual Studio
17 | EndGlobalSection
18 | GlobalSection(TestCaseManagementSettings) = postSolution
19 | CategoryFile = FlickrNet.vsmdi
20 | EndGlobalSection
21 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
22 | Debug|Any CPU = Debug|Any CPU
23 | Release|Any CPU = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
26 | {DACD45D5-ED22-4DD5-9D1D-B1706E0AD1B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {DACD45D5-ED22-4DD5-9D1D-B1706E0AD1B9}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {DACD45D5-ED22-4DD5-9D1D-B1706E0AD1B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {DACD45D5-ED22-4DD5-9D1D-B1706E0AD1B9}.Release|Any CPU.Build.0 = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | GlobalSection(MonoDevelopProperties) = preSolution
35 | StartupItem = FlickrNet\FlickrNet.csproj
36 | EndGlobalSection
37 | EndGlobal
38 |
--------------------------------------------------------------------------------
/FlickrNet/ActivityItemCollection.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.ObjectModel;
2 |
3 | namespace FlickrNet
4 | {
5 | ///
6 | /// A list of items.
7 | ///
8 | public sealed class ActivityItemCollection : Collection, IFlickrParsable
9 | {
10 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
11 | {
12 | if (reader.LocalName != "items")
13 | UtilityMethods.CheckParsingException(reader);
14 |
15 | reader.Read();
16 |
17 | while (reader.LocalName == "item")
18 | {
19 | var item = new ActivityItem();
20 | ((IFlickrParsable)item).Load(reader);
21 | Add(item);
22 | }
23 |
24 | reader.Skip();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/FlickrNet/ApiKeyRequiredException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace FlickrNet
4 | {
5 | ///
6 | /// Exception thrown is no API key is supplied.
7 | ///
8 | [Serializable]
9 | public class ApiKeyRequiredException : FlickrException
10 | {
11 | ///
12 | /// Initializes a new instance of the class.
13 | ///
14 | public ApiKeyRequiredException() : base("API Key is required for all method calls")
15 | {
16 | }
17 |
18 | ///
19 | /// Initializes a new instance of the class with a specified error message.
20 | ///
21 | ///
22 | public ApiKeyRequiredException(string message)
23 | : base(message)
24 | {
25 | }
26 |
27 | ///
28 | /// Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception.
29 | ///
30 | ///
31 | ///
32 | public ApiKeyRequiredException(string message, Exception innerException)
33 | : base(message, innerException)
34 | {
35 | }
36 |
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/FlickrNet/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.34014
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | using System;
12 | using System.Reflection;
13 | using System.Runtime.CompilerServices;
14 | using System.Runtime.InteropServices;
15 |
16 | [assembly: AssemblyTitle("Flickr .Net Api Library")]
17 | [assembly: AssemblyDescription(".Net library for accessing Flickr.com Api functionality")]
18 | [assembly: AssemblyCompany("http://flickrnet.codeplex.com")]
19 | [assembly: AssemblyProduct("Flickr .Net Api Library")]
20 | [assembly: AssemblyCopyright("Copyright © Sam Judson 2010")]
21 | [assembly: ComVisible(false)]
22 | [assembly: CLSCompliant(true)]
23 | [assembly: AssemblyVersion("3.14.0.0")]
24 |
25 |
26 |
--------------------------------------------------------------------------------
/FlickrNet/AssemblyInfoMore.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 | using System.Security;
4 | using System.Security.Permissions;
5 |
6 | [assembly: AssemblyDelaySign(false)]
7 | [assembly: AssemblyKeyName("")]
8 |
9 | #if !(MONOTOUCH || WindowsCE || SILVERLIGHT)
10 | [assembly: AllowPartiallyTrustedCallers]
11 | [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("FlickrNetTest, PublicKey="+
12 | "002400000480000094000000060200000024000052534131000400000100010039a991f658101cf8"+
13 | "2d418ece9ab591a8acd377989a62476f1d58198bed5af088625ca7b04abb869226a06c6dbaecc583"+
14 | "66fd588b5319a42cc2734ed940cd23de0a0756465b3bab83ab7f43faa8719195981470cf0d538281"+
15 | "5b5b2d372b4bfeedf08ba41678cd86a2ea62592a849c47e5fd58916cece1c3397694a6650668bfe1")]
16 | #endif
17 |
18 |
--------------------------------------------------------------------------------
/FlickrNet/AuthenticationRequiredException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace FlickrNet
4 | {
5 | ///
6 | /// Exception thrown when method requires authentication but no authentication token is supplied.
7 | ///
8 | [Serializable]
9 | public class AuthenticationRequiredException : FlickrException
10 | {
11 | ///
12 | /// Initializes a new instance of the class.
13 | ///
14 | public AuthenticationRequiredException() : base("Method requires authentication but no token supplied.")
15 | {
16 | }
17 |
18 | ///
19 | /// Initializes a new instance of the class with a specified error message.
20 | ///
21 | ///
22 | public AuthenticationRequiredException(string message)
23 | : base(message)
24 | {
25 | }
26 |
27 | ///
28 | /// Initializes a new instance of the class
29 | /// with a specified error message and a reference to the inner exception that is the cause of this exception.
30 | ///
31 | ///
32 | ///
33 | public AuthenticationRequiredException(string message, Exception innerException)
34 | : base(message, innerException)
35 | {
36 | }
37 |
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/FlickrNet/BlogCollection.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System;
3 | using System.Collections.ObjectModel;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// Contains a list of items for the user.
9 | ///
10 | public sealed class BlogCollection : Collection, IFlickrParsable
11 | {
12 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
13 | {
14 | if (reader.LocalName != "blogs")
15 | UtilityMethods.CheckParsingException(reader);
16 |
17 | reader.Read();
18 |
19 | while (reader.LocalName == "blog")
20 | {
21 | var b = new Blog();
22 | ((IFlickrParsable)b).Load(reader);
23 | Add(b);
24 | }
25 |
26 | // Skip to next element (if any)
27 | reader.Skip();
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/FlickrNet/BlogService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Xml;
5 |
6 | namespace FlickrNet
7 | {
8 |
9 | ///
10 | /// Details of the blog services supported by Flickr. e.g. Twitter, Blogger etc.
11 | ///
12 | public sealed class BlogService : IFlickrParsable
13 | {
14 | ///
15 | /// The unique ID for the blog service supported by Flickr.
16 | ///
17 | public string Id { get; set; }
18 | ///
19 | /// The name of the blog service supported by Flickr.
20 | ///
21 | public string Name { get; set; }
22 |
23 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
24 | {
25 | if (reader.LocalName != "service")
26 | UtilityMethods.CheckParsingException(reader);
27 |
28 | while (reader.MoveToNextAttribute())
29 | {
30 | switch (reader.LocalName)
31 | {
32 | case "id":
33 | Id = reader.Value;
34 | break;
35 | default:
36 | UtilityMethods.CheckParsingException(reader);
37 | break;
38 | }
39 | }
40 |
41 | reader.Read();
42 |
43 | Name = reader.ReadContentAsString();
44 |
45 | reader.Skip();
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/FlickrNet/BlogServiceCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Xml;
5 |
6 | namespace FlickrNet
7 | {
8 | ///
9 | /// A list of the blog services that Flickr aupports.
10 | ///
11 | public sealed class BlogServiceCollection : System.Collections.ObjectModel.Collection, IFlickrParsable
12 | {
13 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
14 | {
15 | if (reader.LocalName != "services")
16 | UtilityMethods.CheckParsingException(reader);
17 |
18 | reader.Read();
19 |
20 | while (reader.LocalName == "service")
21 | {
22 | var service = new BlogService();
23 | ((IFlickrParsable)service).Load(reader);
24 | Add(service);
25 | }
26 |
27 | reader.Skip();
28 |
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/FlickrNet/Brand.cs:
--------------------------------------------------------------------------------
1 | using System.Xml;
2 |
3 | namespace FlickrNet
4 | {
5 | ///
6 | /// A particular camera brand.
7 | ///
8 | public class Brand : IFlickrParsable
9 | {
10 | ///
11 | /// The name of the camera brand. e.g. "Canon".
12 | ///
13 | public string BrandName { get; set; }
14 |
15 | ///
16 | /// The ID of the camera brand. e.g. "canon".
17 | ///
18 | public string BrandId { get; set; }
19 |
20 | void IFlickrParsable.Load(XmlReader reader)
21 | {
22 | if (reader.LocalName != "brand")
23 | UtilityMethods.CheckParsingException(reader);
24 |
25 | while (reader.MoveToNextAttribute())
26 | {
27 | switch (reader.LocalName)
28 | {
29 | case "id":
30 | BrandId = reader.Value;
31 | break;
32 | case "name":
33 | BrandName = reader.Value;
34 | break;
35 | default:
36 | UtilityMethods.CheckParsingException(reader);
37 | break;
38 |
39 | }
40 | }
41 |
42 | reader.Skip();
43 | }
44 |
45 | }
46 | }
--------------------------------------------------------------------------------
/FlickrNet/BrandCollection.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.ObjectModel;
2 | using System.Xml;
3 |
4 | namespace FlickrNet
5 | {
6 | ///
7 | /// A collection of camera brands
8 | ///
9 | public class BrandCollection : Collection, IFlickrParsable
10 | {
11 | void IFlickrParsable.Load(XmlReader reader)
12 | {
13 | if (reader.LocalName != "brands")
14 | UtilityMethods.CheckParsingException(reader);
15 |
16 | reader.Read();
17 |
18 | while (reader.LocalName == "brand")
19 | {
20 | var b = new Brand();
21 | ((IFlickrParsable)b).Load(reader);
22 | Add(b);
23 | }
24 |
25 | // Skip to next element (if any)
26 | reader.Skip();
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/FlickrNet/CameraCollection.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.ObjectModel;
2 | using System.Xml;
3 |
4 | namespace FlickrNet
5 | {
6 | ///
7 | /// A collection of camera models for a particular brand.
8 | ///
9 | public class CameraCollection : Collection, IFlickrParsable
10 | {
11 | void IFlickrParsable.Load(XmlReader reader)
12 | {
13 | if (reader.LocalName != "cameras")
14 | UtilityMethods.CheckParsingException(reader);
15 |
16 | reader.Read();
17 |
18 | while (reader.LocalName == "camera")
19 | {
20 | var c = new Camera();
21 | ((IFlickrParsable)c).Load(reader);
22 | Add(c);
23 | }
24 |
25 | // Skip to next element (if any)
26 | reader.Skip();
27 |
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/FlickrNet/Cluster.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Collections.ObjectModel;
5 |
6 | namespace FlickrNet
7 | {
8 | ///
9 | /// A tag cluster (a tag and a group of common sibling tags).
10 | ///
11 | public sealed class Cluster : IFlickrParsable
12 | {
13 | ///
14 | /// The tag for which this cluster belongs.
15 | ///
16 | public string SourceTag { get; set; }
17 |
18 | ///
19 | /// The number of tags in this cluster.
20 | ///
21 | public int TotalTags { get; set; }
22 |
23 | ///
24 | /// The collection of tags in this cluster.
25 | ///
26 | public Collection Tags { get; set; }
27 |
28 | ///
29 | /// The cluster id for this cluster.
30 | ///
31 | public string ClusterId
32 | {
33 | get
34 | {
35 | if (Tags.Count >= 3)
36 | {
37 | return Tags[0] + "-" + Tags[1] + "-" + Tags[2];
38 | }
39 | else
40 | {
41 | var ids = new List();
42 | foreach (string s in Tags) ids.Add(s);
43 | return string.Join("-", ids.ToArray());
44 | }
45 | }
46 | }
47 |
48 | ///
49 | /// The URL for the clusters Flickr page.
50 | ///
51 | public string ClusterUrl
52 | {
53 | get
54 | {
55 | return string.Format(System.Globalization.CultureInfo.InvariantCulture, "https://www.flickr.com/photos/tags/{0}/clusters/{1}/", SourceTag, ClusterId);
56 | }
57 | }
58 |
59 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
60 | {
61 | Tags = new Collection();
62 |
63 | while (reader.MoveToNextAttribute())
64 | {
65 | switch (reader.LocalName)
66 | {
67 | case "total":
68 | TotalTags = reader.ReadContentAsInt();
69 | break;
70 | }
71 | }
72 |
73 | reader.Read();
74 |
75 | while (reader.LocalName == "tag")
76 | {
77 | Tags.Add(reader.ReadElementContentAsString());
78 | }
79 |
80 | reader.Read();
81 | }
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/FlickrNet/ClusterCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Collections.ObjectModel;
5 |
6 | namespace FlickrNet
7 | {
8 | ///
9 | /// A collection of instances.
10 | ///
11 | public sealed class ClusterCollection : Collection, IFlickrParsable
12 | {
13 | ///
14 | /// The source tag for this cluster collection.
15 | ///
16 | public string SourceTag { get; set; }
17 |
18 | ///
19 | /// The total number of clusters for this tag.
20 | ///
21 | public int TotalClusters { get; set; }
22 |
23 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
24 | {
25 | while (reader.MoveToNextAttribute())
26 | {
27 | switch (reader.LocalName)
28 | {
29 | case "source":
30 | SourceTag = reader.Value;
31 | break;
32 | case "total":
33 | TotalClusters = reader.ReadContentAsInt();
34 | break;
35 | }
36 | }
37 |
38 | reader.Read();
39 |
40 | while (reader.LocalName == "cluster")
41 | {
42 | var item = new Cluster();
43 | ((IFlickrParsable)item).Load(reader);
44 | item.SourceTag = SourceTag;
45 | Add(item);
46 | }
47 |
48 | reader.Skip();
49 |
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/FlickrNet/CodeAnalysisDictionary.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Flickr
6 | Blog
7 | Blogs
8 | Permalink
9 | Exif
10 | Frob
11 | Prefs
12 | Photostream
13 | Persister
14 | Parsable
15 | Zooomr
16 | Neighbourhood
17 | Sha
18 | Favorited
19 | Coords
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/FlickrNet/CollectionCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml.Serialization;
3 | using System.Xml.Schema;
4 | using System.Collections.Generic;
5 |
6 | namespace FlickrNet
7 | {
8 | ///
9 | public sealed class CollectionCollection : System.Collections.ObjectModel.Collection, IFlickrParsable
10 | {
11 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
12 | {
13 | if (reader.LocalName != "collections")
14 | UtilityMethods.CheckParsingException(reader);
15 |
16 | reader.Read();
17 |
18 | while (reader.LocalName == "collection")
19 | {
20 | var c = new Collection();
21 | ((IFlickrParsable)c).Load(reader);
22 | Add(c);
23 | }
24 |
25 | // Skip to next element (if any)
26 | reader.Skip();
27 | }
28 | }
29 |
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/FlickrNet/CollectionSet.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml.Serialization;
3 | using System.Xml.Schema;
4 | using System.Xml;
5 |
6 | namespace FlickrNet
7 | {
8 | ///
9 | ///
10 | ///
11 | public sealed class CollectionSet : IFlickrParsable
12 | {
13 | ///
14 | public string SetId { get; set; }
15 |
16 | ///
17 | public string Title { get; set; }
18 |
19 | ///
20 | public string Description { get; set; }
21 |
22 | void IFlickrParsable.Load(XmlReader reader)
23 | {
24 | if (reader.LocalName != "set")
25 | UtilityMethods.CheckParsingException(reader);
26 |
27 | while (reader.MoveToNextAttribute())
28 | {
29 | switch (reader.LocalName)
30 | {
31 | case "id":
32 | SetId = reader.Value;
33 | break;
34 | case "title":
35 | Title = reader.Value;
36 | break;
37 | case "description":
38 | Description = reader.Value;
39 | break;
40 | default:
41 | UtilityMethods.CheckParsingException(reader);
42 | break;
43 |
44 | }
45 | }
46 |
47 | reader.Skip();
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/FlickrNet/CsvFile.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// The details of a CSV files containing archived stats available for download from Flickr.
9 | ///
10 | ///
11 | /// Only available till the 1st June 2010.
12 | ///
13 | public sealed class CsvFile : IFlickrParsable
14 | {
15 | ///
16 | /// The web reference for the file.
17 | ///
18 | public string Href { get; set; }
19 |
20 | ///
21 | /// The date the file was created for.
22 | ///
23 | public DateTime Date { get; set; }
24 |
25 | ///
26 | /// The type of file archive (either "m" for Month or "d" for day).
27 | ///
28 | public string Type { get; set; }
29 |
30 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
31 | {
32 | while (reader.MoveToNextAttribute())
33 | {
34 | switch (reader.LocalName)
35 | {
36 | case "href":
37 | Href = reader.Value;
38 | break;
39 | case "type":
40 | Type = reader.Value;
41 | break;
42 | case "date":
43 | Date = DateTime.Parse(reader.Value, System.Globalization.DateTimeFormatInfo.CurrentInfo, System.Globalization.DateTimeStyles.None);
44 | break;
45 | }
46 | }
47 |
48 | reader.Read();
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/FlickrNet/CsvFileCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// The collection of CSV files containing archived stats available for download from Flickr.
9 | ///
10 | ///
11 | /// Only supported until the 1st June 2010.
12 | ///
13 | public sealed class CsvFileCollection : System.Collections.ObjectModel.Collection, IFlickrParsable
14 | {
15 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
16 | {
17 | reader.ReadToDescendant("csv");
18 |
19 | while (reader.LocalName == "csv" && reader.NodeType != System.Xml.XmlNodeType.EndElement)
20 | {
21 | var file = new CsvFile();
22 | ((IFlickrParsable)file).Load(reader);
23 | Add(file);
24 | }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/FlickrNet/DateGranularity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace FlickrNet
4 | {
5 | ///
6 | /// DateGranularity, used for setting taken date in
7 | /// or .
8 | ///
9 | public enum DateGranularity
10 | {
11 | ///
12 | /// The date specified is the exact date the photograph was taken.
13 | ///
14 | FullDate = 0,
15 | ///
16 | /// The date specified is the year and month the photograph was taken.
17 | ///
18 | YearMonthOnly = 4,
19 | ///
20 | /// The date specified is the year the photograph was taken.
21 | ///
22 | YearOnly = 6,
23 | ///
24 | /// The date is an approximation only and only the year is likely to be supplied.
25 | ///
26 | Circa = 8
27 |
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/FlickrNet/EchoResponseDictionary.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// The response returned by the method.
9 | ///
10 | [Serializable]
11 | public sealed class EchoResponseDictionary : Dictionary, IFlickrParsable
12 | {
13 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
14 | {
15 | while (reader.NodeType != System.Xml.XmlNodeType.None && reader.NodeType != System.Xml.XmlNodeType.EndElement)
16 | {
17 | Add(reader.Name, reader.ReadElementContentAsString());
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/FlickrNet/Exceptions/BadUrlFoundException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace FlickrNet.Exceptions
7 | {
8 | ///
9 | /// A user was included in a description or comment which Flickr rejected.
10 | ///
11 | public sealed class BadUrlFoundException : FlickrApiException
12 | {
13 | internal BadUrlFoundException(string message)
14 | : base(111, message)
15 | {
16 | }
17 |
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/FlickrNet/Exceptions/FormatNotFoundException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace FlickrNet.Exceptions
7 | {
8 | ///
9 | /// The specified format (e.g. json) was not found.
10 | ///
11 | ///
12 | /// The FlickrNet library only uses one format, so you should not experience this error.
13 | ///
14 | public sealed class FormatNotFoundException : FlickrApiException
15 | {
16 | internal FormatNotFoundException(string message)
17 | : base(111, message)
18 | {
19 | }
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/FlickrNet/Exceptions/InvalidApiKeyException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet.Exceptions
6 | {
7 | ///
8 | /// Error: 100: Invalid API Key
9 | ///
10 | ///
11 | /// The API key passed was not valid or has expired.
12 | ///
13 | public class InvalidApiKeyException : FlickrApiException
14 | {
15 | internal InvalidApiKeyException(string message)
16 | : base(100, message)
17 | {
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/FlickrNet/Exceptions/InvalidSignatureException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet.Exceptions
6 | {
7 | ///
8 | /// Error: 96: Invalid signature
9 | ///
10 | ///
11 | /// The passed signature was invalid.
12 | ///
13 | public class InvalidSignatureException : FlickrApiException
14 | {
15 | internal InvalidSignatureException(string message)
16 | : base(96, message)
17 | {
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/FlickrNet/Exceptions/LoginFailedInvalidTokenException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet.Exceptions
6 | {
7 | ///
8 | /// Error: 98: Login failed / Invalid auth token
9 | ///
10 | ///
11 | /// The login details or auth token passed were invalid.
12 | ///
13 | public class LoginFailedInvalidTokenException : FlickrApiException
14 | {
15 | internal LoginFailedInvalidTokenException(string message)
16 | : base(98, message)
17 | {
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/FlickrNet/Exceptions/MethodNotFoundException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace FlickrNet.Exceptions
7 | {
8 | ///
9 | /// The method name supplied was not recognised by Flickr.
10 | ///
11 | ///
12 | /// While using the FlickrNet library you should not encounter this error,
13 | /// unless Flickr removes a particular method from the API.
14 | ///
15 | public sealed class MethodNotFoundException : FlickrApiException
16 | {
17 | internal MethodNotFoundException(string message)
18 | : base(111, message)
19 | {
20 | }
21 |
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/FlickrNet/Exceptions/MissingSignatureException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet.Exceptions
6 | {
7 | ///
8 | /// Error 97: Missing signature exception.
9 | ///
10 | ///
11 | /// The call required signing but no signature was sent.
12 | ///
13 | public class MissingSignatureException : FlickrApiException
14 | {
15 | internal MissingSignatureException(string message)
16 | : base(97, message)
17 | {
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/FlickrNet/Exceptions/PermissionDeniedException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet.Exceptions
6 | {
7 | ///
8 | /// Error: Permission Denied.
9 | ///
10 | ///
11 | /// The owner of the photo does not want to share the data wih you.
12 | ///
13 | public class PermissionDeniedException : FlickrApiException
14 | {
15 | internal PermissionDeniedException(int code, string message)
16 | : base(code, message)
17 | {
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/FlickrNet/Exceptions/PhotoNotFoundException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet.Exceptions
6 | {
7 | ///
8 | /// No photo with the photo ID supplied to the method could be found.
9 | ///
10 | ///
11 | /// This could mean the photo does not exist, or that you do not have permission to view the photo.
12 | ///
13 | public class PhotoNotFoundException : FlickrApiException
14 | {
15 | internal PhotoNotFoundException(int code, string message)
16 | : base(code, message)
17 | {
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/FlickrNet/Exceptions/PhotosetNotFoundException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet.Exceptions
6 | {
7 | ///
8 | /// No photoset with the photoset ID supplied to the method could be found.
9 | ///
10 | ///
11 | /// This could mean the photoset does not exist, or that you do not have permission to view the photoset.
12 | ///
13 | public class PhotosetNotFoundException : FlickrApiException
14 | {
15 | internal PhotosetNotFoundException(int code, string message)
16 | : base(code, message)
17 | {
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/FlickrNet/Exceptions/ServiceUnavailableException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet.Exceptions
6 | {
7 | ///
8 | /// Error: 105: Service currently unavailable
9 | ///
10 | ///
11 | /// The requested service is temporarily unavailable.
12 | ///
13 | public class ServiceUnavailableException : FlickrApiException
14 | {
15 | internal ServiceUnavailableException(string message)
16 | : base(105, message)
17 | {
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/FlickrNet/Exceptions/UserNotFoundException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet.Exceptions
6 | {
7 | ///
8 | /// No user with the user ID supplied to the method could be found.
9 | ///
10 | ///
11 | /// This could mean the user does not exist, or that you do not have permission to view the user.
12 | ///
13 | public class UserNotFoundException : FlickrApiException
14 | {
15 | internal UserNotFoundException(int code, string message)
16 | : base(code, message)
17 | {
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/FlickrNet/Exceptions/UserNotLoggedInInsufficientPermissionsException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet.Exceptions
6 | {
7 | ///
8 | /// Error: 99: User not logged in / Insufficient permissions
9 | ///
10 | ///
11 | /// The method requires user authentication but the user was not logged in,
12 | /// or the authenticated method call did not have the required permissions.
13 | ///
14 | public class UserNotLoggedInInsufficientPermissionsException : FlickrApiException
15 | {
16 | internal UserNotLoggedInInsufficientPermissionsException(string message)
17 | : base(99, message)
18 | {
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/FlickrNet/FavoriteContext.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Collections.ObjectModel;
5 |
6 | namespace FlickrNet
7 | {
8 | ///
9 | /// The total number of favorites for a user, along with the next and previous favorite photos.
10 | ///
11 | public sealed class FavoriteContext : IFlickrParsable
12 | {
13 | ///
14 | /// The number of favorites the user has.
15 | ///
16 | public int Count { get; set; }
17 |
18 | ///
19 | /// The list of previous photos for this favorite. Defaults to just a single photo.
20 | ///
21 | public Collection PreviousPhotos { get; set; }
22 |
23 | ///
24 | /// The list of next photos for this favorite. Defaults to just a single photo.
25 | ///
26 | public Collection NextPhotos { get; set; }
27 |
28 | ///
29 | /// Default constructor for
30 | ///
31 | public FavoriteContext()
32 | {
33 | PreviousPhotos = new Collection();
34 | NextPhotos = new Collection();
35 | }
36 |
37 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
38 | {
39 |
40 | if (reader.LocalName != "count" && !reader.ReadToFollowing("count"))
41 | {
42 | UtilityMethods.CheckParsingException(reader);
43 | return;
44 | }
45 |
46 | Count = reader.ReadElementContentAsInt();
47 |
48 | if( reader.LocalName != "prevphotos" ) reader.ReadToFollowing("prevphotos");
49 | reader.ReadToDescendant("photo");
50 | while (reader.LocalName == "photo")
51 | {
52 | var photo = new FavoriteContextPhoto();
53 | ((IFlickrParsable)photo).Load(reader);
54 | PreviousPhotos.Add(photo);
55 | }
56 |
57 | if (reader.LocalName != "nextphotos") reader.ReadToFollowing("nextphotos");
58 | reader.ReadToDescendant("photo");
59 | while (reader.LocalName == "photo")
60 | {
61 | var photo = new FavoriteContextPhoto();
62 | ((IFlickrParsable)photo).Load(reader);
63 | NextPhotos.Add(photo);
64 | }
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/FlickrNet/FavoriteContextPhoto.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// A photo in the context of a favorite. Returned as part of a call to .
9 | ///
10 | public sealed class FavoriteContextPhoto : Photo, IFlickrParsable
11 | {
12 | ///
13 | /// The thumbnail url for the image. Will be the same as if that is also set.
14 | ///
15 | public string FavoriteThumbnailUrl { get; set; }
16 |
17 | ///
18 | /// The URL for the favorite, with the context of the user as well.
19 | ///
20 | public string FavoriteUrl { get; set; }
21 |
22 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
23 | {
24 | FavoriteThumbnailUrl = reader.GetAttribute("thumb");
25 | FavoriteUrl = reader.GetAttribute("url");
26 |
27 | Load(reader, true);
28 |
29 | reader.Skip();
30 | }
31 |
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/FlickrNet/FlickrConfigurationManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Configuration;
3 | using System.Xml;
4 |
5 | #if !(MONOTOUCH || WindowsCE || SILVERLIGHT)
6 | namespace FlickrNet
7 | {
8 | ///
9 | /// Summary description for FlickrConfigurationManager.
10 | ///
11 | internal class FlickrConfigurationManager : IConfigurationSectionHandler
12 | {
13 | private static string configSection = "flickrNet";
14 | private static FlickrConfigurationSettings settings;
15 |
16 | public static FlickrConfigurationSettings Settings
17 | {
18 | get
19 | {
20 | if (settings == null)
21 | {
22 | settings = (FlickrConfigurationSettings)ConfigurationManager.GetSection(configSection);
23 | }
24 |
25 | return settings;
26 | }
27 | }
28 |
29 | public object Create(object parent, object configContext, XmlNode section)
30 | {
31 | configSection = section.Name;
32 | return new FlickrConfigurationSettings(section);
33 | }
34 | }
35 | }
36 | #endif
37 |
--------------------------------------------------------------------------------
/FlickrNet/FlickrException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace FlickrNet
4 | {
5 | ///
6 | /// Generic Flickr.Net Exception.
7 | ///
8 | public class FlickrException : Exception
9 | {
10 | ///
11 | /// Initializes a new instance of the class.
12 | ///
13 | public FlickrException()
14 | {
15 | }
16 |
17 | ///
18 | /// Initializes a new instance of the class with a specified error message.
19 | ///
20 | ///
21 | public FlickrException(string message) : base(message)
22 | {
23 | }
24 |
25 | ///
26 | /// Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception.
27 | ///
28 | ///
29 | ///
30 | public FlickrException(string message, Exception innerException) : base(message, innerException)
31 | {
32 | }
33 |
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/FlickrNet/FlickrNet.csproj.vspscc:
--------------------------------------------------------------------------------
1 | ""
2 | {
3 | "FILE_VERSION" = "9237"
4 | "ENLISTMENT_CHOICE" = "NEVER"
5 | "PROJECT_FILE_RELATIVE_PATH" = ""
6 | "NUMBER_OF_EXCLUDED_FILES" = "0"
7 | "ORIGINAL_PROJECT_FILE_PATH" = ""
8 | "NUMBER_OF_NESTED_PROJECTS" = "0"
9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
10 | }
11 |
--------------------------------------------------------------------------------
/FlickrNet/FlickrNet.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samjudson/flickr-net/32386d299740e895cb939e839fe5d5e8044d5a7c/FlickrNet/FlickrNet.snk
--------------------------------------------------------------------------------
/FlickrNet/FlickrNetSilverlight.csproj.vspscc:
--------------------------------------------------------------------------------
1 | ""
2 | {
3 | "FILE_VERSION" = "9237"
4 | "ENLISTMENT_CHOICE" = "NEVER"
5 | "PROJECT_FILE_RELATIVE_PATH" = ""
6 | "NUMBER_OF_EXCLUDED_FILES" = "0"
7 | "ORIGINAL_PROJECT_FILE_PATH" = ""
8 | "NUMBER_OF_NESTED_PROJECTS" = "0"
9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
10 | }
11 |
--------------------------------------------------------------------------------
/FlickrNet/FlickrNetWP7.csproj.vspscc:
--------------------------------------------------------------------------------
1 | ""
2 | {
3 | "FILE_VERSION" = "9237"
4 | "ENLISTMENT_CHOICE" = "NEVER"
5 | "PROJECT_FILE_RELATIVE_PATH" = ""
6 | "NUMBER_OF_EXCLUDED_FILES" = "0"
7 | "ORIGINAL_PROJECT_FILE_PATH" = ""
8 | "NUMBER_OF_NESTED_PROJECTS" = "0"
9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
10 | }
11 |
--------------------------------------------------------------------------------
/FlickrNet/FlickrWebException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace FlickrNet
4 | {
5 | ///
6 | /// Exception thrown when a communication error occurs with a web call.
7 | ///
8 | [Serializable]
9 | public class FlickrWebException : FlickrException
10 | {
11 | ///
12 | /// Initializes a new instance of the class.
13 | ///
14 | public FlickrWebException()
15 | : base()
16 | {
17 | }
18 |
19 | ///
20 | /// Initializes a new instance of the class with a specified error message.
21 | ///
22 | ///
23 | public FlickrWebException(string message)
24 | : base(message)
25 | {
26 | }
27 |
28 | ///
29 | /// Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception.
30 | ///
31 | ///
32 | ///
33 | public FlickrWebException(string message, Exception innerException)
34 | : base(message, innerException)
35 | {
36 | }
37 |
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/FlickrNet/Flickr_Cameras.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | public partial class Flickr
8 | {
9 | ///
10 | ///
11 | ///
12 | ///
13 | public BrandCollection CamerasGetBrands()
14 | {
15 | var parameters = new Dictionary {{"method", "flickr.cameras.getBrands"}};
16 | return GetResponseCache(parameters);
17 | }
18 |
19 | ///
20 | /// Get a list of camera models for a particular brand id.
21 | ///
22 | ///
23 | ///
24 | public CameraCollection CamerasGetBrandModels(string brandId)
25 | {
26 | var parameters = new Dictionary
27 | {
28 | {"method", "flickr.cameras.getBrandModels"},
29 | {"brand", brandId}
30 | };
31 | return GetResponseCache(parameters);
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/FlickrNet/Flickr_CamerasAsync.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | public partial class Flickr
8 | {
9 | ///
10 | /// Gets a list of camera brands.
11 | ///
12 | /// Callback method to call upon return of the response from Flickr.
13 | ///
14 | public void CamerasGetBrandsAsync(Action> callback )
15 | {
16 | var parameters = new Dictionary { { "method", "flickr.cameras.getBrands" } };
17 | GetResponseAsync(parameters, callback);
18 | }
19 |
20 | ///
21 | /// Get a list of camera models for a particular brand id.
22 | ///
23 | /// The ID of the brand you want the models of.
24 | /// Callback method to call upon return of the response from Flickr.
25 | ///
26 | public void CamerasGetBrandModelsAsync(string brandId, Action> callback)
27 | {
28 | var parameters = new Dictionary
29 | {
30 | {"method", "flickr.cameras.getBrandModels"},
31 | {"brand", brandId}
32 | };
33 | GetResponseAsync(parameters, callback);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/FlickrNet/Flickr_CollectionsAsync.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Collections;
5 |
6 | namespace FlickrNet
7 | {
8 | public partial class Flickr
9 | {
10 |
11 | ///
12 | /// Gets information about a collection. Requires authentication with 'read' access.
13 | ///
14 | /// The ID for the collection to return.
15 | /// Callback method to call upon return of the response from Flickr.
16 | public void CollectionsGetInfoAsync(string collectionId, Action> callback)
17 | {
18 | CheckRequiresAuthentication();
19 |
20 | var parameters = new Dictionary();
21 | parameters.Add("method", "flickr.collections.getInfo");
22 | parameters.Add("collection_id", collectionId);
23 |
24 | GetResponseAsync(parameters, callback);
25 |
26 | }
27 |
28 | ///
29 | /// Gets a tree of collection. Requires authentication.
30 | ///
31 | /// Callback method to call upon return of the response from Flickr.
32 | public void CollectionsGetTreeAsync(Action> callback)
33 | {
34 | CollectionsGetTreeAsync(null, null, callback);
35 | }
36 |
37 | ///
38 | /// Gets a tree of collection.
39 | ///
40 | /// The ID of the collection to fetch a tree for, or zero to fetch the root collection.
41 | /// The ID of the user to fetch the tree for, or null if using the authenticated user.
42 | /// Callback method to call upon return of the response from Flickr.
43 | public void CollectionsGetTreeAsync(string collectionId, string userId, Action> callback)
44 | {
45 | if (string.IsNullOrEmpty(userId)) CheckRequiresAuthentication();
46 |
47 | var parameters = new Dictionary();
48 | parameters.Add("method", "flickr.collections.getTree");
49 | if (collectionId != null) parameters.Add("collection_id", collectionId);
50 | if (userId != null) parameters.Add("user_id", userId);
51 |
52 | GetResponseAsync(parameters, callback);
53 | }
54 |
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/FlickrNet/Flickr_Commons.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | public partial class Flickr
8 | {
9 | ///
10 | /// Gets a collection of Flickr Commons institutions.
11 | ///
12 | ///
13 | public InstitutionCollection CommonsGetInstitutions()
14 | {
15 | var parameters = new Dictionary();
16 | parameters.Add("method", "flickr.commons.getInstitutions");
17 |
18 | return GetResponseCache(parameters);
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/FlickrNet/Flickr_CommonsAsync.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | public partial class Flickr
8 | {
9 | ///
10 | /// Gets a collection of Flickr Commons institutions.
11 | ///
12 | /// Callback method to call upon return of the response from Flickr.
13 | public void CommonsGetInstitutionsAsync(Action> callback)
14 | {
15 | var parameters = new Dictionary();
16 | parameters.Add("method", "flickr.commons.getInstitutions");
17 |
18 | GetResponseAsync(parameters, callback);
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/FlickrNet/Flickr_PhotosMisc.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Collections;
5 |
6 | namespace FlickrNet
7 | {
8 | public partial class Flickr
9 | {
10 | ///
11 | /// Rotates a photo on Flickr.
12 | ///
13 | ///
14 | /// Does not rotate the original photo.
15 | ///
16 | /// The ID of the photo.
17 | /// The number of degrees to rotate by. Valid values are 90, 180 and 270.
18 | public void PhotosTransformRotate(string photoId, int degrees)
19 | {
20 | if (photoId == null)
21 | throw new ArgumentNullException("photoId");
22 | if (degrees != 90 && degrees != 180 && degrees != 270)
23 | throw new ArgumentException("Must be 90, 180 or 270", "degrees");
24 |
25 | var parameters = new Dictionary();
26 | parameters.Add("method", "flickr.photos.transform.rotate");
27 | parameters.Add("photo_id", photoId);
28 | parameters.Add("degrees", degrees.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
29 |
30 | GetResponseNoCache(parameters);
31 | }
32 |
33 | ///
34 | /// Checks the status of one or more asynchronous photo upload tickets.
35 | ///
36 | /// A list of ticket ids
37 | ///
38 | public TicketCollection PhotosUploadCheckTickets(string[] tickets)
39 | {
40 | var parameters = new Dictionary();
41 | parameters.Add("method", "flickr.photos.upload.checkTickets");
42 | parameters.Add("tickets", string.Join(",", tickets));
43 |
44 | return GetResponseNoCache(parameters);
45 | }
46 |
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/FlickrNet/Flickr_PhotosMiscAsync.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Collections;
5 |
6 | namespace FlickrNet
7 | {
8 | public partial class Flickr
9 | {
10 | ///
11 | /// Rotates a photo on Flickr.
12 | ///
13 | ///
14 | /// Does not rotate the original photo.
15 | ///
16 | /// The ID of the photo.
17 | /// The number of degrees to rotate by. Valid values are 90, 180 and 270.
18 | /// Callback method to call upon return of the response from Flickr.
19 | public void PhotosTransformRotateAsync(string photoId, int degrees, Action> callback)
20 | {
21 | if (photoId == null)
22 | throw new ArgumentNullException("photoId");
23 | if (degrees != 90 && degrees != 180 && degrees != 270)
24 | throw new ArgumentException("Must be 90, 180 or 270", "degrees");
25 |
26 | var parameters = new Dictionary();
27 | parameters.Add("method", "flickr.photos.transform.rotate");
28 | parameters.Add("photo_id", photoId);
29 | parameters.Add("degrees", degrees.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
30 |
31 | GetResponseAsync(parameters, callback);
32 | }
33 |
34 | ///
35 | /// Checks the status of one or more asynchronous photo upload tickets.
36 | ///
37 | /// A list of ticket ids
38 | /// Callback method to call upon return of the response from Flickr.
39 | public void PhotosUploadCheckTicketsAsync(string[] tickets, Action> callback)
40 | {
41 | var parameters = new Dictionary();
42 | parameters.Add("method", "flickr.photos.upload.checkTickets");
43 | parameters.Add("tickets", string.Join(",", tickets));
44 |
45 | GetResponseAsync(parameters, callback);
46 | }
47 |
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/FlickrNet/Flickr_Profile.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace FlickrNet
4 | {
5 | public partial class Flickr
6 | {
7 | ///
8 | /// Get a users profile properties.
9 | ///
10 | /// The id of the user to get the profile for.
11 | /// A instance containing the details of the users profile.
12 | public Profile ProfileGetProfile(string userId)
13 | {
14 | var parameters = new Dictionary {
15 | { "method", "flickr.profile.getProfile" },
16 | { "user_id", userId }
17 | };
18 |
19 | return GetResponseCache(parameters);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/FlickrNet/Flickr_Reflection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Collections;
5 |
6 | namespace FlickrNet
7 | {
8 | public partial class Flickr
9 | {
10 | ///
11 | /// Gets an array of supported method names for Flickr.
12 | ///
13 | ///
14 | /// Note: Not all methods might be supported by the FlickrNet Library.
15 | ///
16 | public MethodCollection ReflectionGetMethods()
17 | {
18 | var parameters = new Dictionary();
19 | parameters.Add("method", "flickr.reflection.getMethods");
20 |
21 | return GetResponseNoCache(parameters);
22 | }
23 |
24 | ///
25 | /// Gets the method details for a given method.
26 | ///
27 | /// The name of the method to retrieve.
28 | /// Returns a instance for the given method name.
29 | public Method ReflectionGetMethodInfo(string methodName)
30 | {
31 | var parameters = new Dictionary();
32 | parameters.Add("method", "flickr.reflection.getMethodInfo");
33 | parameters.Add("api_key", apiKey);
34 | parameters.Add("method_name", methodName);
35 |
36 | return GetResponseNoCache(parameters);
37 | }
38 |
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/FlickrNet/Flickr_ReflectionAsync.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Collections;
5 |
6 | namespace FlickrNet
7 | {
8 | public partial class Flickr
9 | {
10 | ///
11 | /// Gets an array of supported method names for Flickr.
12 | ///
13 | ///
14 | /// Note: Not all methods might be supported by the FlickrNet Library.
15 | /// Callback method to call upon return of the response from Flickr.
16 | public void ReflectionGetMethodsAsync(Action> callback)
17 | {
18 | var parameters = new Dictionary();
19 | parameters.Add("method", "flickr.reflection.getMethods");
20 |
21 | GetResponseAsync(parameters, callback);
22 | }
23 |
24 | ///
25 | /// Gets the method details for a given method.
26 | ///
27 | /// The name of the method to retrieve.
28 | /// Callback method to call upon return of the response from Flickr.
29 | public void ReflectionGetMethodInfoAsync(string methodName, Action> callback)
30 | {
31 | var parameters = new Dictionary();
32 | parameters.Add("method", "flickr.reflection.getMethodInfo");
33 | parameters.Add("api_key", apiKey);
34 | parameters.Add("method_name", methodName);
35 |
36 | GetResponseAsync(parameters, callback);
37 | }
38 |
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/FlickrNet/GalleryPhoto.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// An instance of a photo returned by .
9 | ///
10 | public class GalleryPhoto : Photo, IFlickrParsable
11 | {
12 | ///
13 | /// The comment added to this photo in the gallery, if any.
14 | ///
15 | public string Comment { get; set; }
16 |
17 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
18 | {
19 | Load(reader, false);
20 |
21 | if (reader.LocalName == "comment")
22 | Comment = reader.ReadElementContentAsString();
23 |
24 | if (reader.LocalName == "description")
25 | Description = reader.ReadElementContentAsString();
26 |
27 | if (reader.NodeType == System.Xml.XmlNodeType.EndElement && reader.LocalName == "photo")
28 | reader.Skip();
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/FlickrNet/GeoAccuracy.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace FlickrNet
4 | {
5 | ///
6 | /// Geo-taggin accuracy. Used in and .
7 | ///
8 | ///
9 | /// Level descriptions are only approximate.
10 | ///
11 | [Serializable]
12 | public enum GeoAccuracy
13 | {
14 | ///
15 | /// No accuracy level specified.
16 | ///
17 | None = 0,
18 | ///
19 | /// World level, level 1.
20 | ///
21 | World = 1,
22 | ///
23 | /// Level 2
24 | ///
25 | Level2 = 2,
26 | ///
27 | /// Level 3 - approximately Country level.
28 | ///
29 | Country = 3,
30 | ///
31 | /// Level 4
32 | ///
33 | Level4 = 4,
34 | ///
35 | /// Level 5
36 | ///
37 | Level5 = 5,
38 | ///
39 | /// Level 6 - approximately Region level
40 | ///
41 | Region = 6,
42 | ///
43 | /// Level 7
44 | ///
45 | Level7 = 7,
46 | ///
47 | /// Level 8
48 | ///
49 | Level8 = 8,
50 | ///
51 | /// Level 9
52 | ///
53 | Level9 = 9,
54 | ///
55 | /// Level 10
56 | ///
57 | Level10 = 10,
58 | ///
59 | /// Level 11 - approximately City level
60 | ///
61 | City = 11,
62 | ///
63 | /// Level 12
64 | ///
65 | Level12 = 12,
66 | ///
67 | /// Level 13
68 | ///
69 | Level13 = 13,
70 | ///
71 | /// Level 14
72 | ///
73 | Level14 = 14,
74 | ///
75 | /// Level 15
76 | ///
77 | Level15 = 15,
78 | ///
79 | /// Street level (16) - the most accurate level and the default.
80 | ///
81 | Street = 16
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/FlickrNet/GeoContext.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// The context to set a geotagged photo as. Used by .
9 | ///
10 | public enum GeoContext
11 | {
12 | ///
13 | /// The photo has no defined context.
14 | ///
15 | NotDefined = 0,
16 | ///
17 | /// The photo was taken indoors.
18 | ///
19 | Indoors = 1,
20 | ///
21 | /// The photo was taken outdoors.
22 | ///
23 | Outdoors = 2
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/FlickrNet/GeoPermissionType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// The default privacy level for geographic information attached to the user's photos.
9 | ///
10 | public enum GeoPermissionType
11 | {
12 | ///
13 | /// No default set.
14 | ///
15 | None = 0,
16 | ///
17 | /// Anyone can see the geographic information.
18 | ///
19 | Public = 1,
20 | ///
21 | /// Only contacts can see the geographic information.
22 | ///
23 | ContactsOnly = 2,
24 | ///
25 | /// Only Friends and Family can see the geographic information.
26 | ///
27 | FriendsAndFamilyOnly = 3,
28 | ///
29 | /// Only Friends can see the geographic information.
30 | ///
31 | FriendsOnly = 4,
32 | ///
33 | /// Only Family can see the geographic information.
34 | ///
35 | FamilyOnly = 5,
36 | ///
37 | /// Only you can see the geographic information.
38 | ///
39 | Private = 6
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/FlickrNet/GeoPermissions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml;
3 |
4 | namespace FlickrNet
5 | {
6 | ///
7 | /// Permissions for the selected photo.
8 | ///
9 | public sealed class GeoPermissions : IFlickrParsable
10 | {
11 | ///
12 | /// The ID for the photo whose permissions these are.
13 | ///
14 | public string PhotoId { get; set; }
15 |
16 | ///
17 | /// Are the general unwashed (public) allowed to see the Geo Location information for this photo.
18 | ///
19 | public bool IsPublic { get; set; }
20 |
21 | ///
22 | /// Are contacts allowed to see the Geo Location information for this photo.
23 | ///
24 | public bool IsContact { get; set; }
25 |
26 | ///
27 | /// Are friends allowed to see the Geo Location information for this photo.
28 | ///
29 | public bool IsFriend { get; set; }
30 |
31 | ///
32 | /// Are family allowed to see the Geo Location information for this photo.
33 | ///
34 | public bool IsFamily { get; set; }
35 |
36 | void IFlickrParsable.Load(XmlReader reader)
37 | {
38 | while (reader.MoveToNextAttribute())
39 | {
40 | switch (reader.LocalName)
41 | {
42 | case "id":
43 | PhotoId = reader.Value;
44 | break;
45 | case "ispublic":
46 | IsPublic = reader.Value == "1";
47 | break;
48 | case "iscontact":
49 | IsContact = reader.Value == "1";
50 | break;
51 | case "isfamily":
52 | IsFamily = reader.Value == "1";
53 | break;
54 | case "isfriend":
55 | IsFriend = reader.Value == "1";
56 | break;
57 | }
58 | }
59 | reader.Read();
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/FlickrNet/GlobalSuppressions2.cs:
--------------------------------------------------------------------------------
1 |
2 | // This file is used by Code Analysis to maintain SuppressMessage
3 | // attributes that are applied to this project.
4 | // Project-level suppressions either have no target or are given
5 | // a specific target and scoped to a namespace, type, member, etc.
6 |
7 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Redundancies in Code", "RECS0145:Removes 'private' modifiers that are not required")]
8 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Potential Code Quality Issues", "RECS0163:Suggest the usage of the nameof operator")]
9 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Redundancies in Code", "RECS0129:Removes 'internal' modifiers that are not required")]
10 |
11 |
--------------------------------------------------------------------------------
/FlickrNet/GroupInfoCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// List containing items.
9 | ///
10 | public sealed class GroupInfoCollection : System.Collections.ObjectModel.Collection, IFlickrParsable
11 | {
12 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
13 | {
14 | if (reader.LocalName != "groups")
15 | UtilityMethods.CheckParsingException(reader);
16 |
17 | reader.Read();
18 |
19 | while (reader.LocalName == "group")
20 | {
21 | var member = new GroupInfo();
22 | ((IFlickrParsable)member).Load(reader);
23 | Add(member);
24 | }
25 |
26 | reader.Skip();
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/FlickrNet/HotTag.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// A hot tag. Returned by .
9 | ///
10 | public sealed class HotTag : IFlickrParsable
11 | {
12 | ///
13 | /// The tag that is hot.
14 | ///
15 | public string Tag { get; set; }
16 |
17 | ///
18 | /// The score for the tag.
19 | ///
20 | public int Score { get; set; }
21 |
22 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
23 | {
24 | while (reader.MoveToNextAttribute())
25 | {
26 | switch (reader.LocalName)
27 | {
28 | case "score":
29 | Score = reader.ReadContentAsInt();
30 | break;
31 | }
32 | }
33 |
34 | reader.Read();
35 |
36 | if (reader.NodeType == System.Xml.XmlNodeType.Text)
37 | Tag = reader.ReadContentAsString();
38 |
39 | reader.Read();
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/FlickrNet/HotTagCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Collections.ObjectModel;
5 |
6 | namespace FlickrNet
7 | {
8 | ///
9 | /// A collection of instances.
10 | ///
11 | public sealed class HotTagCollection : Collection, IFlickrParsable
12 | {
13 | ///
14 | /// The period that was used for the query.
15 | ///
16 | public string Period { get; set; }
17 |
18 | ///
19 | /// The count that was used for the query.
20 | ///
21 | public int TagCount { get; set; }
22 |
23 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
24 | {
25 | while (reader.MoveToNextAttribute())
26 | {
27 | switch (reader.LocalName)
28 | {
29 | case "period":
30 | Period = reader.Value;
31 | break;
32 | case "count":
33 | TagCount = reader.ReadContentAsInt();
34 | break;
35 | }
36 | }
37 |
38 | reader.Read();
39 |
40 | while (reader.LocalName == "tag")
41 | {
42 | var item = new HotTag();
43 | ((IFlickrParsable)item).Load(reader);
44 | Add(item);
45 | }
46 |
47 | reader.Skip();
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/FlickrNet/IFlickrParsable.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Xml;
5 |
6 | namespace FlickrNet
7 | {
8 | ///
9 | /// An interface that the classes that are returned by the Flickr API use to enable them to self-deserialize.
10 | ///
11 | ///
12 | /// This enables more than one class to handle the same XML element names when returned by different methods.
13 | ///
14 | public interface IFlickrParsable
15 | {
16 | ///
17 | /// Allows each class that implements this interface to be loaded via an .
18 | ///
19 | ///
20 | void Load(XmlReader reader);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/FlickrNet/InstitutionCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Collections.ObjectModel;
5 |
6 | namespace FlickrNet
7 | {
8 | ///
9 | /// A collection of instances.
10 | ///
11 | public sealed class InstitutionCollection : Collection, IFlickrParsable
12 | {
13 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
14 | {
15 | reader.Read();
16 |
17 | while (reader.LocalName == "institution")
18 | {
19 | var service = new Institution();
20 | ((IFlickrParsable)service).Load(reader);
21 | Add(service);
22 | }
23 |
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/FlickrNet/License.txt:
--------------------------------------------------------------------------------
1 | Flickr .Net API Library
2 | Copyright 2014 Sam Judson
3 | -------------------------------
4 | All source code and information supplied as part of the Flick .Net API Library is copyright to its contributers.
5 |
6 | The source code has been released under a dual license - meaning you can use either licensed version of the library with your code.
7 |
8 | -------------------------------
9 | LGPL 2.1 License
10 | -------------------------------
11 | It is released under the LGPL (GNU Lesser General Public License) 2.1 License,
12 | a copy of which can be found at the link below.
13 | https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
14 |
15 | It is also included in this project as License-LGPL-2.1.txt
16 |
17 | -------------------------------
18 | Apache 2.0 License
19 | -------------------------------
20 | It is released under the Apache 2.0 License, a copy of which can be found at the link below.
21 | http://www.apache.org/licenses/LICENSE-2.0
22 |
23 | It is also included in this project as License-Apache-2.0.txt
24 |
25 | -------------------------------
26 | Distribution/Contribution
27 | -------------------------------
28 |
29 | You are free to distribute copies of this Program in its compiled, unaltered form, including,
30 | but not limited to using it (in library form) in other .Net application, without use of this license.
31 |
32 | You are free to modify this code, under the agreements laid out in these licenses.
33 |
34 | -------------------------------
35 | Exception: Flickr API Key
36 | -------------------------------
37 | I do not have permission to include a Flickr API Key in any distribution which includes source code.
38 | If I do by accident then it is not included in the above license and should not be used.
39 |
--------------------------------------------------------------------------------
/FlickrNet/LicenseCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// A class which encapsulates a single property, an array of
9 | /// objects in its property.
10 | ///
11 | public sealed class LicenseCollection : System.Collections.ObjectModel.Collection, IFlickrParsable
12 | {
13 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
14 | {
15 | reader.Read();
16 |
17 | while (reader.LocalName == "license")
18 | {
19 | var license = new License();
20 | ((IFlickrParsable)license).Load(reader);
21 | Add(license);
22 | }
23 |
24 | reader.Skip();
25 | }
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/FlickrNet/LicenseType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// A enumeration containing the list of current license types.
9 | ///
10 | public enum LicenseType
11 | {
12 | ///
13 | /// All Rights Reserved.
14 | ///
15 | AllRightsReserved = 0,
16 | ///
17 | /// Creative Commons: Attribution Non-Commercial, Share-alike License.
18 | ///
19 | AttributionNoncommercialShareAlikeCC = 1,
20 | ///
21 | /// Creative Commons: Attribution Non-Commercial License.
22 | ///
23 | AttributionNoncommercialCC = 2,
24 | ///
25 | /// Creative Commons: Attribution Non-Commercial, No Derivatives License.
26 | ///
27 | AttributionNoncommercialNoDerivativesCC = 3,
28 | ///
29 | /// Creative Commons: Attribution License.
30 | ///
31 | AttributionCC = 4,
32 | ///
33 | /// Creative Commons: Attribution Share-alike License.
34 | ///
35 | AttributionShareAlikeCC = 5,
36 | ///
37 | /// Creative Commons: Attribution No Derivatives License.
38 | ///
39 | AttributionNoDerivativesCC = 6,
40 | ///
41 | /// No Known Copyright Resitrctions (Flickr Commons).
42 | ///
43 | NoKnownCopyrightRestrictions = 7,
44 | ///
45 | /// United States Government Work
46 | ///
47 | UnitedStatesGovernmentWork = 8,
48 | ///
49 | /// Public Domain Dedication, CC0
50 | ///
51 | PublicDomainDedicationCC0 = 9,
52 | ///
53 | /// Public Domain Mark
54 | ///
55 | PublicDomainMark = 10
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/FlickrNet/Licenses.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml.Serialization;
3 | using System.Xml.Schema;
4 | using System.Collections.Generic;
5 |
6 | namespace FlickrNet
7 | {
8 |
9 | ///
10 | /// Details of a particular license available from Flickr.
11 | ///
12 | public sealed class License : IFlickrParsable
13 | {
14 | ///
15 | /// The ID of the license. Used by and
16 | /// .
17 | ///
18 | public LicenseType LicenseId { get; set; }
19 |
20 | /// The name of the license.
21 | public string LicenseName { get; set; }
22 |
23 | /// The URL for the license text.
24 | public string LicenseUrl { get; set; }
25 |
26 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
27 | {
28 | while (reader.MoveToNextAttribute())
29 | {
30 | switch (reader.LocalName)
31 | {
32 | case "id":
33 | LicenseId = (LicenseType)reader.ReadContentAsInt();
34 | break;
35 | case "name":
36 | LicenseName = reader.Value;
37 | break;
38 | case "url":
39 | if (!string.IsNullOrEmpty(reader.Value))
40 | {
41 | LicenseUrl = reader.Value;
42 | }
43 | break;
44 | default:
45 | UtilityMethods.CheckParsingException(reader);
46 | break;
47 | }
48 | }
49 |
50 | reader.Read();
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/FlickrNet/MD5Managed.cs:
--------------------------------------------------------------------------------
1 | //Copyright (c) Microsoft Corporation. All rights reserved.
2 | using System;
3 | using System.Security.Cryptography;
4 |
5 | // **************************************************************
6 | // * Raw implementation of the MD5 hash algorithm
7 | // * from RFC 1321.
8 | // *
9 | // * Written By: Reid Borsuk and Jenny Zheng
10 | // * Copyright (c) Microsoft Corporation. All rights reserved.
11 | // **************************************************************
12 |
13 | #if SILVERLIGHT
14 | public sealed class MD5Managed : HashAlgorithm
15 | #else
16 | public sealed class MD5Managed : MD5
17 | #endif
18 | {
19 | private byte[] _data;
20 | private ABCDStruct _abcd;
21 | private Int64 _totalLength;
22 | private int _dataSize;
23 |
24 | public MD5Managed()
25 | {
26 | HashSizeValue = 0x80;
27 | Initialize();
28 | }
29 |
30 | public override void Initialize()
31 | {
32 | _data = new byte[64];
33 | _dataSize = 0;
34 | _totalLength = 0;
35 | _abcd = new ABCDStruct();
36 | //Intitial values as defined in RFC 1321
37 | _abcd.A = 0x67452301;
38 | _abcd.B = 0xefcdab89;
39 | _abcd.C = 0x98badcfe;
40 | _abcd.D = 0x10325476;
41 | }
42 |
43 | protected override void HashCore(byte[] array, int ibStart, int cbSize)
44 | {
45 | int startIndex = ibStart;
46 | int totalArrayLength = _dataSize + cbSize;
47 | if (totalArrayLength >= 64)
48 | {
49 | Array.Copy(array, startIndex, _data, _dataSize, 64 - _dataSize);
50 | // Process message of 64 bytes (512 bits)
51 | MD5Core.GetHashBlock(_data, ref _abcd, 0);
52 | startIndex += 64 - _dataSize;
53 | totalArrayLength -= 64;
54 | while (totalArrayLength >= 64)
55 | {
56 | Array.Copy(array, startIndex, _data, 0, 64);
57 | MD5Core.GetHashBlock(array, ref _abcd, startIndex);
58 | totalArrayLength -= 64;
59 | startIndex += 64;
60 | }
61 | _dataSize = totalArrayLength;
62 | Array.Copy(array, startIndex, _data, 0, totalArrayLength);
63 | }
64 | else
65 | {
66 | Array.Copy(array, startIndex, _data, _dataSize, cbSize);
67 | _dataSize = totalArrayLength;
68 | }
69 | _totalLength += cbSize;
70 | }
71 |
72 | protected override byte[] HashFinal()
73 | {
74 | HashValue = MD5Core.GetHashFinalBlock(_data, 0, _dataSize, _abcd, _totalLength * 8);
75 | return HashValue;
76 | }
77 | }
--------------------------------------------------------------------------------
/FlickrNet/MediaType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// An enumeration of different media types tto search for.
9 | ///
10 | public enum MediaType
11 | {
12 | ///
13 | /// Default MediaType. Does not correspond to a value that is sent to Flickr.
14 | ///
15 | None,
16 | ///
17 | /// All media types will be return.
18 | ///
19 | All,
20 | ///
21 | /// Only photos will be returned.
22 | ///
23 | Photos,
24 | ///
25 | /// Only videos will be returned.
26 | ///
27 | Videos
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/FlickrNet/Member.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 | using System.Xml.Serialization;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// Details for a Flickr member, as returned by the method.
9 | ///
10 | public sealed class Member : IFlickrParsable
11 | {
12 |
13 | ///
14 | /// The user id for the member.
15 | ///
16 | public string MemberId { get; set; }
17 |
18 | ///
19 | /// The members name.
20 | ///
21 | public string UserName { get; set; }
22 |
23 | ///
24 | /// The icon server for the users buddy icon. See for the complete URL.
25 | ///
26 | public string IconServer { get; set; }
27 |
28 | ///
29 | /// The icon farm for the users buddy icon. See for the complete URL.
30 | ///
31 | public string IconFarm { get; set; }
32 |
33 | ///
34 | /// The type of the member (basic, moderator or administrator).
35 | ///
36 | public MemberTypes MemberType { get; set; }
37 |
38 | ///
39 | /// The icon URL for the users buddy icon. Calculated from the and .
40 | ///
41 | public string IconUrl
42 | {
43 | get {
44 | return UtilityMethods.BuddyIcon(IconServer, IconFarm, MemberId);
45 | }
46 | }
47 |
48 |
49 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
50 | {
51 | // To parse:
52 | MemberId = reader.GetAttribute("nsid");
53 | UserName = reader.GetAttribute("username");
54 | IconServer = reader.GetAttribute("iconserver");
55 | IconFarm = reader.GetAttribute("iconfarm");
56 | MemberType = UtilityMethods.ParseIdToMemberType(reader.GetAttribute("membertype"));
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/FlickrNet/MemberCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml.Serialization;
3 | using System.Collections;
4 | using System.Collections.Generic;
5 |
6 | namespace FlickrNet
7 | {
8 | ///
9 | /// A collection of members returned by the method.
10 | ///
11 | public sealed class MemberCollection : System.Collections.ObjectModel.Collection, IFlickrParsable
12 | {
13 | ///
14 | /// The page of the results returned.
15 | ///
16 | public int Page { get; set; }
17 |
18 | ///
19 | /// The total number of pages that could have been returned.
20 | ///
21 | public int Pages { get; set; }
22 |
23 | ///
24 | /// The total number of members in the group.
25 | ///
26 | public int Total { get; set; }
27 |
28 | ///
29 | /// The number of members returned per page.
30 | ///
31 | public int PerPage { get; set; }
32 |
33 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
34 | {
35 | // To parse:
36 |
37 | if (reader.GetAttribute("page") != null) Page = int.Parse(reader.GetAttribute("page"), System.Globalization.CultureInfo.InvariantCulture);
38 | if (reader.GetAttribute("pages") != null) Pages = int.Parse(reader.GetAttribute("pages"), System.Globalization.CultureInfo.InvariantCulture);
39 | if (reader.GetAttribute("perpage") != null) PerPage = int.Parse(reader.GetAttribute("perpage"), System.Globalization.CultureInfo.InvariantCulture);
40 | if (reader.GetAttribute("total") != null) Total = int.Parse(reader.GetAttribute("total"), System.Globalization.CultureInfo.InvariantCulture);
41 |
42 | while (reader.Read())
43 | {
44 | if (reader.Name == "member")
45 | {
46 | var m = new Member();
47 | ((IFlickrParsable)m).Load(reader);
48 | Add(m);
49 | }
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/FlickrNet/MemberGroupInfoCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// A list of items.
9 | ///
10 | public sealed class MemberGroupInfoCollection : System.Collections.ObjectModel.Collection, IFlickrParsable
11 | {
12 | ///
13 | /// The total number of pages of results that are available.
14 | ///
15 | public int Pages { get; set; }
16 |
17 | ///
18 | /// The total number of groups that are available.
19 | ///
20 | public int Total { get; set; }
21 |
22 | ///
23 | /// The page of the results that has been returned.
24 | ///
25 | public int Page { get; set; }
26 |
27 | ///
28 | /// The number of results that are returned per page.
29 | ///
30 | ///
31 | /// This may be more than the total number of groups returned if this is the last page.
32 | ///
33 | public int PerPage { get; set; }
34 |
35 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
36 | {
37 | if (reader.LocalName != "groups")
38 | UtilityMethods.CheckParsingException(reader);
39 |
40 | while (reader.MoveToNextAttribute())
41 | {
42 | switch (reader.LocalName)
43 | {
44 | case "per_page":
45 | PerPage = reader.ReadContentAsInt();
46 | break;
47 | case "page":
48 | Page = reader.ReadContentAsInt();
49 | break;
50 | case "pages":
51 | Pages = reader.ReadContentAsInt();
52 | break;
53 | case "total":
54 | Total = reader.ReadContentAsInt();
55 | break;
56 | default:
57 | UtilityMethods.CheckParsingException(reader);
58 | break;
59 | }
60 | }
61 |
62 | reader.Read();
63 |
64 | while (reader.LocalName == "group")
65 | {
66 | var member = new MemberGroupInfo();
67 | ((IFlickrParsable)member).Load(reader);
68 | Add(member);
69 | }
70 |
71 | reader.Skip();
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/FlickrNet/MemberTypes.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 |
4 | namespace FlickrNet
5 | {
6 | ///
7 | /// The type of a member. Passed as a parameter to and returned for each as well.
8 | ///
9 | [Flags]
10 | public enum MemberTypes
11 | {
12 | ///
13 | /// No member type has been specified (all should be returned).
14 | ///
15 | None = 0,
16 | ///
17 | /// A basic member.
18 | ///
19 | Member = 1,
20 | ///
21 | /// A group moderator.
22 | ///
23 | Moderator = 2,
24 | ///
25 | /// A group adminstrator.
26 | ///
27 | Admin = 4,
28 | ///
29 | /// Some strange kind of super-admin. Unsupported by the API.
30 | ///
31 | Narwhal = 8
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/FlickrNet/Namespace.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// A machine tag namespace. "namespace:predicate=value".
9 | ///
10 | public sealed class Namespace : IFlickrParsable
11 | {
12 | ///
13 | /// The name of the namespace.
14 | ///
15 | public string NamespaceName { get; set; }
16 |
17 | ///
18 | /// The usage of the namespace.
19 | ///
20 | public int Usage { get; set; }
21 |
22 | ///
23 | /// The number of unique predicates within this namespace.
24 | ///
25 | public int Predicates { get; set; }
26 |
27 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
28 | {
29 | while (reader.MoveToNextAttribute())
30 | {
31 | switch (reader.LocalName)
32 | {
33 | case "usage":
34 | Usage = reader.ReadContentAsInt();
35 | break;
36 | case "predicates":
37 | Predicates = reader.ReadContentAsInt();
38 | break;
39 | }
40 | }
41 |
42 | reader.Read();
43 |
44 | if (reader.NodeType == System.Xml.XmlNodeType.Text)
45 | NamespaceName = reader.ReadContentAsString();
46 |
47 | reader.Read();
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/FlickrNet/NamespaceCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Collections.ObjectModel;
5 |
6 | namespace FlickrNet
7 | {
8 | ///
9 | /// A collection of instances.
10 | ///
11 | public sealed class NamespaceCollection : Collection, IFlickrParsable
12 | {
13 | ///
14 | /// The total number of namespaces that match the calling query.
15 | ///
16 | public int Total { get; set; }
17 | ///
18 | /// The page of the result set that has been returned.
19 | ///
20 | public int Page { get; set; }
21 | ///
22 | /// The number of namespaces returned per page.
23 | ///
24 | public int PerPage { get; set; }
25 | ///
26 | /// The number of pages of namespaces that are available.
27 | ///
28 | public int Pages { get; set; }
29 |
30 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
31 | {
32 | if (reader.LocalName != "namespaces")
33 | UtilityMethods.CheckParsingException(reader);
34 |
35 | while (reader.MoveToNextAttribute())
36 | {
37 | switch (reader.LocalName)
38 | {
39 | case "page":
40 | Page = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
41 | break;
42 | case "total":
43 | Total = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
44 | break;
45 | case "pages":
46 | Pages = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
47 | break;
48 | case "per_page":
49 | case "perpage":
50 | PerPage = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
51 | break;
52 | default:
53 | UtilityMethods.CheckParsingException(reader);
54 | break;
55 | }
56 | }
57 |
58 | reader.Read();
59 |
60 | while (reader.LocalName == "namespace")
61 | {
62 | var ns = new Namespace();
63 | ((IFlickrParsable)ns).Load(reader);
64 | Add(ns);
65 | }
66 |
67 | reader.Skip();
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/FlickrNet/NoResponse.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// Used by the FlickrNet library when Flickr does not return anything in the body of a response, e.g. for update methods.
9 | ///
10 | public sealed class NoResponse : IFlickrParsable
11 | {
12 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
13 | {
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/FlickrNet/Notice-Apache-2.0.txt:
--------------------------------------------------------------------------------
1 | Flickr.Net API Library
2 | Copyright 2014 Sam Judson
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 |
--------------------------------------------------------------------------------
/FlickrNet/OAuthRequestToken.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// Class containing details of the OAUth request token returned by Flickr.
9 | ///
10 | public class OAuthRequestToken
11 | {
12 | ///
13 | /// The request token string.
14 | ///
15 | public string Token { get; set; }
16 | ///
17 | /// The request token secret.
18 | ///
19 | public string TokenSecret { get; set; }
20 |
21 | ///
22 | /// Parses a URL parameter encoded string and returns a new
23 | ///
24 | /// A URL parameter encoded string, e.g. "oauth_token=ABC&oauth_token_secret=DEF".
25 | ///
26 | public static OAuthRequestToken ParseResponse(string response)
27 | {
28 | Dictionary parameters = UtilityMethods.StringToDictionary(response);
29 | var token = new OAuthRequestToken();
30 | token.Token = parameters["oauth_token"];
31 | token.TokenSecret = parameters["oauth_token_secret"];
32 | return token;
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/FlickrNet/OpenCF/HashAlgorithm.cs:
--------------------------------------------------------------------------------
1 | //==========================================================================================
2 | //
3 | // OpenNETCF.Windows.Forms.HashAlgorithm
4 | // Copyright (c) 2003, OpenNETCF.org
5 | //
6 | // This library is free software; you can redistribute it and/or modify it under
7 | // the terms of the OpenNETCF.org Shared Source License.
8 | //
9 | // This library is distributed in the hope that it will be useful, but
10 | // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 | // FITNESS FOR A PARTICULAR PURPOSE. See the OpenNETCF.org Shared Source License
12 | // for more details.
13 | //
14 | // You should have received a copy of the OpenNETCF.org Shared Source License
15 | // along with this library; if not, email licensing@opennetcf.org to request a copy.
16 | //
17 | // If you wish to contact the OpenNETCF Advisory Board to discuss licensing, please
18 | // email licensing@opennetcf.org.
19 | //
20 | // For general enquiries, email enquiries@opennetcf.org or visit our website at:
21 | // http://www.opennetcf.org
22 | //
23 | // !!! A HUGE thank-you goes out to Casey Chesnut for supplying this class library !!!
24 | // !!! You can contact Casey at http://www.brains-n-brawn.com !!!
25 | //
26 | //==========================================================================================
27 | using System;
28 |
29 | namespace FlickrNet.Security.Cryptography
30 | {
31 | internal abstract class HashAlgorithm // : ICryptoTransform
32 | {
33 | protected HashAlgorithm(){}
34 |
35 | public abstract int HashSize {get;}
36 | public abstract byte[] Hash { get; }
37 |
38 | public abstract byte[] ComputeHash(byte[] buffer);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/FlickrNet/OpenCF/KeyedHashAlgorithm.cs:
--------------------------------------------------------------------------------
1 | //==========================================================================================
2 | //
3 | // OpenNETCF.Windows.Forms.KeyedHashAlgorithm
4 | // Copyright (c) 2003, OpenNETCF.org
5 | //
6 | // This library is free software; you can redistribute it and/or modify it under
7 | // the terms of the OpenNETCF.org Shared Source License.
8 | //
9 | // This library is distributed in the hope that it will be useful, but
10 | // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 | // FITNESS FOR A PARTICULAR PURPOSE. See the OpenNETCF.org Shared Source License
12 | // for more details.
13 | //
14 | // You should have received a copy of the OpenNETCF.org Shared Source License
15 | // along with this library; if not, email licensing@opennetcf.org to request a copy.
16 | //
17 | // If you wish to contact the OpenNETCF Advisory Board to discuss licensing, please
18 | // email licensing@opennetcf.org.
19 | //
20 | // For general enquiries, email enquiries@opennetcf.org or visit our website at:
21 | // http://www.opennetcf.org
22 | //
23 | // !!! A HUGE thank-you goes out to Casey Chesnut for supplying this class library !!!
24 | // !!! You can contact Casey at http://www.brains-n-brawn.com !!!
25 | //
26 | //==========================================================================================
27 | using System;
28 |
29 | namespace FlickrNet.Security.Cryptography
30 | {
31 | internal abstract class KeyedHashAlgorithm : HashAlgorithm
32 | {
33 | protected KeyedHashAlgorithm()
34 | {
35 |
36 | }
37 |
38 | //public static KeyedHashAlgorithm Create();
39 | //public static KeyedHashAlgorithm Create(string algName);
40 | //protected override void Dispose(bool disposing);
41 | //protected override void Finalize();
42 | public abstract byte[] Key { get; set; }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/FlickrNet/PagedPhotoCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// Abstract class containing a collection of instances along with paged information about the result set.
9 | ///
10 | public abstract class PagedPhotoCollection : System.Collections.ObjectModel.Collection
11 | {
12 | ///
13 | /// The Page of results that was returned from Flickr. The first page is 1.
14 | ///
15 | public int Page { get; set; }
16 |
17 | ///
18 | /// The number of pages available from Flickr.
19 | ///
20 | public int Pages { get; set; }
21 |
22 | ///
23 | /// The number of photos per page in the result set.
24 | ///
25 | public int PerPage { get; set; }
26 |
27 | ///
28 | /// The total number of photos available from Flickr (over all the pages).
29 | ///
30 | public int Total { get; set; }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/FlickrNet/Pair.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// A machine tag pair made up of a namespace and predicate. "namespace:predicate=value".
9 | ///
10 | public sealed class Pair : IFlickrParsable
11 | {
12 | ///
13 | /// The name of the pair.
14 | ///
15 | public string PairName { get; set; }
16 |
17 | ///
18 | /// The usage of the namespace.
19 | ///
20 | public int Usage { get; set; }
21 |
22 | ///
23 | /// The predicate part of this pair.
24 | ///
25 | public string PredicateName { get; set; }
26 |
27 | ///
28 | /// The namespace part of this pair.
29 | ///
30 | public string NamespaceName { get; set; }
31 |
32 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
33 | {
34 | while (reader.MoveToNextAttribute())
35 | {
36 | switch (reader.LocalName)
37 | {
38 | case "usage":
39 | Usage = reader.ReadContentAsInt();
40 | break;
41 | case "predicate":
42 | PredicateName = reader.Value;
43 | break;
44 | case "namespace":
45 | NamespaceName = reader.Value;
46 | break;
47 | }
48 | }
49 |
50 | reader.Read();
51 |
52 | if (reader.NodeType == System.Xml.XmlNodeType.Text)
53 | PairName = reader.ReadContentAsString();
54 |
55 | reader.Read();
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/FlickrNet/ParsingException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// The exception thrown when an error occurred while trying to parse the response from Flickr.
9 | ///
10 | ///
11 | /// Usually because an unexpected element or attribute was encountered.
12 | ///
13 | [Serializable]
14 | public class ParsingException : FlickrException
15 | {
16 | ///
17 | /// Initializes a new instance of the class.
18 | ///
19 | public ParsingException()
20 | : base()
21 | {
22 | }
23 |
24 | ///
25 | /// Initializes a new instance of the class with a specified error message.
26 | ///
27 | ///
28 | public ParsingException(string message)
29 | : base(message)
30 | {
31 | }
32 |
33 | ///
34 | /// Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception.
35 | ///
36 | ///
37 | ///
38 | public ParsingException(string message, Exception innerException)
39 | : base(message, innerException)
40 | {
41 | }
42 |
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/FlickrNet/PhotoCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml.Serialization;
3 | using System.Xml.Schema;
4 | using System.Collections;
5 | using System.Collections.Generic;
6 | using System.Xml;
7 |
8 | namespace FlickrNet
9 | {
10 | ///
11 | public sealed class PhotoCollection : PagedPhotoCollection, IFlickrParsable
12 | {
13 | void IFlickrParsable.Load(XmlReader reader)
14 | {
15 | if (reader.LocalName != "photos")
16 | UtilityMethods.CheckParsingException(reader);
17 |
18 | while (reader.MoveToNextAttribute())
19 | {
20 | switch (reader.LocalName)
21 | {
22 | case "total":
23 | Total = string.IsNullOrEmpty(reader.Value) ? 0 : int.Parse(reader.Value, System.Globalization.CultureInfo.InvariantCulture);
24 | break;
25 | case "perpage":
26 | case "per_page":
27 | PerPage = string.IsNullOrEmpty(reader.Value) ? 0 : int.Parse(reader.Value, System.Globalization.CultureInfo.InvariantCulture);
28 | break;
29 | case "page":
30 | Page = string.IsNullOrEmpty(reader.Value) ? 0 : int.Parse(reader.Value, System.Globalization.CultureInfo.InvariantCulture);
31 | break;
32 | case "pages":
33 | Pages = string.IsNullOrEmpty(reader.Value) ? 0 : int.Parse(reader.Value, System.Globalization.CultureInfo.InvariantCulture);
34 | break;
35 | default:
36 | UtilityMethods.CheckParsingException(reader);
37 | break;
38 |
39 | }
40 | }
41 |
42 | reader.Read();
43 |
44 | while (reader.LocalName == "photo")
45 | {
46 | var p = new Photo();
47 | ((IFlickrParsable)p).Load(reader);
48 | if (!string.IsNullOrEmpty(p.PhotoId)) Add(p);
49 | }
50 |
51 | // Skip to next element (if any)
52 | reader.Skip();
53 |
54 | }
55 |
56 | }
57 | }
--------------------------------------------------------------------------------
/FlickrNet/PhotoCommentCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml;
3 | using System.Collections.Generic;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// A list of items.
9 | ///
10 | public sealed class PhotoCommentCollection : System.Collections.ObjectModel.Collection, IFlickrParsable
11 | {
12 | ///
13 | /// The ID of photo for these comments.
14 | ///
15 | public string PhotoId { get; set; }
16 |
17 | void IFlickrParsable.Load(XmlReader reader)
18 | {
19 | if (reader.LocalName != "comments")
20 | UtilityMethods.CheckParsingException(reader);
21 |
22 | while (reader.MoveToNextAttribute())
23 | {
24 | switch (reader.LocalName)
25 | {
26 | case "photo_id":
27 | PhotoId = reader.Value;
28 | break;
29 | default:
30 | UtilityMethods.CheckParsingException(reader);
31 | break;
32 | }
33 | }
34 |
35 | reader.Read();
36 |
37 | while (reader.LocalName == "comment")
38 | {
39 | var comment = new PhotoComment();
40 | ((IFlickrParsable)comment).Load(reader);
41 | Add(comment);
42 | }
43 | reader.Skip();
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/FlickrNet/PhotoFavorite.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Xml.Serialization;
5 | using System.Xml;
6 |
7 | namespace FlickrNet
8 | {
9 | ///
10 | /// Details of the favourites for a photo.
11 | ///
12 | public sealed class PhotoFavorite : IFlickrParsable
13 | {
14 | ///
15 | /// The Flickr User ID of the user who favourited the photo.
16 | ///
17 | public string UserId { get; set; }
18 |
19 | ///
20 | /// The user name of the user who favourited the photo.
21 | ///
22 | public string UserName { get; set; }
23 |
24 | ///
25 | /// The date the hoto was favourited.
26 | ///
27 | public DateTime FavoriteDate { get; set; }
28 |
29 | void IFlickrParsable.Load(XmlReader reader)
30 | {
31 | while (reader.MoveToNextAttribute())
32 | {
33 | switch (reader.Name)
34 | {
35 | case "nsid":
36 | UserId = reader.Value;
37 | break;
38 | case "username":
39 | UserName = reader.Value;
40 | break;
41 | case "favedate":
42 | FavoriteDate = UtilityMethods.UnixTimestampToDate(reader.Value);
43 | break;
44 | }
45 | }
46 |
47 | reader.Skip();
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/FlickrNet/PhotoPermissions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml;
3 |
4 | namespace FlickrNet
5 | {
6 | ///
7 | /// Permissions for the selected photo.
8 | ///
9 | public sealed class PhotoPermissions : IFlickrParsable
10 | {
11 | ///
12 | public string PhotoId { get; set; }
13 |
14 | ///
15 | public bool IsPublic { get; set; }
16 |
17 | ///
18 | public bool IsFriend { get; set; }
19 |
20 | ///
21 | public bool IsFamily { get; set; }
22 |
23 | ///
24 | public PermissionComment PermissionComment { get; set; }
25 |
26 | ///
27 | public PermissionAddMeta PermissionAddMeta { get; set; }
28 |
29 | void IFlickrParsable.Load(XmlReader reader)
30 | {
31 | while (reader.MoveToNextAttribute())
32 | {
33 | switch (reader.LocalName)
34 | {
35 | case "id":
36 | PhotoId = reader.Value;
37 | break;
38 | case "ispublic":
39 | IsPublic = reader.Value == "1";
40 | break;
41 | case "isfamily":
42 | IsFamily = reader.Value == "1";
43 | break;
44 | case "isfriend":
45 | IsFriend = reader.Value == "1";
46 | break;
47 | case "permcomment":
48 | PermissionComment = (PermissionComment)Enum.Parse(typeof(PermissionComment), reader.Value, true);
49 | break;
50 | case "permaddmeta":
51 | PermissionAddMeta = (PermissionAddMeta)Enum.Parse(typeof(PermissionAddMeta), reader.Value, true);
52 | break;
53 | default:
54 | UtilityMethods.CheckParsingException(reader);
55 | break;
56 | }
57 | }
58 |
59 | reader.Read();
60 | }
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/FlickrNet/PhotoPersonCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Xml;
5 |
6 | namespace FlickrNet
7 | {
8 | ///
9 | /// A list of instances.
10 | ///
11 | public sealed class PhotoPersonCollection : System.Collections.ObjectModel.Collection, IFlickrParsable
12 | {
13 | ///
14 | /// The total number of instances returned.
15 | ///
16 | public int Total { get; set; }
17 |
18 | ///
19 | /// The width of the photo used for positioning the people.
20 | ///
21 | ///
22 | /// This will usually be the medium or the medium-640 image.
23 | ///
24 | public int PhotoWidth { get; set; }
25 |
26 | ///
27 | /// The height of the photo used for positioning the people.
28 | ///
29 | ///
30 | /// This will usually be the medium or the medium-640 image.
31 | ///
32 | public int PhotoHeight { get; set; }
33 |
34 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
35 | {
36 | if (reader.LocalName != "people")
37 | UtilityMethods.CheckParsingException(reader);
38 |
39 | while (reader.MoveToNextAttribute())
40 | {
41 | switch (reader.LocalName)
42 | {
43 | case "total":
44 | Total = reader.ReadContentAsInt();
45 | break;
46 | case "photo_width":
47 | PhotoWidth = reader.ReadContentAsInt();
48 | break;
49 | case "photo_height":
50 | PhotoHeight = reader.ReadContentAsInt();
51 | break;
52 | default:
53 | UtilityMethods.CheckParsingException(reader);
54 | break;
55 | }
56 | }
57 |
58 | reader.Read();
59 |
60 | while (reader.LocalName == "person")
61 | {
62 | var item = new PhotoPerson();
63 | ((IFlickrParsable)item).Load(reader);
64 | Add(item);
65 | }
66 |
67 | reader.Skip();
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/FlickrNet/PhotoSearchOrder.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace FlickrNet
4 | {
5 | ///
6 | /// The sort order for the ,
7 | /// , methods.
8 | ///
9 | [Serializable]
10 | public enum PhotoSearchSortOrder
11 | {
12 | ///
13 | /// No sort order.
14 | ///
15 | None,
16 | ///
17 | /// Sort by date uploaded (posted).
18 | ///
19 | DatePostedAscending,
20 | ///
21 | /// Sort by date uploaded (posted) in descending order.
22 | ///
23 | DatePostedDescending,
24 | ///
25 | /// Sort by date taken.
26 | ///
27 | DateTakenAscending,
28 | ///
29 | /// Sort by date taken in descending order.
30 | ///
31 | DateTakenDescending,
32 | ///
33 | /// Sort by interestingness (least interesting first)
34 | ///
35 | InterestingnessAscending,
36 | ///
37 | /// Sort by interestingness in descending order (i.e. most interesting first)
38 | ///
39 | InterestingnessDescending,
40 | ///
41 | /// Sort by relevance (only applicable to text searches)
42 | ///
43 | Relevance
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/FlickrNet/PhotosetCommentCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// A list of items.
9 | ///
10 | public sealed class PhotosetCommentCollection : System.Collections.ObjectModel.Collection, IFlickrParsable
11 | {
12 | ///
13 | /// The ID of the photoset for this comment.
14 | ///
15 | public string PhotosetId { get; set; }
16 |
17 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
18 | {
19 | if (reader.LocalName != "comments")
20 | UtilityMethods.CheckParsingException(reader);
21 |
22 | while (reader.MoveToNextAttribute())
23 | {
24 | switch (reader.LocalName)
25 | {
26 | case "photoset_id":
27 | PhotosetId = reader.Value;
28 | break;
29 | default:
30 | UtilityMethods.CheckParsingException(reader);
31 | break;
32 | }
33 | }
34 |
35 | reader.Read();
36 |
37 | while (reader.LocalName == "comment")
38 | {
39 | var comment = new PhotoComment();
40 | ((IFlickrParsable)comment).Load(reader);
41 | Add(comment);
42 | }
43 | reader.Skip();
44 | }
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/FlickrNet/PlaceCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// A list of items.
9 | ///
10 | public sealed class PlaceCollection : System.Collections.ObjectModel.Collection, IFlickrParsable
11 | {
12 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
13 | {
14 | reader.Read();
15 |
16 | while (reader.LocalName == "place")
17 | {
18 | var place = new Place();
19 | ((IFlickrParsable)place).Load(reader);
20 | Add(place);
21 | }
22 |
23 | reader.Skip();
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/FlickrNet/PlaceType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// Used by .
9 | ///
10 | public enum PlaceType
11 | {
12 | ///
13 | /// No place type selected. Not used by the Flickr API.
14 | ///
15 | None = 0,
16 | ///
17 | /// Locality.
18 | ///
19 | Locality = 7,
20 | ///
21 | /// County.
22 | ///
23 | County = 9,
24 | ///
25 | /// Region.
26 | ///
27 | Region = 8,
28 | ///
29 | /// Country.
30 | ///
31 | Country = 12,
32 | ///
33 | /// Neighbourhood.
34 | ///
35 | Neighbourhood = 22,
36 | ///
37 | /// Continent.
38 | ///
39 | Continent = 29
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/FlickrNet/PlaceTypeInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// Information about the types of 'places' available from the Flickr API.
9 | ///
10 | ///
11 | /// Use the enumeration were possible.
12 | ///
13 | public sealed class PlaceTypeInfo : IFlickrParsable
14 | {
15 | ///
16 | /// The unique ID for the blog service supported by Flickr.
17 | ///
18 | public int Id { get; set; }
19 | ///
20 | /// The name of the blog service supported by Flickr.
21 | ///
22 | public string Name { get; set; }
23 |
24 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
25 | {
26 | if (reader.LocalName != "place_type")
27 | UtilityMethods.CheckParsingException(reader);
28 |
29 | while (reader.MoveToNextAttribute())
30 | {
31 | switch (reader.LocalName)
32 | {
33 | case "place_type_id":
34 | case "id":
35 | Id = reader.ReadContentAsInt();
36 | break;
37 | default:
38 | UtilityMethods.CheckParsingException(reader);
39 | break;
40 | }
41 | }
42 |
43 | reader.Read();
44 |
45 | Name = reader.ReadContentAsString();
46 |
47 | reader.Skip();
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/FlickrNet/PlaceTypeInfoCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// Collection containing information about the types of 'places' available from the Flickr API.
9 | ///
10 | ///
11 | /// Use the enumeration were possible.
12 | ///
13 | public sealed class PlaceTypeInfoCollection : System.Collections.ObjectModel.Collection, IFlickrParsable
14 | {
15 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
16 | {
17 | if (reader.LocalName != "place_types")
18 | UtilityMethods.CheckParsingException(reader);
19 |
20 | reader.Read();
21 |
22 | while (reader.LocalName == "place_type")
23 | {
24 | var item = new PlaceTypeInfo();
25 | ((IFlickrParsable)item).Load(reader);
26 | Add(item);
27 | }
28 |
29 | reader.Skip();
30 |
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/FlickrNet/PoolPrivacy.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Xml.Serialization;
5 |
6 | namespace FlickrNet
7 | {
8 | ///
9 | /// The various pricay settings for a group.
10 | ///
11 | [Serializable]
12 | public enum PoolPrivacy
13 | {
14 | ///
15 | /// No privacy setting specified.
16 | ///
17 | [XmlEnum("0")]
18 | None = 0,
19 |
20 | ///
21 | /// The group is a private group. You cannot view pictures or posts until you are a
22 | /// member. The group is also invite only.
23 | ///
24 | [XmlEnum("1")]
25 | Private = 1,
26 | ///
27 | /// A public group where you can see posts and photos in the group. The group is however invite only.
28 | ///
29 | [XmlEnum("2")]
30 | InviteOnlyPublic = 2,
31 | ///
32 | /// A public group.
33 | ///
34 | [XmlEnum("3")]
35 | OpenPublic = 3
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/FlickrNet/PopularitySort.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// Sorting used for
9 | ///
10 | public enum PopularitySort
11 | {
12 | ///
13 | /// No sorting performed.
14 | ///
15 | None,
16 | ///
17 | /// Sort by number of views.
18 | ///
19 | Views,
20 | ///
21 | /// Sort by number of comments.
22 | ///
23 | Comments,
24 | ///
25 | /// Sort by number of favorites.
26 | ///
27 | Favorites
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/FlickrNet/Predicate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// A machine tag predicate. "namespace:predicate=value".
9 | ///
10 | public sealed class Predicate : IFlickrParsable
11 | {
12 | ///
13 | /// The name the predicate
14 | ///
15 | public string PredicateName { get; set; }
16 |
17 | ///
18 | /// The usage of the predicate.
19 | ///
20 | public int Usage { get; set; }
21 |
22 | ///
23 | /// The number of distinct namespaces the predicate applies to.
24 | ///
25 | public int Namespaces { get; set; }
26 |
27 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
28 | {
29 | while (reader.MoveToNextAttribute())
30 | {
31 | switch (reader.LocalName)
32 | {
33 | case "usage":
34 | Usage = reader.ReadContentAsInt();
35 | break;
36 | case "namespaces":
37 | Namespaces = reader.ReadContentAsInt();
38 | break;
39 | }
40 | }
41 |
42 | reader.Read();
43 |
44 | if (reader.NodeType == System.Xml.XmlNodeType.Text)
45 | PredicateName = reader.ReadContentAsString();
46 |
47 | reader.Read();
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/FlickrNet/PredicateCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Collections.ObjectModel;
5 |
6 | namespace FlickrNet
7 | {
8 | ///
9 | /// A collection of instances.
10 | ///
11 | public sealed class PredicateCollection : Collection, IFlickrParsable
12 | {
13 | ///
14 | /// The total number of namespaces that match the calling query.
15 | ///
16 | public int Total { get; set; }
17 | ///
18 | /// The page of the result set that has been returned.
19 | ///
20 | public int Page { get; set; }
21 | ///
22 | /// The number of namespaces returned per page.
23 | ///
24 | public int PerPage { get; set; }
25 | ///
26 | /// The number of pages of namespaces that are available.
27 | ///
28 | public int Pages { get; set; }
29 |
30 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
31 | {
32 | if (reader.LocalName != "predicates")
33 | UtilityMethods.CheckParsingException(reader);
34 |
35 | while (reader.MoveToNextAttribute())
36 | {
37 | switch (reader.LocalName)
38 | {
39 | case "page":
40 | Page = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
41 | break;
42 | case "total":
43 | Total = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
44 | break;
45 | case "pages":
46 | Pages = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
47 | break;
48 | case "per_page":
49 | case "perpage":
50 | PerPage = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
51 | break;
52 | default:
53 | UtilityMethods.CheckParsingException(reader);
54 | break;
55 | }
56 | }
57 |
58 | reader.Read();
59 |
60 | while (reader.LocalName == "predicate")
61 | {
62 | var item = new Predicate();
63 | ((IFlickrParsable)item).Load(reader);
64 | Add(item);
65 | }
66 |
67 | reader.Skip();
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/FlickrNet/ResponseXmlException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace FlickrNet
4 | {
5 | ///
6 | /// Exception thrown when an error parsing the returned XML.
7 | ///
8 | [Serializable]
9 | public class ResponseXmlException : FlickrException
10 | {
11 | ///
12 | /// Initializes a new instance of the class.
13 | ///
14 | public ResponseXmlException()
15 | : base()
16 | {
17 | }
18 |
19 | ///
20 | /// Initializes a new instance of the class with a specified error message.
21 | ///
22 | ///
23 | public ResponseXmlException(string message)
24 | : base(message)
25 | {
26 | }
27 |
28 | ///
29 | /// Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception.
30 | ///
31 | ///
32 | ///
33 | public ResponseXmlException(string message, Exception innerException)
34 | : base(message, innerException)
35 | {
36 | }
37 |
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/FlickrNet/SafeNativeMethods.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace FlickrNet
4 | {
5 | ///
6 | /// Summary description for SafeNativeMethods.
7 | ///
8 | #if !WindowsCE && !SILVERLIGHT
9 | [System.Security.SuppressUnmanagedCodeSecurity]
10 | #endif
11 | internal class SafeNativeMethods
12 | {
13 | private SafeNativeMethods()
14 | {
15 | }
16 |
17 | internal static int GetErrorCode(System.IO.IOException ioe)
18 | {
19 | #if !WindowsCE && !SILVERLIGHT
20 | var permission = new System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode);
21 | permission.Demand();
22 |
23 | return System.Runtime.InteropServices.Marshal.GetHRForException(ioe) & 0xFFFF;
24 | #else
25 | return 0;
26 | #endif
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/FlickrNet/SerializableAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net;
3 | using System.Windows;
4 | using System.Windows.Controls;
5 | using System.Windows.Documents;
6 | using System.Windows.Ink;
7 | using System.Windows.Input;
8 | using System.Windows.Media;
9 | using System.Windows.Media.Animation;
10 | using System.Windows.Shapes;
11 |
12 | namespace FlickrNet
13 | {
14 | public class SerializableAttribute : Attribute
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/FlickrNet/SignatureRequiredException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace FlickrNet
4 | {
5 | ///
6 | /// Thrown when a method requires a valid signature but no shared secret has been supplied.
7 | ///
8 | [Serializable]
9 | public class SignatureRequiredException : FlickrException
10 | {
11 | ///
12 | /// Initializes a new instance of the class.
13 | ///
14 | public SignatureRequiredException()
15 | : base("Method requires signing but no shared secret supplied.")
16 | {
17 | }
18 |
19 | ///
20 | /// Initializes a new instance of the class with a specified error message.
21 | ///
22 | ///
23 | public SignatureRequiredException(string message)
24 | : base(message)
25 | {
26 | }
27 |
28 | ///
29 | /// Initializes a new instance of the class with a specified error message
30 | /// and a reference to the inner exception that is the cause of this exception.
31 | ///
32 | ///
33 | ///
34 | public SignatureRequiredException(string message, Exception innerException)
35 | : base(message, innerException)
36 | {
37 | }
38 |
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/FlickrNet/StatDomain.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// The details of a referring domain. Used in the Flickr Stats API.
9 | ///
10 | public sealed class StatDomain : IFlickrParsable
11 | {
12 | ///
13 | /// The name of the referring domain.
14 | ///
15 | public string Name { get; set; }
16 | ///
17 | /// The number of views from this domain.
18 | ///
19 | public int Views { get; set; }
20 |
21 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
22 | {
23 | if (reader.LocalName != "domain")
24 | UtilityMethods.CheckParsingException(reader);
25 |
26 | while (reader.MoveToNextAttribute())
27 | {
28 | switch (reader.LocalName)
29 | {
30 | case "name":
31 | Name = reader.Value;
32 | break;
33 | case "views":
34 | Views = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
35 | break;
36 | default:
37 | UtilityMethods.CheckParsingException(reader);
38 | break;
39 | }
40 | }
41 |
42 | reader.Skip();
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/FlickrNet/StatDomainCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Xml;
5 |
6 | namespace FlickrNet
7 | {
8 | ///
9 | /// A list of referring domains.
10 | ///
11 | public sealed class StatDomainCollection : System.Collections.ObjectModel.Collection, IFlickrParsable
12 | {
13 | ///
14 | /// The page of this set of results.
15 | ///
16 | public int Page { get; set; }
17 | ///
18 | /// The number of pages of results that are available.
19 | ///
20 | public int Pages { get; set; }
21 | ///
22 | /// The number of referrers per page.
23 | ///
24 | public int PerPage { get; set; }
25 | ///
26 | /// The total number of referrers that are available for this result set.
27 | ///
28 | public int Total { get; set; }
29 |
30 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
31 | {
32 | if (reader.LocalName != "domains")
33 | UtilityMethods.CheckParsingException(reader);
34 |
35 | while (reader.MoveToNextAttribute())
36 | {
37 | switch (reader.LocalName)
38 | {
39 | case "page":
40 | Page = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
41 | break;
42 | case "total":
43 | Total = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
44 | break;
45 | case "pages":
46 | Pages = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
47 | break;
48 | case "perpage":
49 | PerPage = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
50 | break;
51 | default:
52 | UtilityMethods.CheckParsingException(reader);
53 | break;
54 | }
55 | }
56 |
57 | reader.Read();
58 |
59 | while (reader.LocalName == "domain")
60 | {
61 | var domain = new StatDomain();
62 | ((IFlickrParsable)domain).Load(reader);
63 | Add(domain);
64 | }
65 |
66 | reader.Skip();
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/FlickrNet/StatReferrer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// The referrer details returned by ,
9 | /// ,
10 | ///
11 | /// and .
12 | ///
13 | public sealed class StatReferrer : IFlickrParsable
14 | {
15 | ///
16 | /// The url that the referrer referred from.
17 | ///
18 | public string Url { get; set; }
19 | ///
20 | /// The number of times that URL was referred from.
21 | ///
22 | public int Views { get; set; }
23 |
24 | ///
25 | /// Then the referrer is a search engine this will contain the search term used.
26 | ///
27 | public string SearchTerm { get; set; }
28 |
29 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
30 | {
31 | if (reader.LocalName != "referrer")
32 | UtilityMethods.CheckParsingException(reader);
33 |
34 | while (reader.MoveToNextAttribute())
35 | {
36 | switch (reader.LocalName)
37 | {
38 | case "url":
39 | Url = reader.Value;
40 | break;
41 | case "searchterm":
42 | SearchTerm = reader.Value;
43 | break;
44 | case "views":
45 | Views = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
46 | break;
47 | default:
48 | UtilityMethods.CheckParsingException(reader);
49 | break;
50 | }
51 | }
52 |
53 | reader.Skip();
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/FlickrNet/Stats.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// The stats returned by ,
9 | /// ,
10 | /// and
11 | ///
12 | public sealed class Stats : IFlickrParsable
13 | {
14 | ///
15 | /// The number of views the object in question has had (either Photostream, Collection, Photo or Photoset).
16 | ///
17 | public int Views { get; set; }
18 |
19 | ///
20 | /// The number of comments the object in question has had (either Photo or Photoset).
21 | ///
22 | public int Comments { get; set; }
23 |
24 | ///
25 | /// The number of favorites the object in question has had (Photo only).
26 | ///
27 | public int Favorites { get; set; }
28 |
29 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
30 | {
31 | if (reader.LocalName != "stats")
32 | {
33 | UtilityMethods.CheckParsingException(reader);
34 | }
35 |
36 | while (reader.MoveToNextAttribute())
37 | {
38 | switch (reader.LocalName)
39 | {
40 | case "views":
41 | Views = string.IsNullOrEmpty(reader.Value) ? 0 : int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
42 | break;
43 | case "comments":
44 | Comments = string.IsNullOrEmpty(reader.Value) ? 0 : int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
45 | break;
46 | case "favorites":
47 | Favorites = string.IsNullOrEmpty(reader.Value) ? 0 : int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
48 | break;
49 | default:
50 | UtilityMethods.CheckParsingException(reader);
51 | break;
52 | }
53 | }
54 |
55 | reader.Skip();
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/FlickrNet/SubscriptionCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Collections.ObjectModel;
5 |
6 | namespace FlickrNet
7 | {
8 | ///
9 | /// A collection of instances for the calling user.
10 | ///
11 | public sealed class SubscriptionCollection : Collection, IFlickrParsable
12 | {
13 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
14 | {
15 | if (reader == null) throw new ArgumentNullException("reader");
16 | if (reader.LocalName != "subscriptions") { UtilityMethods.CheckParsingException(reader); return; }
17 |
18 | reader.Read();
19 |
20 | while (reader.LocalName == "subscription")
21 | {
22 | var item = new Subscription();
23 | ((IFlickrParsable)item).Load(reader);
24 | Add(item);
25 | }
26 |
27 | reader.Skip();
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/FlickrNet/SuggestionCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Collections.ObjectModel;
5 |
6 | namespace FlickrNet
7 | {
8 | ///
9 | /// The collection of location suggestions returned by .
10 | ///
11 | public sealed class SuggestionCollection : Collection, IFlickrParsable
12 | {
13 | ///
14 | /// The total number of suggestions available.
15 | ///
16 | public int Total { get; set; }
17 | ///
18 | /// The number of suggestions per page.
19 | ///
20 | public int PerPage { get; set; }
21 | ///
22 | /// The current page of suggestions returned.
23 | ///
24 | public int Page { get; set; }
25 | ///
26 | /// The total number of pages of suggestions available.
27 | ///
28 | public int Pages { get { return (int)Math.Ceiling(1.0 * Total / PerPage); } }
29 |
30 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
31 | {
32 | if (reader == null) throw new ArgumentNullException("reader");
33 | if (reader.LocalName != "suggestions") { UtilityMethods.CheckParsingException(reader); return; }
34 |
35 | while (reader.MoveToNextAttribute())
36 | {
37 | switch (reader.LocalName)
38 | {
39 | case "total":
40 | Total = reader.ReadContentAsInt();
41 | break;
42 | case "page":
43 | Page = reader.ReadContentAsInt();
44 | break;
45 | case "per_page":
46 | PerPage = reader.ReadContentAsInt();
47 | break;
48 | }
49 | }
50 |
51 | reader.Read();
52 |
53 | while (reader.LocalName == "suggestion")
54 | {
55 | var suggestion = new Suggestion();
56 | ((IFlickrParsable)suggestion).Load(reader);
57 | Add(suggestion);
58 | }
59 |
60 | return;
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/FlickrNet/SuggestionStatus.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// The status of a location suggestion.
9 | ///
10 | ///
11 | ///
12 | public enum SuggestionStatus
13 | {
14 | ///
15 | /// The suggestion is in a pending state.
16 | ///
17 | Pending = 0,
18 | ///
19 | /// The suggestion has been approved.
20 | ///
21 | Approved = 1,
22 | ///
23 | /// The suggestion has been rejected.
24 | ///
25 | Rejected = 2
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/FlickrNet/Ticket.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// The status of an upload ticket.
9 | ///
10 | public sealed class Ticket : IFlickrParsable
11 | {
12 | ///
13 | /// The ID of the ticket asked for.
14 | ///
15 | public string TicketId { get; set; }
16 |
17 | ///
18 | /// If the ticket is complete then this contains the photo ID of the uploaded photo.
19 | ///
20 | public string PhotoId { get; set; }
21 |
22 | ///
23 | /// Is the ticket ID supplied a valid ticket. True if it is invalid.
24 | ///
25 | public bool InvalidTicketId { get; set; }
26 |
27 | ///
28 | /// The status of a valid ticket. 0 = Incomplete, 1 = Complete, 2 = Error processing the image/video.
29 | ///
30 | public int CompleteStatus { get; set; }
31 |
32 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
33 | {
34 | while (reader.MoveToNextAttribute())
35 | {
36 | switch (reader.LocalName)
37 | {
38 | case "id":
39 | TicketId = reader.Value;
40 | break;
41 | case "invalid":
42 | InvalidTicketId = true;
43 | break;
44 | case "photoid":
45 | PhotoId = reader.Value;
46 | break;
47 | case "complete":
48 | CompleteStatus = reader.ReadContentAsInt();
49 | break;
50 | }
51 | }
52 |
53 | reader.Skip();
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/FlickrNet/TicketCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Collections.ObjectModel;
5 |
6 | namespace FlickrNet
7 | {
8 | ///
9 | /// A collection of instances.
10 | ///
11 | public sealed class TicketCollection : Collection, IFlickrParsable
12 | {
13 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
14 | {
15 | reader.Read();
16 |
17 | while (reader.LocalName == "ticket")
18 | {
19 | var ticket = new Ticket();
20 | ((IFlickrParsable)ticket).Load(reader);
21 | Add(ticket);
22 | }
23 |
24 | reader.Skip();
25 |
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/FlickrNet/UploadProgressEvent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace FlickrNet
4 | {
5 | ///
6 | /// Event arguments for a event.
7 | ///
8 | public class UploadProgressEventArgs : EventArgs
9 | {
10 | ///
11 | /// Number of bytes transfered so far.
12 | ///
13 | public long BytesSent { get; internal set; }
14 |
15 | ///
16 | /// Total bytes to be sent. -1 if this is unknown.
17 | ///
18 | public long TotalBytesToSend { get; internal set; }
19 |
20 | ///
21 | /// True if all bytes have been uploaded.
22 | ///
23 | public bool UploadComplete { get { return ProcessPercentage == 100; } }
24 |
25 | ///
26 | /// The percentage of the upload that has been completed.
27 | ///
28 | public int ProcessPercentage
29 | {
30 | get { return Convert.ToInt32(BytesSent * 100 / TotalBytesToSend); }
31 | }
32 |
33 | internal UploadProgressEventArgs()
34 | {
35 | }
36 |
37 | internal UploadProgressEventArgs(long bytes, long totalBytes)
38 | {
39 | BytesSent = bytes;
40 | TotalBytesToSend = totalBytes;
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/FlickrNet/UserGeoPermissions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// The default privacy level for geographic information attached to the user's photos
9 | /// and whether or not the user has chosen to use geo-related EXIF information to automatically geotag their photos.
10 | ///
11 | public sealed class UserGeoPermissions : IFlickrParsable
12 | {
13 | ///
14 | /// The ID of the user.
15 | ///
16 | public string UserId { get; set; }
17 |
18 | ///
19 | /// The default privacy level for geographic information attached to the user's photos.
20 | ///
21 | public GeoPermissionType GeoPermissions { get; set; }
22 |
23 | ///
24 | /// Whether or not the user has chosen to use geo-related EXIF information to automatically geotag their photos.
25 | ///
26 | public bool ImportGeoExif { get; set; }
27 |
28 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
29 | {
30 | while (reader.MoveToNextAttribute())
31 | {
32 | switch (reader.LocalName)
33 | {
34 | case "nsid":
35 | UserId = reader.Value;
36 | break;
37 | case "geoperms":
38 | GeoPermissions = (GeoPermissionType)reader.ReadContentAsInt();
39 | break;
40 | case "importgeoexif":
41 | ImportGeoExif = reader.Value == "1";
42 | break;
43 | }
44 | }
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/FlickrNet/VideoInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace FlickrNet
6 | {
7 | ///
8 | /// Information about a video, as returned by .
9 | ///
10 | public sealed class VideoInfo : IFlickrParsable
11 | {
12 | ///
13 | /// True or false if the video is ready to be displayed.
14 | ///
15 | public bool Ready { get; set; }
16 | ///
17 | /// True or false depending on if processing of the video succeeded or not.
18 | ///
19 | public bool Failed { get; set; }
20 | ///
21 | /// True or false depending on if the processing of the video is pending or not.
22 | ///
23 | public bool Pending { get; set; }
24 | ///
25 | /// The duration of the video, in seconds.
26 | ///
27 | public int Duration { get; set; }
28 | ///
29 | /// The width of the video.
30 | ///
31 | public int Width { get; set; }
32 | ///
33 | /// The height of the video.
34 | ///
35 | public int Height { get; set; }
36 |
37 | void IFlickrParsable.Load(System.Xml.XmlReader reader)
38 | {
39 | while (reader.MoveToNextAttribute())
40 | {
41 | switch (reader.LocalName)
42 | {
43 | case "ready":
44 | Ready = reader.Value == "1";
45 | break;
46 | case "failed":
47 | Failed = reader.Value == "1";
48 | break;
49 | case "pending":
50 | Pending = reader.Value == "1";
51 | break;
52 | case "duration":
53 | Duration = string.IsNullOrEmpty(reader.Value) ? -1 : reader.ReadContentAsInt();
54 | break;
55 | case "width":
56 | Width = string.IsNullOrEmpty(reader.Value) ? -1 : reader.ReadContentAsInt();
57 | break;
58 | case "height":
59 | Height = string.IsNullOrEmpty(reader.Value) ? -1 : reader.ReadContentAsInt();
60 | break;
61 | default:
62 | UtilityMethods.CheckParsingException(reader);
63 | break;
64 | }
65 | }
66 |
67 | reader.Read();
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/FlickrNet/example_app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/FlickrNetCF.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 10.00
3 | # Visual Studio 2008
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlickrNetCF", "FlickrNet\FlickrNetCF.csproj", "{DACD45D5-ED22-4DD5-9D1D-B1706E0AD1B9}"
5 | EndProject
6 | Global
7 | GlobalSection(SubversionScc) = preSolution
8 | Svn-Managed = True
9 | Manager = AnkhSVN - Subversion Support for Visual Studio
10 | EndGlobalSection
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {DACD45D5-ED22-4DD5-9D1D-B1706E0AD1B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {DACD45D5-ED22-4DD5-9D1D-B1706E0AD1B9}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {DACD45D5-ED22-4DD5-9D1D-B1706E0AD1B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {DACD45D5-ED22-4DD5-9D1D-B1706E0AD1B9}.Release|Any CPU.Build.0 = Release|Any CPU
20 | EndGlobalSection
21 | GlobalSection(SolutionProperties) = preSolution
22 | HideSolutionNode = FALSE
23 | EndGlobalSection
24 | GlobalSection(TeamFoundationVersionControl) = preSolution
25 | SccNumberOfProjects = 2
26 | SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
27 | SccTeamFoundationServer = https://tfs01.codeplex.com/
28 | SccLocalPath0 = .
29 | SccProjectUniqueName1 = FlickrNet\\FlickrNetCF.csproj
30 | SccProjectName1 = FlickrNet
31 | SccLocalPath1 = FlickrNet
32 | EndGlobalSection
33 | EndGlobal
34 |
--------------------------------------------------------------------------------
/FlickrNetTest/Auth/AuthHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using FlickrNet;
3 | using NUnit.Framework;
4 | using Shouldly;
5 |
6 | #pragma warning disable CS0618 // Type or member is obsolete
7 |
8 | namespace FlickrNetTest
9 | {
10 | [TestFixture]
11 | public class AuthHelper
12 | {
13 | [Test]
14 | public void CheckEnvironmentVariableForAccessToken()
15 | {
16 | var value = Environment.GetEnvironmentVariable("FLICKR_TEST_ACCESSTOKEN");
17 | value.ShouldNotBeNullOrEmpty();
18 | }
19 |
20 | ///
21 | /// This method will authenticate the current user, and then store the AuthToken in the
22 | ///
23 | [Test]
24 | [Ignore("Use this to generate a new aut token if required")]
25 | public void AuthHelperMethod()
26 | {
27 | Flickr f = TestData.GetOldSignedInstance();
28 |
29 | string frob = f.AuthGetFrob();
30 |
31 | Assert.IsNotNull(frob, "Frob should not be null.");
32 |
33 | string url = f.AuthCalcUrl(frob, AuthLevel.Delete);
34 |
35 | Assert.IsNotNull(url, "url should not be null.");
36 |
37 | System.Diagnostics.Process.Start(url);
38 |
39 | // Auth flickr in next 30 seconds
40 |
41 | System.Threading.Thread.Sleep(1000 * 30);
42 |
43 | Auth auth = f.AuthGetToken(frob);
44 |
45 | TestData.AuthToken = auth.Token;
46 |
47 | Console.WriteLine(TestData.AuthToken);
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/FlickrNetTest/BaseTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using FlickrNet;
4 | using NUnit.Framework;
5 | using NUnit.Framework.Interfaces;
6 |
7 | namespace FlickrNetTest
8 | {
9 | [TestFixture]
10 | public class BaseTest
11 | {
12 | Flickr _instance;
13 | Flickr _authInstance;
14 | Dictionary _errorLog;
15 |
16 | static int _testCount;
17 |
18 | protected Flickr Instance
19 | {
20 | get
21 | {
22 | return _instance ?? (_instance = TestData.GetInstance());
23 | }
24 | }
25 |
26 | protected Flickr AuthInstance
27 | {
28 | get
29 | {
30 | return _authInstance ?? (_authInstance = TestData.GetAuthInstance());
31 | }
32 | }
33 |
34 | protected bool InstanceUsed
35 | {
36 | get { return _instance != null; }
37 | }
38 |
39 | protected bool AuthInstanceUsed
40 | {
41 | get { return _authInstance != null; }
42 | }
43 |
44 | [SetUp]
45 | public void InitialiseLoggingAndFlickr()
46 | {
47 | _instance = null;
48 | _authInstance = null;
49 | _errorLog = new Dictionary();
50 | _testCount += 1;
51 | }
52 |
53 | protected void LogOnError(string key, string information)
54 | {
55 | _errorLog.Add(key, information);
56 | }
57 |
58 | [TearDown]
59 | public void ErrorLogging()
60 | {
61 | if( (_testCount % 10) > 0 ) System.Threading.Thread.Sleep(200);
62 |
63 | if (TestContext.CurrentContext.Result.Outcome.Status != TestStatus.Failed) return;
64 |
65 | if (InstanceUsed)
66 | {
67 | Console.WriteLine("LastRequest: " + _instance.LastRequest);
68 | Console.WriteLine("LastResponse: " + _instance.LastResponse);
69 | }
70 | if (AuthInstanceUsed)
71 | {
72 | Console.WriteLine("LastRequest (Auth): " +_authInstance.LastRequest);
73 | Console.WriteLine("LastResponse (Auth): " + _authInstance.LastResponse);
74 | }
75 |
76 | foreach (var line in _errorLog)
77 | {
78 | Console.WriteLine(line.Key + ": " + line.Value);
79 | }
80 | }
81 |
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/FlickrNetTest/BlogTests.cs:
--------------------------------------------------------------------------------
1 |
2 | using NUnit.Framework;
3 | using FlickrNet;
4 |
5 | namespace FlickrNetTest
6 | {
7 | ///
8 | /// Summary description for BlogTests
9 | ///
10 | [TestFixture]
11 | public class BlogTests : BaseTest
12 | {
13 |
14 | [Test]
15 | [Category("AccessTokenRequired")]
16 | public void BlogsGetListTest()
17 | {
18 | Flickr f = AuthInstance;
19 |
20 | BlogCollection blogs = f.BlogsGetList();
21 |
22 | Assert.IsNotNull(blogs, "Blogs should not be null.");
23 |
24 | foreach (Blog blog in blogs)
25 | {
26 | Assert.IsNotNull(blog.BlogId, "BlogId should not be null.");
27 | Assert.IsNotNull(blog.NeedsPassword, "NeedsPassword should not be null.");
28 | Assert.IsNotNull(blog.BlogName, "BlogName should not be null.");
29 | Assert.IsNotNull(blog.BlogUrl, "BlogUrl should not be null.");
30 | Assert.IsNotNull(blog.Service, "Service should not be null.");
31 | }
32 | }
33 |
34 | [Test]
35 | public void BlogGetServicesTest()
36 | {
37 | Flickr f = Instance;
38 |
39 | BlogServiceCollection services = f.BlogsGetServices();
40 |
41 | Assert.IsNotNull(services, "BlogServices should not be null.");
42 | Assert.AreNotEqual(0, services.Count, "BlogServices.Count should not be zero.");
43 |
44 | foreach (BlogService service in services)
45 | {
46 | Assert.IsNotNull(service.Id, "BlogService.Id should not be null.");
47 | Assert.IsNotNull(service.Name, "BlogService.Name should not be null.");
48 | }
49 |
50 | Assert.AreEqual("beta.blogger.com", services[0].Id, "First ID should be beta.blogger.com.");
51 | Assert.AreEqual("Blogger", services[0].Name, "First Name should be beta.blogger.com.");
52 |
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/FlickrNetTest/BoundaryTests.cs:
--------------------------------------------------------------------------------
1 | using FlickrNet;
2 | using NUnit.Framework;
3 | using Shouldly;
4 | using System;
5 |
6 | namespace FlickrNetTest
7 | {
8 | [TestFixture]
9 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Potential Code Quality Issues", "RECS0026:Possible unassigned object created by 'new'")]
10 | public class BoundaryTests : BaseTest
11 | {
12 | [Test]
13 | public void BoundaryBoxCalculateSizesUkNewcastle()
14 | {
15 | var b = BoundaryBox.UKNewcastle;
16 |
17 | var e = b.DiagonalDistanceInMiles();
18 |
19 | Assert.AreNotEqual(0, e);
20 | }
21 |
22 | [Test]
23 | [TestCase(-180, -91, 180, 90)]
24 | [TestCase(-181, -90, 180, 90)]
25 | [TestCase(-180, -90, 180, 91)]
26 | [TestCase(-180, -90, 181, 90)]
27 | public void BoundaryBoxThrowExceptionOnInvalidMinLat(double minLong, double minLat, double maxLong, double maxLat)
28 | {
29 | Should.Throw(() => new BoundaryBox(minLong, minLat, maxLong, maxLat));
30 | }
31 |
32 | [Test]
33 | public void BoundaryBoxCalculateSizesFrankfurtToBerlin()
34 | {
35 | var b = new BoundaryBox(8.68194, 50.11222, 13.29750, 52.52222);
36 |
37 | var e = b.DiagonalDistanceInMiles();
38 | Assert.IsTrue(259.9 < e && e < 260.0);
39 | }
40 |
41 | [Test]
42 | public void BoundaryBoxWithNullPointStringThrows()
43 | {
44 | Should.Throw(() => new BoundaryBox(null));
45 | }
46 |
47 | [Test]
48 | public void BoundaryBoxWithInvalidPointStringThrows()
49 | {
50 | Should.Throw(() => new BoundaryBox("1,2,3"));
51 | }
52 |
53 | [Test]
54 | public void BoundaryBoxWithNoneNumericPointStringThrows()
55 | {
56 | Should.Throw(() => new BoundaryBox("1,2,3,A"));
57 | }
58 |
59 | [Test]
60 | public void BoundaryBoxWithValidPointStringSetCorrectly()
61 | {
62 | var b = new BoundaryBox("1,2,3,4");
63 |
64 | Assert.That(b.MinimumLongitude, Is.EqualTo(1M));
65 | Assert.That(b.MinimumLatitude, Is.EqualTo(2M));
66 | Assert.That(b.MaximumLongitude, Is.EqualTo(3M));
67 | Assert.That(b.MaximumLatitude, Is.EqualTo(4M));
68 | }
69 |
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/FlickrNetTest/CacheTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using NUnit.Framework;
4 | using FlickrNet;
5 | using System.IO;
6 |
7 | namespace FlickrNetTest
8 | {
9 | ///
10 | /// Summary description for CacheTests
11 | ///
12 | [TestFixture]
13 | public class CacheTests : BaseTest
14 | {
15 | [Test]
16 | public void CacheLocationTest()
17 | {
18 | string origLocation = Flickr.CacheLocation;
19 |
20 | Console.WriteLine(origLocation);
21 |
22 | string newLocation = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
23 |
24 | Flickr.CacheLocation = newLocation;
25 |
26 | Assert.AreEqual(Flickr.CacheLocation, newLocation);
27 |
28 | Flickr.CacheLocation = origLocation;
29 |
30 | Assert.AreEqual(Flickr.CacheLocation, origLocation);
31 |
32 | }
33 |
34 | [Test]
35 | public void CacheHitTest()
36 | {
37 | if (Directory.Exists(Flickr.CacheLocation))
38 | {
39 | Directory.Delete(Flickr.CacheLocation, true);
40 | }
41 |
42 | Flickr f = Instance;
43 | Flickr.FlushCache();
44 | f.InstanceCacheDisabled = false;
45 |
46 | f.PeopleGetPublicPhotos(TestData.TestUserId);
47 |
48 | string lastUrl = f.LastRequest;
49 |
50 | ICacheItem item = Cache.Responses.Get(lastUrl, TimeSpan.MaxValue, false);
51 |
52 | Assert.IsNotNull(item, "Cache should now contain the item.");
53 | Assert.IsInstanceOf(item);
54 |
55 | var response = item as ResponseCacheItem;
56 |
57 | Assert.IsNotNull(response.Url, "Url should not be null.");
58 | Assert.AreEqual(lastUrl, response.Url.AbsoluteUri, "Url should match the url requested from the cache.");
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/FlickrNetTest/CameraTests.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using NUnit.Framework;
3 |
4 | namespace FlickrNetTest
5 | {
6 | [TestFixture]
7 | public class CameraTests : BaseTest
8 | {
9 | [Test]
10 | public void ShouldReturnListOfCameraBrands()
11 | {
12 | var brands = Instance.CamerasGetBrands();
13 |
14 | Assert.IsNotNull((brands));
15 | Assert.AreNotEqual(0, brands.Count);
16 |
17 | Assert.IsTrue(brands.Any(b => b.BrandId == "canon" && b.BrandName == "Canon"));
18 | Assert.IsTrue(brands.Any(b => b.BrandId == "nikon" && b.BrandName == "Nikon"));
19 | }
20 |
21 | [Test]
22 | public void ShouldReturnListOfCanonCameraModels()
23 | {
24 | var models = Instance.CamerasGetBrandModels("canon");
25 |
26 | Assert.IsNotNull((models));
27 | Assert.AreNotEqual(0, models.Count);
28 |
29 | Assert.IsTrue(models.Any(c => c.CameraId == "eos_5d_mark_ii" && c.CameraName == "Canon EOS 5D Mark II"));
30 | Assert.IsTrue(models.Any(c => c.CameraId == "powershot_a620" && c.CameraName == "Canon PowerShot A620"));
31 |
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/FlickrNetTest/CheckTests.cs:
--------------------------------------------------------------------------------
1 | using FlickrNet;
2 | using NUnit.Framework;
3 | using Shouldly;
4 |
5 | #pragma warning disable CS0618 // Type or member is obsolete
6 |
7 | namespace FlickrNetTest
8 | {
9 | [TestFixture]
10 | public class CheckTests : BaseTest
11 | {
12 | [Test]
13 | public void CheckApiKeyThrowsExceptionWhenNotPresent()
14 | {
15 | var f = new Flickr();
16 |
17 | Should.Throw(() => f.CheckApiKey());
18 | }
19 |
20 | [Test]
21 | public void CheckApiKeyDoesNotThrowWhenPresent()
22 | {
23 | var f = new Flickr();
24 | f.ApiKey = "X";
25 |
26 | Should.NotThrow(() => f.CheckApiKey());
27 | }
28 |
29 | [Test]
30 | public void CheckSignatureKeyThrowsExceptionWhenSecretNotPresent()
31 | {
32 | var f = new Flickr();
33 | f.ApiKey = "X";
34 | Should.Throw(() => f.CheckSigned());
35 | }
36 |
37 | [Test]
38 | public void CheckSignatureKeyDoesntThrowWhenSecretPresent()
39 | {
40 | var f = new Flickr();
41 | f.ApiKey = "X";
42 | f.ApiSecret = "Y";
43 |
44 | Should.NotThrow(() => f.CheckSigned());
45 | }
46 |
47 | [Test]
48 | public void CheckRequestAuthenticationThrowsExceptionWhenNothingPresent()
49 | {
50 | var f = new Flickr();
51 | f.ApiKey = "X";
52 | f.ApiSecret = "Y";
53 |
54 | Should.Throw(() => f.CheckRequiresAuthentication());
55 | }
56 |
57 | [Test]
58 | public void CheckRequestAuthenticationDoesNotThrowWhenAuthTokenPresent()
59 | {
60 | var f = new Flickr();
61 | f.ApiKey = "X";
62 | f.ApiSecret = "Y";
63 |
64 | f.AuthToken = "Z";
65 |
66 | Assert.DoesNotThrow(f.CheckRequiresAuthentication);
67 | }
68 |
69 | [Test]
70 | public void CheckRequestAuthenticationDoesNotThrowWhenOAuthTokenPresent()
71 | {
72 | var f = new Flickr();
73 | f.ApiKey = "X";
74 | f.ApiSecret = "Y";
75 |
76 | f.OAuthAccessToken = "Z1";
77 | f.OAuthAccessTokenSecret = "Z2";
78 |
79 | Assert.DoesNotThrow(f.CheckRequiresAuthentication);
80 | }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/FlickrNetTest/CommonsTests.cs:
--------------------------------------------------------------------------------
1 |
2 | using NUnit.Framework;
3 | using FlickrNet;
4 |
5 | namespace FlickrNetTest
6 | {
7 | ///
8 | /// Summary description for CommonsTests
9 | ///
10 | [TestFixture]
11 | public class CommonsTests : BaseTest
12 | {
13 |
14 | [Test]
15 | public void CommonsGetInstitutions()
16 | {
17 | InstitutionCollection insts = Instance.CommonsGetInstitutions();
18 |
19 | Assert.IsNotNull(insts);
20 | Assert.IsTrue(insts.Count > 5);
21 |
22 | foreach (var i in insts)
23 | {
24 | Assert.IsNotNull(i);
25 | Assert.IsNotNull(i.InstitutionId);
26 | Assert.IsNotNull(i.InstitutionName);
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/FlickrNetTest/FlickrConfigurationSettingsTest.cs:
--------------------------------------------------------------------------------
1 | using FlickrNet;
2 | using NUnit.Framework;
3 | using System;
4 | using System.Xml;
5 |
6 | namespace FlickrNetTest
7 | {
8 |
9 |
10 | ///
11 | ///This is a test class for FlickrConfigurationSettingsTest and is intended
12 | ///to contain all FlickrConfigurationSettingsTest Unit Tests
13 | ///
14 | [TestFixture]
15 | public class FlickrConfigurationSettingsTest : BaseTest
16 | {
17 |
18 | ///
19 | ///A test for FlickrConfigurationSettings Constructor
20 | ///
21 | [Test]
22 | public void FlickrConfigurationSettingsConstructorTest()
23 | {
24 | const string xml = ""
27 | + ""
29 | + "";
30 | var doc = new XmlDocument();
31 | doc.LoadXml(xml);
32 |
33 | var configNode = doc.SelectSingleNode("flickrNet");
34 | var target = new FlickrConfigurationSettings(configNode);
35 |
36 | Assert.AreEqual("apikey", target.ApiKey);
37 | Assert.AreEqual("secret", target.SharedSecret);
38 | Assert.AreEqual("thetoken", target.ApiToken);
39 | Assert.IsTrue(target.CacheDisabled);
40 | Assert.AreEqual(1024, target.CacheSize);
41 | Assert.AreEqual(new TimeSpan(1, 0, 0), target.CacheTimeout);
42 | Assert.AreEqual("testlocation", target.CacheLocation);
43 |
44 | Assert.IsTrue(target.IsProxyDefined, "IsProxyDefined should be true");
45 | Assert.AreEqual("localhost", target.ProxyIPAddress);
46 | Assert.AreEqual(8800, target.ProxyPort);
47 | Assert.AreEqual("testusername", target.ProxyUsername);
48 | Assert.AreEqual("testpassword", target.ProxyPassword);
49 | Assert.AreEqual("testdomain", target.ProxyDomain);
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/FlickrNetTest/FlickrNet.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samjudson/flickr-net/32386d299740e895cb939e839fe5d5e8044d5a7c/FlickrNetTest/FlickrNet.snk
--------------------------------------------------------------------------------
/FlickrNetTest/FlickrNetTest.csproj.vspscc:
--------------------------------------------------------------------------------
1 | ""
2 | {
3 | "FILE_VERSION" = "9237"
4 | "ENLISTMENT_CHOICE" = "NEVER"
5 | "PROJECT_FILE_RELATIVE_PATH" = ""
6 | "NUMBER_OF_EXCLUDED_FILES" = "0"
7 | "ORIGINAL_PROJECT_FILE_PATH" = ""
8 | "NUMBER_OF_NESTED_PROJECTS" = "0"
9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
10 | }
11 |
--------------------------------------------------------------------------------
/FlickrNetTest/GeoTests.cs:
--------------------------------------------------------------------------------
1 |
2 | using NUnit.Framework;
3 | using FlickrNet;
4 |
5 | namespace FlickrNetTest
6 | {
7 | ///
8 | /// Summary description for GeoTests
9 | ///
10 | [TestFixture]
11 | public class GeoTests : BaseTest
12 | {
13 |
14 | [Test]
15 | [Category("AccessTokenRequired")]
16 | public void PhotosGeoGetPermsBasicTest()
17 | {
18 | GeoPermissions perms = AuthInstance.PhotosGeoGetPerms(TestData.PhotoId);
19 |
20 | Assert.IsNotNull(perms);
21 | Assert.AreEqual(TestData.PhotoId, perms.PhotoId);
22 | Assert.IsTrue(perms.IsPublic, "IsPublic should be true.");
23 | }
24 |
25 | [Test]
26 | [Category("AccessTokenRequired")]
27 | public void PhotosGetWithGeoDataBasicTest()
28 | {
29 | PhotoCollection photos = AuthInstance.PhotosGetWithGeoData();
30 |
31 | Assert.IsNotNull(photos);
32 | Assert.AreNotEqual(0, photos.Count);
33 | Assert.AreNotEqual(0, photos.Total);
34 | Assert.AreEqual(1, photos.Page);
35 | Assert.AreNotEqual(0, photos.PerPage);
36 | Assert.AreNotEqual(0, photos.Pages);
37 |
38 | foreach (var p in photos)
39 | {
40 | Assert.IsNotNull(p.PhotoId);
41 | }
42 |
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/FlickrNetTest/InterestingnessTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using NUnit.Framework;
3 | using FlickrNet;
4 |
5 | namespace FlickrNetTest
6 | {
7 | [TestFixture]
8 | public class InterestingnessTests : BaseTest
9 | {
10 | [Test]
11 | public void InterestingnessGetListTestsBasicTest()
12 | {
13 | DateTime date = DateTime.Today.AddDays(-2);
14 | DateTime datePlusOne = date.AddDays(1);
15 |
16 | PhotoCollection photos = Instance.InterestingnessGetList(date, PhotoSearchExtras.All, 1, 100);
17 |
18 | Assert.IsNotNull(photos, "Photos should not be null.");
19 |
20 | Assert.IsTrue(photos.Count > 50 && photos.Count <= 100, "Count should be at least 50, but not more than 100.");
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/FlickrNetTest/PandaTest.cs:
--------------------------------------------------------------------------------
1 |
2 | using NUnit.Framework;
3 | using FlickrNet;
4 |
5 | namespace FlickrNetTest
6 | {
7 | ///
8 | /// Summary description for PandaGetListTest
9 | ///
10 | [TestFixture]
11 | public class PandaTest : BaseTest
12 | {
13 | [Test]
14 | public void PandaGetListBasicTest()
15 | {
16 | string[] pandas = Instance.PandaGetList();
17 |
18 | Assert.IsNotNull(pandas, "Should return string array");
19 | Assert.IsTrue(pandas.Length > 0, "Should not return empty array");
20 |
21 | Assert.AreEqual("ling ling", pandas[0]);
22 | Assert.AreEqual("hsing hsing", pandas[1]);
23 | Assert.AreEqual("wang wang", pandas[2]);
24 | }
25 |
26 | [Test]
27 | public void PandaGetPhotosLingLingTest()
28 | {
29 | var photos = Instance.PandaGetPhotos("ling ling");
30 |
31 | Assert.IsNotNull(photos, "PandaPhotos should not be null.");
32 | Assert.AreEqual(photos.Count, photos.Total, "PandaPhotos.Count should equal PandaPhotos.Total.");
33 | Assert.AreEqual("ling ling", photos.PandaName, "PandaPhotos.Panda should be 'ling ling'");
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/FlickrNetTest/PhotoOwnerNameTest.cs:
--------------------------------------------------------------------------------
1 |
2 | using NUnit.Framework;
3 | using FlickrNet;
4 |
5 | namespace FlickrNetTest
6 | {
7 | ///
8 | /// Summary description for PhotoOwnerNameTest
9 | ///
10 | [TestFixture]
11 | public class PhotoOwnerNameTest : BaseTest
12 | {
13 | [Test]
14 | public void PhotosSearchOwnerNameTest()
15 | {
16 | var o = new PhotoSearchOptions();
17 |
18 | o.UserId = TestData.TestUserId;
19 | o.PerPage = 10;
20 | o.Extras = PhotoSearchExtras.OwnerName;
21 |
22 | Flickr f = Instance;
23 | PhotoCollection photos = f.PhotosSearch(o);
24 |
25 | Assert.IsNotNull(photos[0].OwnerName);
26 |
27 | }
28 |
29 | [Test]
30 | public void PhotosGetContactsPublicPhotosOwnerNameTest()
31 | {
32 | Flickr f = Instance;
33 | PhotoCollection photos = f.PhotosGetContactsPublicPhotos(TestData.TestUserId, PhotoSearchExtras.OwnerName);
34 |
35 | Assert.IsNotNull(photos[0].OwnerName);
36 | }
37 |
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/FlickrNetTest/PhotosCommentsTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using NUnit.Framework;
4 | using FlickrNet;
5 |
6 | namespace FlickrNetTest
7 | {
8 | ///
9 | /// Summary description for PhotosCommentsGetListTests
10 | ///
11 | [TestFixture]
12 | public class PhotosCommentsTests : BaseTest
13 | {
14 | [Test]
15 | public void PhotosCommentsGetListBasicTest()
16 | {
17 | Flickr f = Instance;
18 |
19 | PhotoCommentCollection comments = f.PhotosCommentsGetList("3546335765");
20 |
21 | Assert.IsNotNull(comments, "PhotoCommentCollection should not be null.");
22 |
23 | Assert.AreEqual(1, comments.Count, "Count should be one.");
24 |
25 | Assert.AreEqual("ian1001", comments[0].AuthorUserName);
26 | Assert.AreEqual("Sam lucky you NYCis so cool can't wait to go again it's my fav city along with San fran", comments[0].CommentHtml);
27 | }
28 |
29 | [Test]
30 | [Category("AccessTokenRequired")]
31 | public void PhotosCommentsGetRecentForContactsBasicTest()
32 | {
33 | Flickr f = AuthInstance;
34 |
35 | var photos = f.PhotosCommentsGetRecentForContacts();
36 | Assert.IsNotNull(photos, "PhotoCollection should not be null.");
37 | }
38 |
39 | [Test]
40 | [Category("AccessTokenRequired")]
41 | public void PhotosCommentsGetRecentForContactsFullParamTest()
42 | {
43 | Flickr f = AuthInstance;
44 |
45 | var photos = f.PhotosCommentsGetRecentForContacts(DateTime.Now.AddHours(-1), PhotoSearchExtras.All, 1, 20);
46 | Assert.IsNotNull(photos, "PhotoCollection should not be null.");
47 | Assert.AreEqual(20, photos.PerPage);
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/FlickrNetTest/PhotosGetContactsPhotos.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using FlickrNet;
3 | using NUnit.Framework;
4 | using Shouldly;
5 |
6 | namespace FlickrNetTest
7 | {
8 | [TestFixture]
9 | [Category("AccessTokenRequired")]
10 | public class PhotosGetContactsPhotos : BaseTest
11 | {
12 | [Test]
13 | public void PhotosGetContactsPhotosSignatureRequiredTest()
14 | {
15 | Should.Throw(() => Instance.PhotosGetContactsPhotos());
16 | }
17 |
18 | [Test]
19 | public void PhotosGetContactsPhotosIncorrectCountTest()
20 | {
21 | Should.Throw(() => AuthInstance.PhotosGetContactsPhotos(51));
22 | }
23 |
24 | [Test]
25 | public void PhotosGetContactsPhotosBasicTest()
26 | {
27 | PhotoCollection photos = AuthInstance.PhotosGetContactsPhotos(10);
28 |
29 | photos.Count.ShouldBeInRange(9, 10, "Should return 9-10 photos");
30 |
31 | }
32 |
33 | [Test]
34 | public void PhotosGetContactsPhotosExtrasTest()
35 | {
36 | PhotoCollection photos = AuthInstance.PhotosGetContactsPhotos(10, false, false, false, PhotoSearchExtras.All);
37 |
38 | photos.Count.ShouldBeInRange(9, 10, "Should return 9-10 photos");
39 |
40 | foreach (Photo p in photos)
41 | {
42 | Assert.IsNotNull(p.OwnerName, "OwnerName should not be null");
43 | Assert.AreNotEqual(default(DateTime), p.DateTaken, "DateTaken should not be default DateTime");
44 | }
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/FlickrNetTest/PhotosLicensesTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using NUnit.Framework;
3 | using FlickrNet;
4 |
5 | namespace FlickrNetTest
6 | {
7 | [TestFixture]
8 | public class PhotosLicensesTests : BaseTest
9 | {
10 | [Test]
11 | public void PhotosLicensesGetInfoBasicTest()
12 | {
13 | LicenseCollection col = Instance.PhotosLicensesGetInfo();
14 |
15 | foreach (License lic in col)
16 | {
17 | if (!Enum.IsDefined(typeof(LicenseType), lic.LicenseId))
18 | {
19 | Assert.Fail("License with ID " + (int)lic.LicenseId + ", " + lic.LicenseName + " dooes not exist.");
20 | }
21 | }
22 | }
23 |
24 | [Test]
25 | [Category("AccessTokenRequired")]
26 | public void PhotosLicensesSetLicenseTest()
27 | {
28 | Flickr f = AuthInstance;
29 | string photoId = "7176125763";
30 |
31 | var photoInfo = f.PhotosGetInfo(photoId); // Rainbow Rose
32 | var origLicense = photoInfo.License;
33 |
34 | var newLicense = origLicense == LicenseType.AttributionCC ? LicenseType.AttributionNoDerivativesCC : LicenseType.AttributionCC;
35 | f.PhotosLicensesSetLicense(photoId, newLicense);
36 |
37 | var newPhotoInfo = f.PhotosGetInfo(photoId);
38 |
39 | Assert.AreEqual(newLicense, newPhotoInfo.License, "License has not changed");
40 |
41 | // Reset license
42 | f.PhotosLicensesSetLicense(photoId, origLicense);
43 | }
44 |
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/FlickrNetTest/PhotosSerializationTests.cs:
--------------------------------------------------------------------------------
1 |
2 | using NUnit.Framework;
3 | using FlickrNet;
4 | using System.IO;
5 | using System.Xml;
6 |
7 | namespace FlickrNetTest
8 | {
9 | ///
10 | /// Summary description for PhotosSerializationTests
11 | ///
12 | [TestFixture]
13 | public class PhotosSerializationTests : BaseTest
14 | {
15 | [Test]
16 | public void PhotosSerializationSkipBlankPhotoRowTest()
17 | {
18 | const string xml = @"
19 |
22 |
24 |
26 | ";
27 |
28 | var photos = new PhotoCollection();
29 |
30 | var sr = new StringReader(xml);
31 | var reader = new XmlTextReader(sr) {WhitespaceHandling = WhitespaceHandling.Significant};
32 |
33 | reader.ReadToDescendant("photos");
34 |
35 | ((IFlickrParsable) photos).Load(reader);
36 |
37 | Assert.IsNotNull(photos, "Photos should not be null");
38 | Assert.AreEqual(500, photos.Total, "Total photos should be 500");
39 | Assert.AreEqual(2, photos.Count, "Should only contain 2 photo");
40 |
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/FlickrNetTest/PhotosetCommentsGetListTests.cs:
--------------------------------------------------------------------------------
1 |
2 | using NUnit.Framework;
3 | using FlickrNet;
4 |
5 | namespace FlickrNetTest
6 | {
7 | ///
8 | /// Summary description for PhotosetCommentsGetListTests
9 | ///
10 | [TestFixture]
11 | public class PhotosetCommentsGetListTests : BaseTest
12 | {
13 | [Test]
14 | public void PhotosetsCommentsGetListBasicTest()
15 | {
16 | Flickr f = Instance;
17 |
18 | PhotosetCommentCollection comments = f.PhotosetsCommentsGetList("1335934");
19 |
20 | Assert.IsNotNull(comments);
21 |
22 | Assert.AreEqual(2, comments.Count);
23 |
24 | Assert.AreEqual("Superchou", comments[0].AuthorUserName);
25 | Assert.AreEqual("LOL... I had no idea this set existed... what a great afternoon we had :)", comments[0].CommentHtml);
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/FlickrNetTest/PhotosetsOrderSets.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using NUnit.Framework;
3 |
4 | namespace FlickrNetTest
5 | {
6 | [TestFixture]
7 | [Category("AccessTokenRequired")]
8 | public class PhotosetsOrderSets : BaseTest
9 | {
10 | [Test]
11 | public void PhotosetsOrderSetsStringTest()
12 | {
13 | var mySets = AuthInstance.PhotosetsGetList();
14 |
15 | AuthInstance.PhotosetsOrderSets(string.Join(",", mySets.Select(myset => myset.PhotosetId).ToArray()));
16 |
17 | }
18 |
19 | [Test]
20 | public void PhotosetsOrderSetsArrayTest()
21 | {
22 | var mySets = AuthInstance.PhotosetsGetList();
23 |
24 | AuthInstance.PhotosetsOrderSets(mySets.Select(myset => myset.PhotosetId).ToArray());
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/FlickrNetTest/PhotosetsTests.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samjudson/flickr-net/32386d299740e895cb939e839fe5d5e8044d5a7c/FlickrNetTest/PhotosetsTests.cs
--------------------------------------------------------------------------------
/FlickrNetTest/PrefsTests.cs:
--------------------------------------------------------------------------------
1 |
2 | using NUnit.Framework;
3 | using FlickrNet;
4 |
5 | namespace FlickrNetTest
6 | {
7 | ///
8 | /// Summary description for PrefsTest
9 | ///
10 | [TestFixture]
11 | [Category("AccessTokenRequired")]
12 | public class PrefsTests : BaseTest
13 | {
14 | [Test]
15 | public void PrefsGetContentTypeTest()
16 | {
17 | var s = AuthInstance.PrefsGetContentType();
18 |
19 | Assert.IsNotNull(s);
20 | Assert.AreNotEqual(ContentType.None, s);
21 | }
22 |
23 | [Test]
24 | public void PrefsGetGeoPermsTest()
25 | {
26 | var p = AuthInstance.PrefsGetGeoPerms();
27 |
28 | Assert.IsNotNull(p);
29 | Assert.IsTrue(p.ImportGeoExif);
30 | Assert.AreEqual(GeoPermissionType.Public, p.GeoPermissions);
31 | }
32 |
33 | [Test]
34 | public void PrefsGetHiddenTest()
35 | {
36 | var s = AuthInstance.PrefsGetHidden();
37 |
38 | Assert.IsNotNull(s);
39 | Assert.AreNotEqual(HiddenFromSearch.None, s);
40 | }
41 |
42 | [Test]
43 | public void PrefsGetPrivacyTest()
44 | {
45 | var p = AuthInstance.PrefsGetPrivacy();
46 |
47 | Assert.IsNotNull(p);
48 | Assert.AreEqual(PrivacyFilter.PublicPhotos, p);
49 | }
50 |
51 | [Test]
52 | public void PrefsGetSafetyLevelTest()
53 | {
54 | var s = AuthInstance.PrefsGetSafetyLevel();
55 |
56 | Assert.IsNotNull(s);
57 | Assert.AreEqual(SafetyLevel.Safe, s);
58 | }
59 |
60 |
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/FlickrNetTest/ProfileTests.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using Shouldly;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 |
8 | namespace FlickrNetTest
9 | {
10 | [TestFixture]
11 | public class ProfileTests : BaseTest
12 | {
13 | [Test]
14 | public void GetDefaultProfile()
15 | {
16 | var profile = Instance.ProfileGetProfile(TestData.TestUserId);
17 |
18 | profile.UserId.ShouldBe(TestData.TestUserId);
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/FlickrNetTest/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("FlickrNetTest")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("Wackylabs")]
11 | [assembly: AssemblyProduct("FlickrNetTest")]
12 | [assembly: AssemblyCopyright("Copyright © Sam Judson 2018")]
13 | [assembly: AssemblyTrademark("Apache 2.0 + LGPL 2.1 License")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM componenets. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("d4694bcd-67d5-41fa-82a0-59b3836b5db8")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Revision and Build Numbers
32 | // by using the '*' as shown below:
33 | [assembly: AssemblyVersion("1.0.0.0")]
34 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/FlickrNetTest/StatsGetTotalViewsTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using NUnit.Framework;
3 | using FlickrNet;
4 |
5 | namespace FlickrNetTest
6 | {
7 | ///
8 | /// Summary description for StatsGetTotalViewsTest
9 | ///
10 | [TestFixture]
11 | [Category("AccessTokenRequired")]
12 | public class StatsGetTotalViewsTest : BaseTest
13 | {
14 | [Test]
15 | public void StatsGetTotalViewsBasicTest()
16 | {
17 | StatViews views = AuthInstance.StatsGetTotalViews();
18 |
19 | Assert.IsNotNull(views, "StatViews should not be null.");
20 | Assert.AreNotEqual(0, views.TotalViews, "TotalViews should be greater than zero.");
21 | Assert.AreNotEqual(0, views.PhotostreamViews, "PhotostreamViews should be greater than zero.");
22 | Assert.AreNotEqual(0, views.PhotoViews, "PhotoViews should be greater than zero.");
23 | }
24 |
25 | [Test]
26 | public void StatGetCsvFilesTest()
27 | {
28 | CsvFileCollection col = AuthInstance.StatsGetCsvFiles();
29 |
30 | Assert.IsNotNull(col, "CsvFileCollection should not be null.");
31 |
32 | Assert.IsTrue(col.Count > 1, "Should be more than one CsvFile returned.");
33 |
34 | foreach (var file in col)
35 | {
36 | Assert.IsNotNull(file.Href, "Href should not be null.");
37 | Assert.IsNotNull(file.Type, "Type should not be null.");
38 | Assert.AreNotEqual(DateTime.MinValue, file.Date);
39 | }
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/FlickrNetTest/TestTests.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | using NUnit.Framework;
4 | using FlickrNet;
5 |
6 | namespace FlickrNetTest
7 | {
8 | ///
9 | /// Summary description for TestTests
10 | ///
11 | [TestFixture]
12 | public class TestTests : BaseTest
13 | {
14 | [Test]
15 | public void TestGenericGroupSearch()
16 | {
17 | Flickr f = Instance;
18 |
19 | var parameters = new Dictionary();
20 | parameters.Add("text", "Flowers");
21 | UnknownResponse response = f.TestGeneric("flickr.groups.search", parameters);
22 |
23 | Assert.IsNotNull(response, "UnknownResponse should not be null.");
24 | Assert.IsNotNull(response.ResponseXml, "ResponseXml should not be null.");
25 |
26 | }
27 |
28 | [Test]
29 | [Category("AccessTokenRequired")]
30 | public void TestGenericTestNull()
31 | {
32 | Flickr f = AuthInstance;
33 |
34 | UnknownResponse response = f.TestGeneric("flickr.test.null", null);
35 |
36 | Assert.IsNotNull(response, "UnknownResponse should not be null.");
37 | Assert.IsNotNull(response.ResponseXml, "ResponseXml should not be null.");
38 | }
39 |
40 | [Test]
41 | public void TestEcho()
42 | {
43 | Flickr f = Instance;
44 | var parameters = new Dictionary();
45 | parameters.Add("test1", "testvalue");
46 |
47 | Dictionary returns = f.TestEcho(parameters);
48 |
49 | Assert.IsNotNull(returns);
50 |
51 | // Was 3, now 11 because of extra oauth parameter used by default.
52 | Assert.AreEqual(11, returns.Count);
53 |
54 | Assert.AreEqual("flickr.test.echo", returns["method"]);
55 | Assert.AreEqual("testvalue", returns["test1"]);
56 |
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/FlickrNetTest/UrlHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net;
3 | using System.Net.Cache;
4 |
5 | namespace FlickrNetTest
6 | {
7 | public static class UrlHelper
8 | {
9 | public static bool Exists(string url)
10 | {
11 | var req = (HttpWebRequest)WebRequest.Create(url);
12 | req.CachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.BypassCache);
13 | req.AllowAutoRedirect = false;
14 | req.Method = "HEAD";
15 |
16 | try
17 | {
18 | using (var res = (HttpWebResponse)req.GetResponse())
19 | {
20 | return res.StatusCode == HttpStatusCode.OK;
21 | }
22 | }
23 | catch(Exception exception)
24 | {
25 | Console.WriteLine(exception.GetType() + " thrown.");
26 | Console.WriteLine("Message:" + exception.Message);
27 | return false;
28 | }
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/FlickrNetTest/UrlsTests.cs:
--------------------------------------------------------------------------------
1 |
2 | using NUnit.Framework;
3 | using FlickrNet;
4 |
5 | namespace FlickrNetTest
6 | {
7 | ///
8 | /// Summary description for UrlsTests
9 | ///
10 | [TestFixture]
11 | public class UrlsTests : BaseTest
12 | {
13 | [Test]
14 | [Category("AccessTokenRequired")]
15 | public void UrlsLookupUserTest1()
16 | {
17 | FoundUser user = AuthInstance.UrlsLookupUser("https://www.flickr.com/photos/samjudson");
18 |
19 | Assert.AreEqual("41888973@N00", user.UserId);
20 | Assert.AreEqual("Sam Judson", user.UserName);
21 | }
22 |
23 | [Test]
24 | [Category("AccessTokenRequired")]
25 | public void UrlsLookupGroup()
26 | {
27 | string groupUrl = "https://www.flickr.com/groups/angels_of_the_north/";
28 |
29 | string groupId = AuthInstance.UrlsLookupGroup(groupUrl);
30 |
31 | Assert.AreEqual("71585219@N00", groupId);
32 | }
33 |
34 | [Test]
35 | public void UrlsLookupGalleryTest()
36 | {
37 | string galleryUrl = "https://www.flickr.com/photos/samjudson/galleries/72157622589312064";
38 |
39 | Flickr f = Instance;
40 |
41 | Gallery gallery = f.UrlsLookupGallery(galleryUrl);
42 |
43 | Assert.AreEqual(galleryUrl, gallery.GalleryUrl);
44 |
45 | }
46 |
47 | [Test]
48 | public void UrlsGetUserPhotosTest()
49 | {
50 | string url = Instance.UrlsGetUserPhotos(TestData.TestUserId);
51 |
52 | Assert.AreEqual("https://www.flickr.com/photos/samjudson/", url);
53 | }
54 |
55 | [Test]
56 | public void UrlsGetUserProfileTest()
57 | {
58 | string url = Instance.UrlsGetUserProfile(TestData.TestUserId);
59 |
60 | Assert.AreEqual("https://www.flickr.com/people/samjudson/", url);
61 | }
62 |
63 | [Test]
64 | public void UrlsGetGroupTest()
65 | {
66 | string url = Instance.UrlsGetGroup(TestData.GroupId);
67 |
68 | Assert.AreEqual("https://www.flickr.com/groups/lakedistrict/", url);
69 | }
70 |
71 |
72 |
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/FlickrNetTest/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/FlickrNetVS10.vssscc:
--------------------------------------------------------------------------------
1 | ""
2 | {
3 | "FILE_VERSION" = "9237"
4 | "ENLISTMENT_CHOICE" = "NEVER"
5 | "PROJECT_FILE_RELATIVE_PATH" = ""
6 | "NUMBER_OF_EXCLUDED_FILES" = "0"
7 | "ORIGINAL_PROJECT_FILE_PATH" = ""
8 | "NUMBER_OF_NESTED_PROJECTS" = "0"
9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
10 | }
11 |
--------------------------------------------------------------------------------
/FlickrNetWP7.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlickrNetWP7", "FlickrNet\FlickrNetWP7.csproj", "{56086D96-2F0C-4788-B9E0-9E8EEB671BC9}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Any CPU = Debug|Any CPU
9 | Release|Any CPU = Release|Any CPU
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {56086D96-2F0C-4788-B9E0-9E8EEB671BC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13 | {56086D96-2F0C-4788-B9E0-9E8EEB671BC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
14 | {56086D96-2F0C-4788-B9E0-9E8EEB671BC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
15 | {56086D96-2F0C-4788-B9E0-9E8EEB671BC9}.Release|Any CPU.Build.0 = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2016 Sam Judson
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
--------------------------------------------------------------------------------
/NuGet/FlickrNet.CF.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | FlickrNet.CF
5 | 3.4.0
6 | FlickrNet API Library for Compact Framework
7 | Sam Judson
8 | Sam Judson
9 | http://flickrnet.codeplex.com/license
10 | http://flickrnet.codeplex.com/
11 | false
12 | The Flickr.Net API Library is a .Net Library for accessing the Flickr API via the .NET Compact Framework.
13 | en-US
14 | flickr photo photography social
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/NuGet/FlickrNet.Silverlight.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 3.4.0
5 | Sam Judson
6 | Sam Judson
7 | https://github.com/samjudson/flickr-net
8 | https://github.com/samjudson/flickr-net/blob/master/LICENSE
9 | FlickrNet.Silverlight
10 | FlickrNet API Library for Silverlight
11 | false
12 | The Flickr.Net API Library is a .Net Library for accessing the Flickr API via Silverlight.
13 | en-US
14 | flickr photo photography social
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/NuGet/FlickrNet.WP7.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 3.4.0
5 | Sam Judson
6 | Sam Judson
7 | https://github.com/samjudson/flickr-net
8 | https://github.com/samjudson/flickr-net/blob/master/LICENSE
9 | FlickrNet.WP7
10 | FlickrNet API Library for Windows Phone 7
11 | false
12 | The Flickr.Net API Library is a .Net Library for accessing the Flickr API via Windows Phone 7.
13 | en-US
14 | flickr photo photography social
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/NuGet/FlickrNet.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 3.4.0
5 | Sam Judson
6 | Sam Judson
7 | https://github.com/samjudson/flickr-net
8 | LGPL-2.1-only OR Apache-2.0
9 | FlickrNet
10 | FlickrNet API Library
11 | false
12 | The Flickr.Net API Library is a .Net Library for accessing the Flickr API.
13 | en-US
14 | flickr photo photography social
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Support/Flickr Net Sandcastle File.shfb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | Summary, Parameter, Returns, AutoDocumentCtors, Namespace, TypeParameter
11 | InheritedMembers, InheritedFrameworkMembers, Protected, SealedProtected
12 |
13 |
14 | .\Help\
15 |
16 |
17 | True
18 | True
19 |
20 | HtmlHelp1x
21 | False
22 | 1.1.4322
23 | False
24 | False
25 | False
26 |
27 | Flckr.Net API Library
28 | FlickrNet
29 | en-US
30 | http://www.codeplex.com/FlickrNet
31 | Flickr.Net API Library, GPL 2.0
32 | sam@wackylabs.net
33 | Contact Sam Judson
34 |
35 |
36 | Local
37 | Msdn
38 | Blank
39 | vs2005
40 | Guid
41 | Standard
42 | False
43 | True
44 | False
45 | Hierarchical
46 | True
47 | ms.vsipcc+, ms.vsexpresscc+
48 | 1.0.0.0
49 | AboveNamespaces
50 |
--------------------------------------------------------------------------------
/Support/scriptcs_packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/help.proj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/localtestrun-codecoverage.testrunconfig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | This is a default test run configuration for a local test run.
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/localtestrun.testrunconfig:
--------------------------------------------------------------------------------
1 |
2 |
3 | This is a default test run configuration for a local test run.
4 |
5 |
--------------------------------------------------------------------------------
/packages/repositories.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------