Skip to content

Commit 9d3405b

Browse files
committed
Merge pull request #485 from brettryan/master
Add compact framework support
2 parents 516c4a2 + 2493e15 commit 9d3405b

35 files changed

+388
-59
lines changed

README.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
### Features
88

9-
* Supports .NET 3.5+, Silverlight 4, Windows Phone 7, Mono, MonoTouch, Mono for Android
9+
* Supports .NET 3.5+, Silverlight 4, Windows Phone 7, Mono, MonoTouch, Mono for Android, Compact Framework 3.5
1010
* Easy installation using [NuGet](http://nuget.org/packages/RestSharp) for most .NET flavors
1111
* Automatic XML and JSON deserialization
1212
* Supports custom serialization and deserialization via ISerializer and IDeserializer

RestSharp.Compact.sln

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 10.00
3+
# Visual Studio 2008
4+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RestSharp.Compact", "RestSharp\RestSharp.Compact.csproj", "{A29E330B-F854-4287-BEB2-C4CBE9D9C637}"
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+
{A29E330B-F854-4287-BEB2-C4CBE9D9C637}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13+
{A29E330B-F854-4287-BEB2-C4CBE9D9C637}.Debug|Any CPU.Build.0 = Debug|Any CPU
14+
{A29E330B-F854-4287-BEB2-C4CBE9D9C637}.Release|Any CPU.ActiveCfg = Release|Any CPU
15+
{A29E330B-F854-4287-BEB2-C4CBE9D9C637}.Release|Any CPU.Build.0 = Release|Any CPU
16+
EndGlobalSection
17+
GlobalSection(SolutionProperties) = preSolution
18+
HideSolutionNode = FALSE
19+
EndGlobalSection
20+
EndGlobal

RestSharp/Authenticators/OAuth/Extensions/CollectionExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public static void ForEach<T>(this IEnumerable<T> items, Action<T> action)
4949
}
5050
}
5151

52-
#if !WINDOWS_PHONE && !SILVERLIGHT
52+
#if !WINDOWS_PHONE && !SILVERLIGHT && !PocketPC
5353

5454
public static void AddRange(this IDictionary<string, string> collection, NameValueCollection range)
5555
{

RestSharp/Authenticators/OAuth/Extensions/StringExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public static IDictionary<string, string> ParseQueryString(this string query)
104104
}
105105

106106
private const RegexOptions Options =
107-
#if !WINDOWS_PHONE && !SILVERLIGHT
107+
#if !WINDOWS_PHONE && !SILVERLIGHT && !PocketPC
108108
RegexOptions.Compiled | RegexOptions.IgnoreCase;
109109
#else
110110
RegexOptions.IgnoreCase;

RestSharp/Authenticators/OAuth/HttpPostParameterType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace RestSharp.Authenticators.OAuth
44
{
5-
#if !SILVERLIGHT && !WINDOWS_PHONE
5+
#if !SILVERLIGHT && !WINDOWS_PHONE && !PocketPC
66
[Serializable]
77
#endif
88
internal enum HttpPostParameterType

RestSharp/Authenticators/OAuth/OAuthParameterHandling.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace RestSharp.Authenticators.OAuth
44
{
5-
#if !SILVERLIGHT && !WINDOWS_PHONE
5+
#if !SILVERLIGHT && !WINDOWS_PHONE && !PocketPC
66
[Serializable]
77
#endif
88
public enum OAuthParameterHandling

RestSharp/Authenticators/OAuth/OAuthSignatureMethod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace RestSharp.Authenticators.OAuth
44
{
5-
#if !SILVERLIGHT && !WINDOWS_PHONE
5+
#if !SILVERLIGHT && !WINDOWS_PHONE && !PocketPC
66
[Serializable]
77
#endif
88
public enum OAuthSignatureMethod

RestSharp/Authenticators/OAuth/OAuthSignatureTreatment.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace RestSharp.Authenticators.OAuth
44
{
5-
#if !SILVERLIGHT && !WINDOWS_PHONE
5+
#if !SILVERLIGHT && !WINDOWS_PHONE && !PocketPC
66
[Serializable]
77
#endif
88
public enum OAuthSignatureTreatment

RestSharp/Authenticators/OAuth/OAuthTools.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace RestSharp.Authenticators.OAuth
88
{
9-
#if !SILVERLIGHT && !WINDOWS_PHONE
9+
#if !SILVERLIGHT && !WINDOWS_PHONE && !PocketPC
1010
[Serializable]
1111
#endif
1212
internal static class OAuthTools
@@ -20,13 +20,13 @@ internal static class OAuthTools
2020
private static readonly Random _random;
2121
private static readonly object _randomLock = new object();
2222

23-
#if !SILVERLIGHT && !WINDOWS_PHONE
23+
#if !SILVERLIGHT && !WINDOWS_PHONE && !PocketPC
2424
private static readonly RandomNumberGenerator _rng = RandomNumberGenerator.Create();
2525
#endif
2626

2727
static OAuthTools()
2828
{
29-
#if !SILVERLIGHT && !WINDOWS_PHONE
29+
#if !SILVERLIGHT && !WINDOWS_PHONE && !PocketPC
3030
var bytes = new byte[4];
3131
_rng.GetNonZeroBytes(bytes);
3232
_random = new Random(BitConverter.ToInt32(bytes, 0));
@@ -305,6 +305,7 @@ public static string GetSignature(OAuthSignatureMethod signatureMethod,
305305
string signature;
306306
switch (signatureMethod)
307307
{
308+
#if !PocketPC
308309
case OAuthSignatureMethod.HmacSha1:
309310
{
310311
var crypto = new HMACSHA1();
@@ -315,14 +316,19 @@ public static string GetSignature(OAuthSignatureMethod signatureMethod,
315316

316317
break;
317318
}
319+
#endif
318320
case OAuthSignatureMethod.PlainText:
319321
{
320322
signature = "{0}&{1}".FormatWith(consumerSecret, tokenSecret);
321323

322324
break;
323325
}
324326
default:
327+
#if PocketPC
328+
throw new NotImplementedException("Only PlainText is currently supported.");
329+
#else
325330
throw new NotImplementedException("Only HMAC-SHA1 is currently supported.");
331+
#endif
326332
}
327333

328334
var result = signatureTreatment == OAuthSignatureTreatment.Escaped

RestSharp/Authenticators/OAuth/OAuthType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace RestSharp.Authenticators.OAuth
44
{
5-
#if !SILVERLIGHT && !WINDOWS_PHONE
5+
#if !SILVERLIGHT && !WINDOWS_PHONE && !PocketPC
66
[Serializable]
77
#endif
88
public enum OAuthType

0 commit comments

Comments
 (0)