Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions FlickrNet/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,11 @@
//------------------------------------------------------------------------------

using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("Flickr .Net Api Library")]
[assembly: AssemblyDescription(".Net library for accessing Flickr.com Api functionality")]
[assembly: AssemblyCompany("http://flickrnet.codeplex.com")]
[assembly: AssemblyProduct("Flickr .Net Api Library")]
[assembly: AssemblyCopyright("Copyright © Sam Judson 2010")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
[assembly: AssemblyVersion("3.14.0.0")]
[assembly: InternalsVisibleTo("FlickrNetTest")]


17 changes: 0 additions & 17 deletions FlickrNet/AssemblyInfoMore.cs

This file was deleted.

43 changes: 23 additions & 20 deletions FlickrNet/Cache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ public static bool CacheDisabled
{
get
{
#if !(WindowsCE || MONOTOUCH || SILVERLIGHT)
if (cacheDisabled == Tristate.Null && FlickrConfigurationManager.Settings != null)
cacheDisabled = FlickrConfigurationManager.Settings.CacheDisabled ? Tristate.True : Tristate.False;
#endif
// TODO FIX THIS
//#if !(WindowsCE || MONOTOUCH || SILVERLIGHT)
// if (cacheDisabled == Tristate.Null && FlickrConfigurationManager.Settings != null)
// cacheDisabled = FlickrConfigurationManager.Settings.CacheDisabled ? Tristate.True : Tristate.False;
//#endif
if (cacheDisabled == Tristate.Null) cacheDisabled = Tristate.False;

return cacheDisabled == Tristate.True;
Expand All @@ -68,26 +69,28 @@ public static string CacheLocation
{
get
{
#if !(WindowsCE || MONOTOUCH || SILVERLIGHT)
if (cacheLocation == null && FlickrConfigurationManager.Settings != null)
cacheLocation = FlickrConfigurationManager.Settings.CacheLocation;
#endif
// TODO FIX THIS
//#if !(WindowsCE || MONOTOUCH || SILVERLIGHT)
// if (cacheLocation == null && FlickrConfigurationManager.Settings != null)
// cacheLocation = FlickrConfigurationManager.Settings.CacheLocation;
//#endif
if (cacheLocation == null)
{
try
{
#if !(WindowsCE || MONOTOUCH || SILVERLIGHT)
cacheLocation = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "FlickrNet");
#endif
#if MONOTOUCH
cacheLocation = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "../Library/Caches");
#endif
#if WindowsCE
cacheLocation = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "FlickrNetCache");
#endif
#if SILVERLIGHT
cacheLocation = string.Empty;
#endif
// TODO FIX THIS
//#if !(WindowsCE || MONOTOUCH || SILVERLIGHT)
// cacheLocation = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "FlickrNet");
//#endif
//#if MONOTOUCH
// cacheLocation = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "../Library/Caches");
//#endif
//#if WindowsCE
// cacheLocation = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "FlickrNetCache");
//#endif
//#if SILVERLIGHT
// cacheLocation = string.Empty;
//#endif

}
catch (System.Security.SecurityException)
Expand Down
20 changes: 20 additions & 0 deletions FlickrNet/Exceptions/ConfigurationErrorsException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Xml;

namespace FlickrNet.Exceptions
{
public class ConfigurationErrorsException : FlickrApiException
{
public ConfigurationErrorsException(string message) : base(message)
{
}

public ConfigurationErrorsException(string message, XmlNode configNode) : base(message)
{
}

public ConfigurationErrorsException(string message, Exception ex, XmlNode configNode) : base(message, ex)
{
}
}
}
90 changes: 46 additions & 44 deletions FlickrNet/Flickr.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ public partial class Flickr
/// uploaded is recorded in the <see cref="UploadProgressEventArgs"/> class.
/// </summary>
public event EventHandler<UploadProgressEventArgs> OnUploadProgress;

#if !(MONOTOUCH || WindowsCE || SILVERLIGHT)
private static bool isServiceSet;
#endif
// TODO FIX THIS
//#if !(MONOTOUCH || WindowsCE || SILVERLIGHT)
// private static bool isServiceSet;
//#endif
private static SupportedService defaultService = SupportedService.Flickr;

private SupportedService service = SupportedService.Flickr;
Expand Down Expand Up @@ -102,10 +102,10 @@ private string AuthUrl

private string lastRequest;
private string lastResponse;

#if !SILVERLIGHT
private WebProxy proxy;
#endif
// TODO FIX THIS
//#if !SILVERLIGHT
// private WebProxy proxy;
//#endif

/// <summary>
/// Get or set the API Key to be used by all calls. API key is mandatory for all
Expand Down Expand Up @@ -216,21 +216,23 @@ public static SupportedService DefaultService
{
get
{
#if !(MONOTOUCH || WindowsCE || SILVERLIGHT)
if (!isServiceSet && FlickrConfigurationManager.Settings != null)
{
defaultService = FlickrConfigurationManager.Settings.Service;
isServiceSet = true;
}
#endif
// TODO FIX THIS
//#if !(MONOTOUCH || WindowsCE || SILVERLIGHT)
// if (!isServiceSet && FlickrConfigurationManager.Settings != null)
// {
// defaultService = FlickrConfigurationManager.Settings.Service;
// isServiceSet = true;
// }
//#endif
return defaultService;
}
set
{
defaultService = value;
#if !(MONOTOUCH || WindowsCE || SILVERLIGHT)
isServiceSet = true;
#endif
// TODO FIX THIS
//#if !(MONOTOUCH || WindowsCE || SILVERLIGHT)
// isServiceSet = true;
//#endif
}
}

Expand Down Expand Up @@ -290,14 +292,14 @@ public string LastRequest
get { return lastRequest; }
}

#if !SILVERLIGHT
/// <summary>
/// You can set the <see cref="WebProxy"/> or alter its properties.
/// It defaults to your internet explorer proxy settings.
/// </summary>
//#if !SILVERLIGHT
// /// <summary>
// /// You can set the <see cref="WebProxy"/> or alter its properties.
// /// It defaults to your internet explorer proxy settings.
// /// </summary>

public WebProxy Proxy { get { return proxy; } set { proxy = value; } }
#endif
// public WebProxy Proxy { get { return proxy; } set { proxy = value; } }
//#endif

/// <summary>
/// Clears the cache completely.
Expand Down Expand Up @@ -341,32 +343,32 @@ public Flickr()
InstanceCacheDisabled = CacheDisabled;
CurrentService = DefaultService;

#if !(MONOTOUCH || WindowsCE || SILVERLIGHT)
//#if !(MONOTOUCH || WindowsCE || SILVERLIGHT)

var settings = FlickrConfigurationManager.Settings;
if (settings == null) return;
// var settings = FlickrConfigurationManager.Settings;
// if (settings == null) return;

if (settings.CacheSize != 0) CacheSizeLimit = settings.CacheSize;
if (settings.CacheTimeout != TimeSpan.MinValue) CacheTimeout = settings.CacheTimeout;
ApiKey = settings.ApiKey;
AuthToken = settings.ApiToken;
ApiSecret = settings.SharedSecret;
// if (settings.CacheSize != 0) CacheSizeLimit = settings.CacheSize;
// if (settings.CacheTimeout != TimeSpan.MinValue) CacheTimeout = settings.CacheTimeout;
// ApiKey = settings.ApiKey;
// AuthToken = settings.ApiToken;
// ApiSecret = settings.SharedSecret;

if (!settings.IsProxyDefined) return;
// if (!settings.IsProxyDefined) return;

Proxy = new WebProxy {Address = new Uri("http://" + settings.ProxyIPAddress + ":" + settings.ProxyPort)};
// Proxy = new WebProxy {Address = new Uri("http://" + settings.ProxyIPAddress + ":" + settings.ProxyPort)};

if (string.IsNullOrEmpty(settings.ProxyUsername)) return;
// if (string.IsNullOrEmpty(settings.ProxyUsername)) return;

var creds = new NetworkCredential
{
UserName = settings.ProxyUsername,
Password = settings.ProxyPassword,
Domain = settings.ProxyDomain
};
Proxy.Credentials = creds;
// var creds = new NetworkCredential
// {
// UserName = settings.ProxyUsername,
// Password = settings.ProxyPassword,
// Domain = settings.ProxyDomain
// };
// Proxy.Credentials = creds;

#endif
//#endif
}

/// <summary>
Expand Down
59 changes: 30 additions & 29 deletions FlickrNet/FlickrConfigurationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,36 @@
using System.Configuration;
using System.Xml;

#if !(MONOTOUCH || WindowsCE || SILVERLIGHT)
namespace FlickrNet
{
/// <summary>
/// Summary description for FlickrConfigurationManager.
/// </summary>
internal class FlickrConfigurationManager : IConfigurationSectionHandler
{
private static string configSection = "flickrNet";
private static FlickrConfigurationSettings settings;
// TODO FIX THIS
//#if !(MONOTOUCH || WindowsCE || SILVERLIGHT)
//namespace FlickrNet
//{
// /// <summary>
// /// Summary description for FlickrConfigurationManager.
// /// </summary>
// internal class FlickrConfigurationManager : IConfigurationSectionHandler
// {
// private static string configSection = "flickrNet";
// private static FlickrConfigurationSettings settings;

public static FlickrConfigurationSettings Settings
{
get
{
if (settings == null)
{
settings = (FlickrConfigurationSettings)ConfigurationManager.GetSection(configSection);
}
// public static FlickrConfigurationSettings Settings
// {
// get
// {
// if (settings == null)
// {
// settings = (FlickrConfigurationSettings)ConfigurationManager.GetSection(configSection);
// }

return settings;
}
}
// return settings;
// }
// }

public object Create(object parent, object configContext, XmlNode section)
{
configSection = section.Name;
return new FlickrConfigurationSettings(section);
}
}
}
#endif
// public object Create(object parent, object configContext, XmlNode section)
// {
// configSection = section.Name;
// return new FlickrConfigurationSettings(section);
// }
// }
//}
//#endif
Loading