From 3e42ddc9a244b69749ddf3a8d97784402a2b8f52 Mon Sep 17 00:00:00 2001 From: Pedro Lamas Date: Wed, 9 May 2012 17:30:25 +0100 Subject: [PATCH] Added some missing OAuth files to the .NET4 and Silverlight projects --- RestSharp.Net4/RestSharp.Net4.csproj | 3 + .../RestSharp.Silverlight.csproj | 57 +++++++++++++++++++ .../OAuth/Extensions/CollectionExtensions.cs | 8 +-- .../OAuth/Extensions/StringExtensions.cs | 14 +---- .../Authenticators/OAuth/OAuthWorkflow.cs | 2 +- .../Authenticators/OAuth/WebPairCollection.cs | 2 +- .../OAuth/WebParameterCollection.cs | 8 +-- .../Authenticators/OAuth1Authenticator.cs | 2 + 8 files changed, 67 insertions(+), 29 deletions(-) diff --git a/RestSharp.Net4/RestSharp.Net4.csproj b/RestSharp.Net4/RestSharp.Net4.csproj index c75df22c3..dbc445026 100644 --- a/RestSharp.Net4/RestSharp.Net4.csproj +++ b/RestSharp.Net4/RestSharp.Net4.csproj @@ -53,6 +53,9 @@ Authenticators\NtlmAuthenticator.cs + + Authenticators\OAuth1Authenticator.cs + Authenticators\OAuth2Authenticator.cs diff --git a/RestSharp.Silverlight/RestSharp.Silverlight.csproj b/RestSharp.Silverlight/RestSharp.Silverlight.csproj index 415aecc07..365951c16 100644 --- a/RestSharp.Silverlight/RestSharp.Silverlight.csproj +++ b/RestSharp.Silverlight/RestSharp.Silverlight.csproj @@ -72,9 +72,63 @@ Authenticators\NtlmAuthenticator.cs + + Authenticators\OAuth1Authenticator.cs + Authenticators\OAuth2Authenticator.cs + + Authenticators\OAuth\Extensions\CollectionExtensions.cs + + + Authenticators\OAuth\Extensions\OAuthExtensions.cs + + + Authenticators\OAuth\Extensions\StringExtensions.cs + + + Authenticators\OAuth\Extensions\TimeExtensions.cs + + + Authenticators\OAuth\HttpPostParameter.cs + + + Authenticators\OAuth\HttpPostParameterType.cs + + + Authenticators\OAuth\OAuthParameterHandling.cs + + + Authenticators\OAuth\OAuthSignatureMethod.cs + + + Authenticators\OAuth\OAuthSignatureTreatment.cs + + + Authenticators\OAuth\OAuthTools.cs + + + Authenticators\OAuth\OAuthType.cs + + + Authenticators\OAuth\OAuthWebQueryInfo.cs + + + Authenticators\OAuth\OAuthWorkflow.cs + + + Authenticators\OAuth\WebPair.cs + + + Authenticators\OAuth\WebPairCollection.cs + + + Authenticators\OAuth\WebParameter.cs + + + Authenticators\OAuth\WebParameterCollection.cs + Authenticators\SimpleAuthenticator.cs @@ -212,6 +266,9 @@ + + + diff --git a/RestSharp/Authenticators/OAuth/Extensions/CollectionExtensions.cs b/RestSharp/Authenticators/OAuth/Extensions/CollectionExtensions.cs index 258c7a00d..d403b1cc0 100644 --- a/RestSharp/Authenticators/OAuth/Extensions/CollectionExtensions.cs +++ b/RestSharp/Authenticators/OAuth/Extensions/CollectionExtensions.cs @@ -3,12 +3,6 @@ using System.Collections.Specialized; using System.Text; -#if SILVERLIGHT -using Hammock.Silverlight.Compat; -#else - -#endif - namespace RestSharp.Authenticators.OAuth.Extensions { internal static class CollectionExtensions @@ -55,7 +49,7 @@ public static void ForEach(this IEnumerable items, Action action) } } -#if !WINDOWS_PHONE +#if !WINDOWS_PHONE && !SILVERLIGHT public static void AddRange(this IDictionary collection, NameValueCollection range) { diff --git a/RestSharp/Authenticators/OAuth/Extensions/StringExtensions.cs b/RestSharp/Authenticators/OAuth/Extensions/StringExtensions.cs index b4463ee13..66a57e4c7 100644 --- a/RestSharp/Authenticators/OAuth/Extensions/StringExtensions.cs +++ b/RestSharp/Authenticators/OAuth/Extensions/StringExtensions.cs @@ -5,18 +5,6 @@ using System.Text; using System.Text.RegularExpressions; -#if SILVERLIGHT && !WindowsPhone -using System.Windows.Browser; -#endif - -#if WindowsPhone -using System.Web; -#endif - -#if !SILVERLIGHT - -#endif - namespace RestSharp.Authenticators.OAuth.Extensions { internal static class StringExtensions @@ -116,7 +104,7 @@ public static string PercentEncode(this string s) } private const RegexOptions Options = -#if SILVERLIGHT +#if !WINDOWS_PHONE && !SILVERLIGHT RegexOptions.Compiled | RegexOptions.IgnoreCase; #else RegexOptions.IgnoreCase; diff --git a/RestSharp/Authenticators/OAuth/OAuthWorkflow.cs b/RestSharp/Authenticators/OAuth/OAuthWorkflow.cs index e3747913d..5798bbb15 100644 --- a/RestSharp/Authenticators/OAuth/OAuthWorkflow.cs +++ b/RestSharp/Authenticators/OAuth/OAuthWorkflow.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using RestSharp.Authenticators.OAuth.Extensions; -#if !WINDOWS_PHONE +#if !WINDOWS_PHONE && !SILVERLIGHT using RestSharp.Contrib; #endif diff --git a/RestSharp/Authenticators/OAuth/WebPairCollection.cs b/RestSharp/Authenticators/OAuth/WebPairCollection.cs index 5f78f46e0..351f285f5 100644 --- a/RestSharp/Authenticators/OAuth/WebPairCollection.cs +++ b/RestSharp/Authenticators/OAuth/WebPairCollection.cs @@ -30,7 +30,7 @@ public WebPairCollection(IEnumerable parameters) _parameters = new List(parameters); } -#if !WINDOWS_PHONE +#if !WINDOWS_PHONE && !SILVERLIGHT public WebPairCollection(NameValueCollection collection) : this() { AddCollection(collection); diff --git a/RestSharp/Authenticators/OAuth/WebParameterCollection.cs b/RestSharp/Authenticators/OAuth/WebParameterCollection.cs index 6351580d7..5dae0f87f 100644 --- a/RestSharp/Authenticators/OAuth/WebParameterCollection.cs +++ b/RestSharp/Authenticators/OAuth/WebParameterCollection.cs @@ -1,12 +1,6 @@ using System.Collections.Generic; using System.Collections.Specialized; -#if !SILVERLIGHT - -#else -using Hammock.Silverlight.Compat; -#endif - namespace RestSharp.Authenticators.OAuth { internal class WebParameterCollection : WebPairCollection @@ -16,7 +10,7 @@ public WebParameterCollection(IEnumerable parameters) { } -#if !WINDOWS_PHONE +#if !WINDOWS_PHONE && !SILVERLIGHT public WebParameterCollection(NameValueCollection collection) : base(collection) { } diff --git a/RestSharp/Authenticators/OAuth1Authenticator.cs b/RestSharp/Authenticators/OAuth1Authenticator.cs index 09723bce8..a2f19f829 100644 --- a/RestSharp/Authenticators/OAuth1Authenticator.cs +++ b/RestSharp/Authenticators/OAuth1Authenticator.cs @@ -6,6 +6,8 @@ #if WINDOWS_PHONE using System.Net; +#elif SILVERLIGHT +using System.Windows.Browser; #else using RestSharp.Contrib; #endif