From 5cd33316aeaffbb7704c39b7fbc8b30dc4fa54f7 Mon Sep 17 00:00:00 2001 From: Lukas Date: Fri, 20 Apr 2018 22:28:54 +1200 Subject: [PATCH 1/4] first version of .net-standard 2.0 version --- FlickrNet/AssemblyInfo.cs | 8 +- FlickrNet/AssemblyInfoMore.cs | 17 - FlickrNet/Cache.cs | 43 +- .../ConfigurationErrorsException.cs | 20 + FlickrNet/Flickr.cs | 90 ++-- FlickrNet/FlickrConfigurationManager.cs | 59 +- FlickrNet/FlickrConfigurationSettings.cs | 29 +- FlickrNet/FlickrNet.csproj | 509 +----------------- FlickrNet/Flickr_Upload.cs | 3 +- FlickrNet/SerializableAttribute.cs | 9 - FlickrNet/ShapeDataSL.cs | 435 +++++++-------- FlickrNet/UnknownResponseSL.cs | 159 +++--- FlickrNetTest/FlickrNetTest.csproj | 15 +- FlickrNetTest/packages.config | 4 +- FlickrNetVS10.sln | 31 +- 15 files changed, 481 insertions(+), 950 deletions(-) delete mode 100644 FlickrNet/AssemblyInfoMore.cs create mode 100644 FlickrNet/Exceptions/ConfigurationErrorsException.cs diff --git a/FlickrNet/AssemblyInfo.cs b/FlickrNet/AssemblyInfo.cs index 7b25a5ac..303c05a4 100644 --- a/FlickrNet/AssemblyInfo.cs +++ b/FlickrNet/AssemblyInfo.cs @@ -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")] diff --git a/FlickrNet/AssemblyInfoMore.cs b/FlickrNet/AssemblyInfoMore.cs deleted file mode 100644 index 08951a07..00000000 --- a/FlickrNet/AssemblyInfoMore.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Reflection; -using System.Security; -using System.Security.Permissions; - -[assembly: AssemblyDelaySign(false)] -[assembly: AssemblyKeyName("")] - -#if !(MONOTOUCH || WindowsCE || SILVERLIGHT) -[assembly: AllowPartiallyTrustedCallers] -[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("FlickrNetTest, PublicKey="+ -"002400000480000094000000060200000024000052534131000400000100010039a991f658101cf8"+ -"2d418ece9ab591a8acd377989a62476f1d58198bed5af088625ca7b04abb869226a06c6dbaecc583"+ -"66fd588b5319a42cc2734ed940cd23de0a0756465b3bab83ab7f43faa8719195981470cf0d538281"+ -"5b5b2d372b4bfeedf08ba41678cd86a2ea62592a849c47e5fd58916cece1c3397694a6650668bfe1")] -#endif - diff --git a/FlickrNet/Cache.cs b/FlickrNet/Cache.cs index 9b757ce5..4077b793 100644 --- a/FlickrNet/Cache.cs +++ b/FlickrNet/Cache.cs @@ -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; @@ -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) diff --git a/FlickrNet/Exceptions/ConfigurationErrorsException.cs b/FlickrNet/Exceptions/ConfigurationErrorsException.cs new file mode 100644 index 00000000..175153f1 --- /dev/null +++ b/FlickrNet/Exceptions/ConfigurationErrorsException.cs @@ -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) + { + } + } +} diff --git a/FlickrNet/Flickr.cs b/FlickrNet/Flickr.cs index f7933606..f0ae8d6c 100644 --- a/FlickrNet/Flickr.cs +++ b/FlickrNet/Flickr.cs @@ -42,10 +42,10 @@ public partial class Flickr /// uploaded is recorded in the class. /// public event EventHandler 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; @@ -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 /// /// Get or set the API Key to be used by all calls. API key is mandatory for all @@ -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 } } @@ -290,14 +292,14 @@ public string LastRequest get { return lastRequest; } } -#if !SILVERLIGHT - /// - /// You can set the or alter its properties. - /// It defaults to your internet explorer proxy settings. - /// +//#if !SILVERLIGHT +// /// +// /// You can set the or alter its properties. +// /// It defaults to your internet explorer proxy settings. +// /// - public WebProxy Proxy { get { return proxy; } set { proxy = value; } } -#endif +// public WebProxy Proxy { get { return proxy; } set { proxy = value; } } +//#endif /// /// Clears the cache completely. @@ -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 } /// diff --git a/FlickrNet/FlickrConfigurationManager.cs b/FlickrNet/FlickrConfigurationManager.cs index 08970057..03ec044d 100644 --- a/FlickrNet/FlickrConfigurationManager.cs +++ b/FlickrNet/FlickrConfigurationManager.cs @@ -2,35 +2,36 @@ using System.Configuration; using System.Xml; -#if !(MONOTOUCH || WindowsCE || SILVERLIGHT) -namespace FlickrNet -{ - /// - /// Summary description for FlickrConfigurationManager. - /// - internal class FlickrConfigurationManager : IConfigurationSectionHandler - { - private static string configSection = "flickrNet"; - private static FlickrConfigurationSettings settings; +// TODO FIX THIS +//#if !(MONOTOUCH || WindowsCE || SILVERLIGHT) +//namespace FlickrNet +//{ +// /// +// /// Summary description for FlickrConfigurationManager. +// /// +// 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 diff --git a/FlickrNet/FlickrConfigurationSettings.cs b/FlickrNet/FlickrConfigurationSettings.cs index c7e206dd..2fe02551 100644 --- a/FlickrNet/FlickrConfigurationSettings.cs +++ b/FlickrNet/FlickrConfigurationSettings.cs @@ -1,4 +1,5 @@ #if !(MONOTOUCH || WindowsCE || SILVERLIGHT) +using FlickrNet.Exceptions; using System; using System.Collections.Specialized; using System.Xml; @@ -82,7 +83,7 @@ public FlickrConfigurationSettings(XmlNode configNode) } catch (FormatException ex) { - throw new System.Configuration.ConfigurationErrorsException("cacheDisbled should be \"true\" or \"false\"", ex, configNode); + throw new ConfigurationErrorsException("cacheDisbled should be \"true\" or \"false\"", ex, configNode); } case "cacheSize": try @@ -92,7 +93,7 @@ public FlickrConfigurationSettings(XmlNode configNode) } catch (FormatException ex) { - throw new System.Configuration.ConfigurationErrorsException("cacheSize should be integer value", ex, configNode); + throw new ConfigurationErrorsException("cacheSize should be integer value", ex, configNode); } case "cacheTimeout": try @@ -102,7 +103,7 @@ public FlickrConfigurationSettings(XmlNode configNode) } catch (FormatException ex) { - throw new System.Configuration.ConfigurationErrorsException("cacheTimeout should be TimeSpan value ([d:]HH:mm:ss)", ex, configNode); + throw new ConfigurationErrorsException("cacheTimeout should be TimeSpan value ([d:]HH:mm:ss)", ex, configNode); } case "cacheLocation": cacheLocation = attribute.Value; @@ -116,12 +117,12 @@ public FlickrConfigurationSettings(XmlNode configNode) } catch (ArgumentException ex) { - throw new System.Configuration.ConfigurationErrorsException( + throw new ConfigurationErrorsException( "service must be one of the supported services (See SupportedServices enum)", ex, configNode); } default: - throw new System.Configuration.ConfigurationErrorsException( + throw new ConfigurationErrorsException( string.Format( System.Globalization.CultureInfo.InvariantCulture, "Unknown attribute '{0}' in flickrNet node", attribute.Name), configNode); @@ -136,7 +137,7 @@ public FlickrConfigurationSettings(XmlNode configNode) ProcessProxyNode(node, configNode); break; default: - throw new System.Configuration.ConfigurationErrorsException( + throw new ConfigurationErrorsException( string.Format(System.Globalization.CultureInfo.InvariantCulture, "Unknown node '{0}' in flickrNet node", node.Name), configNode); } @@ -147,7 +148,7 @@ public FlickrConfigurationSettings(XmlNode configNode) private void ProcessProxyNode(XmlNode proxy, XmlNode configNode) { if (proxy.ChildNodes.Count > 0) - throw new System.Configuration.ConfigurationErrorsException("proxy element does not support child elements"); + throw new ConfigurationErrorsException("proxy element does not support child elements"); proxyDefined = true; foreach (XmlAttribute attribute in proxy.Attributes) @@ -165,7 +166,7 @@ private void ProcessProxyNode(XmlNode proxy, XmlNode configNode) } catch (FormatException ex) { - throw new System.Configuration.ConfigurationErrorsException("proxy port should be integer value", ex, configNode); + throw new ConfigurationErrorsException("proxy port should be integer value", ex, configNode); } break; case "username": @@ -178,22 +179,22 @@ private void ProcessProxyNode(XmlNode proxy, XmlNode configNode) proxyDomain = attribute.Value; break; default: - throw new System.Configuration.ConfigurationErrorsException( + throw new ConfigurationErrorsException( string.Format(System.Globalization.CultureInfo.InvariantCulture, "Unknown attribute '{0}' in flickrNet/proxy node", attribute.Name), configNode); } } if (proxyAddress == null) - throw new System.Configuration.ConfigurationErrorsException("proxy ipaddress is mandatory if you specify the proxy element"); + throw new ConfigurationErrorsException("proxy ipaddress is mandatory if you specify the proxy element"); if (proxyPort == 0) - throw new System.Configuration.ConfigurationErrorsException("proxy port is mandatory if you specify the proxy element"); + throw new ConfigurationErrorsException("proxy port is mandatory if you specify the proxy element"); if (proxyUsername != null && proxyPassword == null) - throw new System.Configuration.ConfigurationErrorsException("proxy password must be specified if proxy username is specified"); + throw new ConfigurationErrorsException("proxy password must be specified if proxy username is specified"); if (proxyUsername == null && proxyPassword != null) - throw new System.Configuration.ConfigurationErrorsException("proxy username must be specified if proxy password is specified"); + throw new ConfigurationErrorsException("proxy username must be specified if proxy password is specified"); if (proxyDomain != null && proxyUsername == null) - throw new System.Configuration.ConfigurationErrorsException("proxy username/password must be specified if proxy domain is specified"); + throw new ConfigurationErrorsException("proxy username/password must be specified if proxy domain is specified"); } /// diff --git a/FlickrNet/FlickrNet.csproj b/FlickrNet/FlickrNet.csproj index 750f2d4b..b4ff9d7f 100644 --- a/FlickrNet/FlickrNet.csproj +++ b/FlickrNet/FlickrNet.csproj @@ -1,499 +1,20 @@ - - + + - Local - {5F017126-C1FF-4996-85CC-6150E80C6AFC} - Debug - AnyCPU - - - FlickrNet - FlickrNet.snk - JScript - Grid - IE50 - false - Library - FlickrNet - OnBuildSuccess - - - - - 3.5 - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - true - SAK - SAK - SAK - SAK - False + netstandard2.0 + FlickrNet.Core + .Net Core library for accessing Flickr.com Api functionality + Copyright © Sam Judson 2010 - - bin\Debug\ - 285212672 - - - DEBUG;TRACE - bin\Debug\FlickrNet.xml - true - 4096 - false - false - false - 4 - full - prompt - - - x86 - - - true - - - bin\Release\ - 285212672 - - - TRACE - 4096 - true - false - false - 4 - none - prompt - - - - - - System - - - System.Data - - - System.Drawing - - - System.XML - - + + + + 4.4.1 + + - - Code - - - Code - - - - Code - - - Code - - - - Code - - - Code - - - - Code - - - - - Code - - - - - Code - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Code - - - Code - - - Code - - - Code - - - Code - - - - - - - - - - - - - - - - - - - - - - Code - - - Code - - - Code - - - Code - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Code - - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - - - - - - - - - - - Code - - - Code - - - Code - - - Code - - - - Code - - - Code - - - - Code - - - Code - - - Code - - - Code - - - - Code - - - - Code - - - Code - - - - Code - - - Code - - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - - Code - - - Code - - - Code - - - Code - - - - - - - - - - - - - Code - - - - - - - - - - Code - - - Code - - - - Code - - - - - - - - - - - - + - - - False - .NET Framework Client Profile - false - - - False - .NET Framework 2.0 %28x86%29 - true - - - False - .NET Framework 3.0 %28x86%29 - false - - - False - .NET Framework 3.5 - false - - - False - .NET Framework 3.5 SP1 - false - - - - - - - - - - \ No newline at end of file + + diff --git a/FlickrNet/Flickr_Upload.cs b/FlickrNet/Flickr_Upload.cs index 4f1f209a..162f4323 100644 --- a/FlickrNet/Flickr_Upload.cs +++ b/FlickrNet/Flickr_Upload.cs @@ -177,7 +177,8 @@ private string UploadData(Stream imageStream, string fileName, Uri uploadUri, Di var req = (HttpWebRequest)WebRequest.Create(uploadUri); req.Method = "POST"; - if (Proxy != null) req.Proxy = Proxy; + // TODO FIX THIS + //if (Proxy != null) req.Proxy = Proxy; req.Timeout = HttpTimeout; req.ContentType = "multipart/form-data; boundary=" + boundary; diff --git a/FlickrNet/SerializableAttribute.cs b/FlickrNet/SerializableAttribute.cs index 80b31774..f5d9803d 100644 --- a/FlickrNet/SerializableAttribute.cs +++ b/FlickrNet/SerializableAttribute.cs @@ -1,13 +1,4 @@ using System; -using System.Net; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Documents; -using System.Windows.Ink; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Animation; -using System.Windows.Shapes; namespace FlickrNet { diff --git a/FlickrNet/ShapeDataSL.cs b/FlickrNet/ShapeDataSL.cs index 1d21438a..0ef0c0cd 100644 --- a/FlickrNet/ShapeDataSL.cs +++ b/FlickrNet/ShapeDataSL.cs @@ -1,219 +1,220 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Collections.ObjectModel; - -namespace FlickrNet -{ - /// - /// The shape data supplied by . - /// - /// - /// See http://code.flickr.com/blog/2008/10/30/the-shape-of-alpha/ for more details. - /// - public sealed class ShapeData : IFlickrParsable - { - /// - /// Default constructor. - /// - public ShapeData() - { - PolyLines = new Collection>(); - Urls = new Collection(); - } - - /// - /// The date the shapedata was created. - /// - public DateTime DateCreated { get; private set; } - - /// - /// The alpha for the shape data. - /// - public double Alpha { get; private set; } - - /// - /// The number of points in the shapefile. - /// - public int PointCount { get; private set; } - - /// - /// The number of edge in the shapefile. - /// - public int EdgeCount { get; private set; } - - /// - /// Does the shape have a donut hole. - /// - public bool HasDonutHole { get; private set; } - - /// - /// Is the shape a donut hole. - /// - public bool IsDonutHole { get; private set; } - - /// - /// A list of polylines making up the shape. Each polyline is itself a list of points. - /// - public Collection> PolyLines { get; private set; } - - /// - /// A list of urls for the shapefiles. - /// - public Collection Urls { get; private set; } - - void IFlickrParsable.Load(System.Xml.XmlReader reader) - { - while (reader.MoveToNextAttribute()) - { - switch (reader.LocalName) - { - case "created": - DateCreated = UtilityMethods.UnixTimestampToDate(reader.Value); - break; - case "alpha": - Alpha = reader.ReadContentAsDouble(); - break; - case "count_points": - PointCount = reader.ReadContentAsInt(); - break; - case "count_edges": - EdgeCount = reader.ReadContentAsInt(); - break; - case "has_donuthole": - HasDonutHole = reader.Value == "1"; - break; - case "is_donuthole": - IsDonutHole = reader.Value == "1"; - break; - default: - throw new ParsingException("Unknown attribute value: " + reader.LocalName + "=" + reader.Value); - } - } - - reader.Read(); - - while (reader.NodeType != System.Xml.XmlNodeType.EndElement) - { - switch (reader.LocalName) - { - case "polylines": - reader.Read(); - while (reader.LocalName == "polyline") - { - var polyline = new Collection(); - string polystring = reader.ReadElementContentAsString(); - string[] points = polystring.Split(' '); - foreach (string point in points) - { - string[] xy = point.Split(','); - if (xy.Length != 2) throw new ParsingException("Invalid polypoint found in polyline : '" + polystring + "'"); - polyline.Add( - new PointD( - double.Parse(xy[0], System.Globalization.NumberFormatInfo.InvariantInfo), - double.Parse(xy[1], System.Globalization.NumberFormatInfo.InvariantInfo))); - } - PolyLines.Add(polyline); - } - reader.Read(); - break; - case "urls": - reader.Skip(); - break; - - } - } - - reader.Read(); - } - } - - /// - /// A point structure for holding double-floating points precision data. - /// - public struct PointD - { - private double _x; - private double _y; - - /// - /// The X position of the point. - /// - public double X { get { return _x; } } - - /// - /// The Y position of the point. - /// - public double Y { get { return _y; } } - - /// - /// Default constructor. - /// - /// - /// - public PointD(double x, double y) - { - _x = x; - _y = y; - } - - /// - /// For predefined value types, the equality operator (==) returns true if the values of its operands are equal, false otherwise. - /// - /// - /// - /// - public static bool operator ==(PointD point1, PointD point2) - { - return Math.Abs(point1.X - point2.X) < 0.001 && Math.Abs(point1.Y - point2.Y) < 0.001; - } - - /// - /// For predefined value types, the equality operator (!=) returns false if the values of its operands are equal, true otherwise. - /// - /// - /// - /// - public static bool operator !=(PointD point1, PointD point2) - { - return Math.Abs(point1.X - point2.X) > 0.001 || Math.Abs(point1.Y - point2.Y) > 0.001; - } - - /// - /// - /// - /// - /// - public override bool Equals(object obj) - { - if (obj == null) return false; - if (obj is PointD) - { - var p = (PointD)obj; - return this == p; - - } - return false; - } - - /// - /// - /// - /// - public override int GetHashCode() - { - return X.GetHashCode() + Y.GetHashCode(); - } - - /// - /// - /// - /// - public override string ToString() - { - return base.ToString(); - } - } -} +//using System; +//using System.Collections.Generic; +//using System.Text; +//using System.Collections.ObjectModel; + +// TODO FIX THIS +//namespace FlickrNet +//{ +// /// +// /// The shape data supplied by . +// /// +// /// +// /// See http://code.flickr.com/blog/2008/10/30/the-shape-of-alpha/ for more details. +// /// +// public sealed class ShapeData : IFlickrParsable +// { +// /// +// /// Default constructor. +// /// +// public ShapeData() +// { +// PolyLines = new Collection>(); +// Urls = new Collection(); +// } + +// /// +// /// The date the shapedata was created. +// /// +// public DateTime DateCreated { get; private set; } + +// /// +// /// The alpha for the shape data. +// /// +// public double Alpha { get; private set; } + +// /// +// /// The number of points in the shapefile. +// /// +// public int PointCount { get; private set; } + +// /// +// /// The number of edge in the shapefile. +// /// +// public int EdgeCount { get; private set; } + +// /// +// /// Does the shape have a donut hole. +// /// +// public bool HasDonutHole { get; private set; } + +// /// +// /// Is the shape a donut hole. +// /// +// public bool IsDonutHole { get; private set; } + +// /// +// /// A list of polylines making up the shape. Each polyline is itself a list of points. +// /// +// public Collection> PolyLines { get; private set; } + +// /// +// /// A list of urls for the shapefiles. +// /// +// public Collection Urls { get; private set; } + +// void IFlickrParsable.Load(System.Xml.XmlReader reader) +// { +// while (reader.MoveToNextAttribute()) +// { +// switch (reader.LocalName) +// { +// case "created": +// DateCreated = UtilityMethods.UnixTimestampToDate(reader.Value); +// break; +// case "alpha": +// Alpha = reader.ReadContentAsDouble(); +// break; +// case "count_points": +// PointCount = reader.ReadContentAsInt(); +// break; +// case "count_edges": +// EdgeCount = reader.ReadContentAsInt(); +// break; +// case "has_donuthole": +// HasDonutHole = reader.Value == "1"; +// break; +// case "is_donuthole": +// IsDonutHole = reader.Value == "1"; +// break; +// default: +// throw new ParsingException("Unknown attribute value: " + reader.LocalName + "=" + reader.Value); +// } +// } + +// reader.Read(); + +// while (reader.NodeType != System.Xml.XmlNodeType.EndElement) +// { +// switch (reader.LocalName) +// { +// case "polylines": +// reader.Read(); +// while (reader.LocalName == "polyline") +// { +// var polyline = new Collection(); +// string polystring = reader.ReadElementContentAsString(); +// string[] points = polystring.Split(' '); +// foreach (string point in points) +// { +// string[] xy = point.Split(','); +// if (xy.Length != 2) throw new ParsingException("Invalid polypoint found in polyline : '" + polystring + "'"); +// polyline.Add( +// new PointD( +// double.Parse(xy[0], System.Globalization.NumberFormatInfo.InvariantInfo), +// double.Parse(xy[1], System.Globalization.NumberFormatInfo.InvariantInfo))); +// } +// PolyLines.Add(polyline); +// } +// reader.Read(); +// break; +// case "urls": +// reader.Skip(); +// break; + +// } +// } + +// reader.Read(); +// } +// } + +// /// +// /// A point structure for holding double-floating points precision data. +// /// +// public struct PointD +// { +// private double _x; +// private double _y; + +// /// +// /// The X position of the point. +// /// +// public double X { get { return _x; } } + +// /// +// /// The Y position of the point. +// /// +// public double Y { get { return _y; } } + +// /// +// /// Default constructor. +// /// +// /// +// /// +// public PointD(double x, double y) +// { +// _x = x; +// _y = y; +// } + +// /// +// /// For predefined value types, the equality operator (==) returns true if the values of its operands are equal, false otherwise. +// /// +// /// +// /// +// /// +// public static bool operator ==(PointD point1, PointD point2) +// { +// return Math.Abs(point1.X - point2.X) < 0.001 && Math.Abs(point1.Y - point2.Y) < 0.001; +// } + +// /// +// /// For predefined value types, the equality operator (!=) returns false if the values of its operands are equal, true otherwise. +// /// +// /// +// /// +// /// +// public static bool operator !=(PointD point1, PointD point2) +// { +// return Math.Abs(point1.X - point2.X) > 0.001 || Math.Abs(point1.Y - point2.Y) > 0.001; +// } + +// /// +// /// +// /// +// /// +// /// +// public override bool Equals(object obj) +// { +// if (obj == null) return false; +// if (obj is PointD) +// { +// var p = (PointD)obj; +// return this == p; + +// } +// return false; +// } + +// /// +// /// +// /// +// /// +// public override int GetHashCode() +// { +// return X.GetHashCode() + Y.GetHashCode(); +// } + +// /// +// /// +// /// +// /// +// public override string ToString() +// { +// return base.ToString(); +// } +// } +//} diff --git a/FlickrNet/UnknownResponseSL.cs b/FlickrNet/UnknownResponseSL.cs index 7be5fe13..f1f13908 100644 --- a/FlickrNet/UnknownResponseSL.cs +++ b/FlickrNet/UnknownResponseSL.cs @@ -1,88 +1,89 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Linq; -using System.Xml; -using System.Xml.Linq; +//using System; +//using System.Collections.Generic; +//using System.Text; +//using System.IO; +//using System.Linq; +//using System.Xml; +//using System.Xml.Linq; -namespace FlickrNet -{ - /// - /// Contains the raw response from Flickr when an unknown method has been called. Used by . - /// - public sealed class UnknownResponse : IFlickrParsable - { - /// - /// The response from Flickr. - /// - public string ResponseXml { get; private set; } +// TODO FIX THIS +//namespace FlickrNet +//{ +// /// +// /// Contains the raw response from Flickr when an unknown method has been called. Used by . +// /// +// public sealed class UnknownResponse : IFlickrParsable +// { +// /// +// /// The response from Flickr. +// /// +// public string ResponseXml { get; private set; } - public XDocument GetXDocument() - { - return XDocument.Parse(ResponseXml); - } +// public XDocument GetXDocument() +// { +// return XDocument.Parse(ResponseXml); +// } - /// - /// Gets an attribute value from the given response. - /// - /// The response from Flickr, containing the XML returned. - /// The element name to find. - /// The attribute of the element to return. - /// The string value of the given attribute, if found. - public string GetAttributeValue(string element, string attribute) - { - System.Xml.Linq.XDocument doc = GetXDocument(); - if (string.IsNullOrEmpty(element) || element == "*") - return doc.Descendants().Attributes(attribute).First().Value; - else - return doc.Descendants(element).Attributes(attribute).First().Value; - } +// /// +// /// Gets an attribute value from the given response. +// /// +// /// The response from Flickr, containing the XML returned. +// /// The element name to find. +// /// The attribute of the element to return. +// /// The string value of the given attribute, if found. +// public string GetAttributeValue(string element, string attribute) +// { +// System.Xml.Linq.XDocument doc = GetXDocument(); +// if (string.IsNullOrEmpty(element) || element == "*") +// return doc.Descendants().Attributes(attribute).First().Value; +// else +// return doc.Descendants(element).Attributes(attribute).First().Value; +// } - /// - /// Gets a text value of an element from the given response. - /// - /// The response from Flickr, containing the XML returned. - /// The element name to find. - /// The string value of the given element, if found. - public string GetElementValue(string element) - { - System.Xml.Linq.XDocument doc = GetXDocument(); - return doc.Descendants(element).First().Value; - } +// /// +// /// Gets a text value of an element from the given response. +// /// +// /// The response from Flickr, containing the XML returned. +// /// The element name to find. +// /// The string value of the given element, if found. +// public string GetElementValue(string element) +// { +// System.Xml.Linq.XDocument doc = GetXDocument(); +// return doc.Descendants(element).First().Value; +// } - void IFlickrParsable.Load(System.Xml.XmlReader reader) - { - ResponseXml = reader.ReadOuterXml(); - } +// void IFlickrParsable.Load(System.Xml.XmlReader reader) +// { +// ResponseXml = reader.ReadOuterXml(); +// } - /// - /// Gets an array of text values of an element from the given response. - /// - /// - /// The element name to find. - /// An array of string values. - public string[] GetElementArray(string elementName) - { - var l = from e in GetXDocument().Descendants(elementName) select e.Value; +// /// +// /// Gets an array of text values of an element from the given response. +// /// +// /// +// /// The element name to find. +// /// An array of string values. +// public string[] GetElementArray(string elementName) +// { +// var l = from e in GetXDocument().Descendants(elementName) select e.Value; - return l.ToArray(); - } +// return l.ToArray(); +// } - /// - /// Gets an array of text values of an element from the given response. - /// - /// - /// The element name to find. - /// An array of string values. - public string[] GetElementArray(string elementName, string attributeName) - { - System.Xml.Linq.XDocument doc = GetXDocument(); - if (string.IsNullOrEmpty(elementName) || elementName == "*") - return doc.Descendants().Attributes(attributeName).Select( a => a.Value).ToArray(); - else - return doc.Descendants(elementName).Attributes(attributeName).Select(a => a.Value).ToArray(); - } +// /// +// /// Gets an array of text values of an element from the given response. +// /// +// /// +// /// The element name to find. +// /// An array of string values. +// public string[] GetElementArray(string elementName, string attributeName) +// { +// System.Xml.Linq.XDocument doc = GetXDocument(); +// if (string.IsNullOrEmpty(elementName) || elementName == "*") +// return doc.Descendants().Attributes(attributeName).Select( a => a.Value).ToArray(); +// else +// return doc.Descendants(elementName).Attributes(attributeName).Select(a => a.Value).ToArray(); +// } - } -} +// } +//} diff --git a/FlickrNetTest/FlickrNetTest.csproj b/FlickrNetTest/FlickrNetTest.csproj index 5f4d8a0d..64fac73c 100644 --- a/FlickrNetTest/FlickrNetTest.csproj +++ b/FlickrNetTest/FlickrNetTest.csproj @@ -1,5 +1,5 @@  - + Debug @@ -17,7 +17,7 @@ 3.5 - v4.0 + v4.6.1 SAK SAK SAK @@ -26,6 +26,7 @@ true + true @@ -37,6 +38,7 @@ 5 + false false @@ -45,9 +47,10 @@ TRACE + false - true + false FlickrNet.snk @@ -143,11 +146,13 @@ - + + Designer + - {5f017126-c1ff-4996-85cc-6150e80c6afc} + {27ee0d1c-4672-47a0-a84d-4660796bce58} FlickrNet diff --git a/FlickrNetTest/packages.config b/FlickrNetTest/packages.config index 91b71146..9478b7cb 100644 --- a/FlickrNetTest/packages.config +++ b/FlickrNetTest/packages.config @@ -1,8 +1,8 @@  - + - + \ No newline at end of file diff --git a/FlickrNetVS10.sln b/FlickrNetVS10.sln index 8df48b87..370a5f9a 100644 --- a/FlickrNetVS10.sln +++ b/FlickrNetVS10.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.24720.0 +# Visual Studio 15 +VisualStudioVersion = 15.0.27130.2027 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A78529B5-8396-4ECE-84B4-E42E66B4F0F9}" ProjectSection(SolutionItems) = preProject @@ -16,12 +16,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{6B0B4E EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlickrNetWP7", "FlickrNet\FlickrNetWP7.csproj", "{56086D96-2F0C-4788-B9E0-9E8EEB671BC9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlickrNet", "FlickrNet\FlickrNet.csproj", "{5F017126-C1FF-4996-85CC-6150E80C6AFC}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlickrNetTest", "FlickrNetTest\FlickrNetTest.csproj", "{169D2B40-8833-4AF1-B8CD-CA8B26E2A195}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlickrNetSilverlight", "FlickrNet\FlickrNetSilverlight.csproj", "{99FD3B5A-FAB3-488E-8169-37842B4F0B18}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlickrNet", "FlickrNet\FlickrNet.csproj", "{27EE0D1C-4672-47A0-A84D-4660796BCE58}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -44,14 +44,6 @@ Global {56086D96-2F0C-4788-B9E0-9E8EEB671BC9}.Release|ARM.Build.0 = Release|ARM {56086D96-2F0C-4788-B9E0-9E8EEB671BC9}.Release|x86.ActiveCfg = Release|x86 {56086D96-2F0C-4788-B9E0-9E8EEB671BC9}.Release|x86.Build.0 = Release|x86 - {5F017126-C1FF-4996-85CC-6150E80C6AFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5F017126-C1FF-4996-85CC-6150E80C6AFC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5F017126-C1FF-4996-85CC-6150E80C6AFC}.Debug|ARM.ActiveCfg = Debug|Any CPU - {5F017126-C1FF-4996-85CC-6150E80C6AFC}.Debug|x86.ActiveCfg = Debug|Any CPU - {5F017126-C1FF-4996-85CC-6150E80C6AFC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5F017126-C1FF-4996-85CC-6150E80C6AFC}.Release|Any CPU.Build.0 = Release|Any CPU - {5F017126-C1FF-4996-85CC-6150E80C6AFC}.Release|ARM.ActiveCfg = Release|Any CPU - {5F017126-C1FF-4996-85CC-6150E80C6AFC}.Release|x86.ActiveCfg = Release|Any CPU {169D2B40-8833-4AF1-B8CD-CA8B26E2A195}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {169D2B40-8833-4AF1-B8CD-CA8B26E2A195}.Debug|Any CPU.Build.0 = Debug|Any CPU {169D2B40-8833-4AF1-B8CD-CA8B26E2A195}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -68,8 +60,23 @@ Global {99FD3B5A-FAB3-488E-8169-37842B4F0B18}.Release|Any CPU.Build.0 = Release|Any CPU {99FD3B5A-FAB3-488E-8169-37842B4F0B18}.Release|ARM.ActiveCfg = Release|Any CPU {99FD3B5A-FAB3-488E-8169-37842B4F0B18}.Release|x86.ActiveCfg = Release|Any CPU + {27EE0D1C-4672-47A0-A84D-4660796BCE58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {27EE0D1C-4672-47A0-A84D-4660796BCE58}.Debug|Any CPU.Build.0 = Debug|Any CPU + {27EE0D1C-4672-47A0-A84D-4660796BCE58}.Debug|ARM.ActiveCfg = Debug|Any CPU + {27EE0D1C-4672-47A0-A84D-4660796BCE58}.Debug|ARM.Build.0 = Debug|Any CPU + {27EE0D1C-4672-47A0-A84D-4660796BCE58}.Debug|x86.ActiveCfg = Debug|Any CPU + {27EE0D1C-4672-47A0-A84D-4660796BCE58}.Debug|x86.Build.0 = Debug|Any CPU + {27EE0D1C-4672-47A0-A84D-4660796BCE58}.Release|Any CPU.ActiveCfg = Release|Any CPU + {27EE0D1C-4672-47A0-A84D-4660796BCE58}.Release|Any CPU.Build.0 = Release|Any CPU + {27EE0D1C-4672-47A0-A84D-4660796BCE58}.Release|ARM.ActiveCfg = Release|Any CPU + {27EE0D1C-4672-47A0-A84D-4660796BCE58}.Release|ARM.Build.0 = Release|Any CPU + {27EE0D1C-4672-47A0-A84D-4660796BCE58}.Release|x86.ActiveCfg = Release|Any CPU + {27EE0D1C-4672-47A0-A84D-4660796BCE58}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {1A16BCE4-B04B-4334-A0A5-A446FF529077} + EndGlobalSection EndGlobal From c1b151ce9106ebb6cff3bcb37ad056a9277798c2 Mon Sep 17 00:00:00 2001 From: Lukas Date: Fri, 20 Apr 2018 22:40:50 +1200 Subject: [PATCH 2/4] added .net40 and .net4.5 version --- FlickrNet/FlickrNet.csproj | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/FlickrNet/FlickrNet.csproj b/FlickrNet/FlickrNet.csproj index b4ff9d7f..2e114d44 100644 --- a/FlickrNet/FlickrNet.csproj +++ b/FlickrNet/FlickrNet.csproj @@ -1,19 +1,14 @@ - netstandard2.0 + netstandard2.0;net40;net45 FlickrNet.Core .Net Core library for accessing Flickr.com Api functionality Copyright © Sam Judson 2010 - - 4.4.1 - - - - + From e440ba6fef742359e624e5cded976c0a2bcca494 Mon Sep 17 00:00:00 2001 From: Lukas Date: Fri, 20 Apr 2018 22:43:00 +1200 Subject: [PATCH 3/4] updated version to 5.0 --- FlickrNet/FlickrNet.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/FlickrNet/FlickrNet.csproj b/FlickrNet/FlickrNet.csproj index 2e114d44..d53397a0 100644 --- a/FlickrNet/FlickrNet.csproj +++ b/FlickrNet/FlickrNet.csproj @@ -5,6 +5,7 @@ FlickrNet.Core .Net Core library for accessing Flickr.com Api functionality Copyright © Sam Judson 2010 + 5.0.0 From f3d13c220b7b12ac18ff62b25a696cea82bc6805 Mon Sep 17 00:00:00 2001 From: Lukas Date: Mon, 23 Apr 2018 21:40:25 +1200 Subject: [PATCH 4/4] added global.json specifying sdk used for build --- global.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 global.json diff --git a/global.json b/global.json new file mode 100644 index 00000000..00b3f36f --- /dev/null +++ b/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "2.1.4" + } +} \ No newline at end of file