Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update

  • Loading branch information...
commit d0b0dc1670a12dfa0feff49a0d2f99af106089bf 1 parent d4bd238
Steven Houben authored
Showing with 9,949 additions and 528 deletions.
  1. +171 −0 NooSphere/Libs/MonoDroid.System.Net.Http/Custom/AsyncHttpClientExtensions.cs
  2. +92 −0 NooSphere/Libs/MonoDroid.System.Net.Http/Custom/HttpWebRequestExtensions.cs
  3. +19 −0 NooSphere/Libs/MonoDroid.System.Net.Http/Custom/OperationCanceledException.cs
  4. +123 −0 NooSphere/Libs/MonoDroid.System.Net.Http/Custom/RequestHelper.cs
  5. +118 −0 NooSphere/Libs/MonoDroid.System.Net.Http/MonoDroid.System.Net.Http.csproj
  6. +29 −0 NooSphere/Libs/MonoDroid.System.Net.Http/Properties/AssemblyInfo.cs
  7. +281 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/AsyncResult.cs
  8. +122 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/CacheResponseProperty.cs
  9. +29 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/CompletedAsyncResult.cs
  10. +171 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/DelegatingStream.cs
  11. +79 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/DetectEofStream.cs
  12. +40 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/DrainOnCloseStream.cs
  13. +20 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/AcceptRangeUnit.cs
  14. +57 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/AuthenticationHelper.cs
  15. +72 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/ByteRange.cs
  16. +334 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/CacheControl.cs
  17. +71 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/Challenge.cs
  18. +81 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/Connection.cs
  19. +21 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/ContentCoding.cs
  20. +118 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/ContentRange.cs
  21. +151 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/Cookie.cs
  22. +95 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/Credential.cs
  23. +80 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/DateOrDeltaSeconds.cs
  24. +87 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/DateOrEntityTag.cs
  25. +89 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/EntityTag.cs
  26. +81 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/Expect.cs
  27. +402 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/HeaderFormatter.cs
  28. +478 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/HeaderStore.cs
  29. +148 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/HeaderString.cs
  30. +145 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/HeaderValues.cs
  31. +59 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/Host.cs
  32. +346 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/HttpHeaders.cs
  33. +72 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/Product.cs
  34. +99 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/ProductOrComment.cs
  35. +74 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/Range.cs
  36. +268 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/RequestHeaders.cs
  37. +153 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/ResponseHeaders.cs
  38. +146 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/StringWithOptionalQuality.cs
  39. +25 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/TransferCoding.cs
  40. +114 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/Via.cs
  41. +104 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/Warning.cs
  42. +21 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/HttpAsyncStage.cs
  43. +504 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/HttpClient.cs
  44. +600 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/HttpContent.cs
  45. +31 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/HttpFormFile.cs
  46. +27 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/HttpFormValue.cs
  47. +177 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/HttpMessageCore.cs
  48. +102 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/HttpMessageExtensions.cs
  49. +21 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/HttpMethod.cs
  50. +147 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/HttpMethodExtensions.cs
  51. +164 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/HttpMultipartMimeForm.cs
  52. +67 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/HttpProcessingException.cs
  53. +49 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/HttpProcessingStage.cs
  54. +91 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/HttpQueryString.cs
  55. +143 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/HttpRequestMessage.cs
  56. +139 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/HttpResponseMessage.cs
  57. +18 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/HttpStage.cs
  58. +291 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/HttpStageProcessingAsyncResult.cs
  59. +162 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/HttpStageProcessingAsyncState.cs
  60. +63 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/HttpStageProcessingException.cs
  61. +109 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/HttpTransportSettings.cs
  62. +97 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/HttpUrlEncodedForm.cs
  63. +43 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/HttpUtility.cs
  64. +823 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/HttpWebRequestTransportStage.cs
  65. +19 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/ICreateHttpContent.cs
  66. +65 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/SendCompletedEventArgs.cs
  67. +105 −0 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/StreamExtensions.cs
  68. +2 −1  NooSphere/NooSphere.ActivitySystem/Base/Client/ActivityClient.cs
  69. +12 −11 NooSphere/NooSphere.ActivitySystem/Base/Service/ActivityCloudConnector.cs
  70. +9 −11 NooSphere/NooSphere.ActivitySystem/FileServer/FileStore.cs
  71. +136 −132 NooSphere/NooSphere.ActivitySystem/NooSphere.ActivitySystem.MonoDroid.csproj
  72. +1 −3 NooSphere/NooSphere.Context/IContextService.cs
  73. +2 −1  NooSphere/NooSphere.Context/IO/PointerNode.cs
  74. +192 −192 NooSphere/NooSphere.Context/Multicast/MulticastSocket.cs
  75. +47 −46 NooSphere/NooSphere.Core/ActivityModel/Resource.cs
  76. +68 −64 NooSphere/NooSphere.Helpers/NooSphere.Helpers.MonoDroid.csproj
  77. +68 −62 NooSphere/NooSphere.Helpers/NooSphere.Helpers.csproj
  78. +59 −0 NooSphere/NooSphere.Helpers/Rest.cs
  79. +5 −5 NooSphere/NooSphere.Helpers/packages.config
  80. +6 −0 NooSphere/NooSphere.MonoDroid.sln
View
171 NooSphere/Libs/MonoDroid.System.Net.Http/Custom/AsyncHttpClientExtensions.cs
@@ -0,0 +1,171 @@
+using System;
+using System.Collections.Generic;
+using System.Threading;
+
+namespace Microsoft.Http
+{
+ public static class AsyncHttpClientExtensions
+ {
+ public static void GetAsync(this HttpClient client, string uri, Action<HttpResponseMessage> callback)
+ {
+ CheckNull(client, "client");
+ CheckNull(callback, "callback");
+
+ ThreadPool.QueueUserWorkItem(s => callback(client.Get(uri)));
+ }
+
+
+ public static void GetAsync(this HttpClient client, Uri uri, Action<HttpResponseMessage> callback)
+ {
+ CheckNull(client, "client");
+ CheckNull(callback, "callback");
+
+ ThreadPool.QueueUserWorkItem(s => callback(client.Get(uri)));
+ }
+
+ public static void GetAsync(this HttpClient client, Action<HttpResponseMessage> callback)
+ {
+ CheckNull(client, "client");
+ CheckNull(callback, "callback");
+
+ ThreadPool.QueueUserWorkItem(s => callback(client.Get()));
+ }
+
+ public static void GetAsync(this HttpClient client, Uri uri, HttpQueryString queryString,
+ Action<HttpResponseMessage> callback)
+ {
+ CheckNull(client, "client");
+ CheckNull(callback, "callback");
+
+ ThreadPool.QueueUserWorkItem(s => callback(client.Get(uri, queryString)));
+ }
+
+ public static void GetAsync(this HttpClient client, Uri uri,
+ IEnumerable<KeyValuePair<string, string>> queryString,
+ Action<HttpResponseMessage> callback)
+ {
+ CheckNull(client, "client");
+ CheckNull(callback, "callback");
+
+ ThreadPool.QueueUserWorkItem(s => callback(client.Get(uri, queryString)));
+ }
+
+
+ public static void DeleteAsync(this HttpClient client, Uri uri, Action<HttpResponseMessage> callback)
+ {
+ CheckNull(client, "client");
+ CheckNull(uri, "uri");
+
+ ThreadPool.QueueUserWorkItem(s => callback(client.Delete(uri)));
+ }
+
+ public static void DeleteAsync(this HttpClient client, string uri, Action<HttpResponseMessage> callback)
+ {
+ CheckNull(client, "client");
+ CheckNull(callback, "callback");
+
+ ThreadPool.QueueUserWorkItem(s => callback(client.Delete(uri)));
+ }
+
+
+ public static void HeadAsync(this HttpClient client, string uri, Action<HttpResponseMessage> callback)
+ {
+ CheckNull(client, "client");
+ CheckNull(callback, "callback");
+
+ ThreadPool.QueueUserWorkItem(s => callback(client.Head(uri)));
+ }
+
+
+ public static void HeadAsync(this HttpClient client, Uri uri, Action<HttpResponseMessage> callback)
+ {
+ CheckNull(client, "client");
+ CheckNull(callback, "callback");
+
+ ThreadPool.QueueUserWorkItem(s => callback(client.Head(uri)));
+ }
+
+
+ public static void PostAsync(this HttpClient client, string uri, HttpContent body,
+ Action<HttpResponseMessage> callback)
+ {
+ CheckNull(client, "client");
+ CheckNull(callback, "callback");
+
+ ThreadPool.QueueUserWorkItem(s => callback(client.Post(uri, body)));
+ }
+
+ public static void PostAsync(this HttpClient client, Uri uri, HttpContent body,
+ Action<HttpResponseMessage> callback)
+ {
+ CheckNull(client, "client");
+ CheckNull(callback, "callback");
+
+ ThreadPool.QueueUserWorkItem(s => callback(client.Post(uri, body)));
+ }
+
+ public static void PostAsync(this HttpClient client, string uri, string contentType, HttpContent body,
+ Action<HttpResponseMessage> callback)
+ {
+ CheckNull(client, "client");
+ CheckNull(callback, "callback");
+
+ ThreadPool.QueueUserWorkItem(s => callback(client.Post(uri, contentType, body)));
+ }
+
+ public static void PostAsync(this HttpClient client, Uri uri, string contentType, HttpContent body,
+ Action<HttpResponseMessage> callback)
+ {
+ CheckNull(client, "client");
+ CheckNull(callback, "callback");
+
+ ThreadPool.QueueUserWorkItem(s => callback(client.Post(uri, contentType, body)));
+ }
+
+
+ public static void PutAsync(this HttpClient client, string uri, HttpContent body,
+ Action<HttpResponseMessage> callback)
+ {
+ CheckNull(client, "client");
+ CheckNull(callback, "callback");
+
+ ThreadPool.QueueUserWorkItem(s => callback(client.Put(uri, body)));
+ }
+
+ public static void PutAsync(this HttpClient client, Uri uri, HttpContent body,
+ Action<HttpResponseMessage> callback)
+ {
+ CheckNull(client, "client");
+ CheckNull(callback, "callback");
+
+ ThreadPool.QueueUserWorkItem(s => callback(client.Put(uri, body)));
+ }
+
+
+ public static void PutAsync(this HttpClient client, string uri, string contentType, HttpContent body,
+ Action<HttpResponseMessage> callback)
+ {
+ CheckNull(client, "client");
+ CheckNull(callback, "callback");
+
+ ThreadPool.QueueUserWorkItem(s => callback(client.Put(uri, contentType, body)));
+ }
+
+ public static void PutAsync(this HttpClient client, Uri uri, string contentType, HttpContent body,
+ Action<HttpResponseMessage> callback)
+ {
+ CheckNull(client, "client");
+ CheckNull(callback, "callback");
+ ThreadPool.QueueUserWorkItem(s => callback(client.Put(uri, contentType, body)));
+ }
+
+
+ private static void CheckNull<T>(T o, string name) where T : class
+ {
+ if (o == null)
+ {
+ throw new ArgumentNullException(name);
+ }
+ }
+ }
+}
View
92 NooSphere/Libs/MonoDroid.System.Net.Http/Custom/HttpWebRequestExtensions.cs
@@ -0,0 +1,92 @@
+using System;
+using System.Globalization;
+using System.Net;
+
+namespace Silverlight_Client.REST_Client_Lib.Custom
+{
+ public static class HttpWebRequestExtensions
+ {
+ public static void AddRange(this HttpWebRequest request, int range)
+ {
+ AddRange(request, "bytes", range);
+ }
+
+ public static void AddRange(this HttpWebRequest request, int from, int to)
+ {
+ AddRange(request, "bytes", from, to);
+ }
+
+ public static void AddRange(this HttpWebRequest request, string rangeSpecifier, int range)
+ {
+ if (rangeSpecifier == null)
+ {
+ throw new ArgumentNullException("rangeSpecifier");
+ }
+
+ if (!AddRange(request, rangeSpecifier, range.ToString(NumberFormatInfo.InvariantInfo), (range >= 0) ? "" : null))
+ {
+ string msg = "A different range specifier has already been added to this request.";
+ throw new InvalidOperationException(msg);
+ }
+ }
+
+ public static void AddRange(this HttpWebRequest request, string rangeSpecifier, int from, int to)
+ {
+ if (rangeSpecifier == null)
+ {
+ throw new ArgumentNullException("rangeSpecifier");
+ }
+ if ((from < 0))
+ {
+ throw new ArgumentOutOfRangeException("from", "Range is too small");
+ }
+ if ((to < 0))
+ {
+ throw new ArgumentOutOfRangeException("to", "Range is too small");
+ }
+
+ if (from > to)
+ {
+ throw new ArgumentOutOfRangeException("from", "From is bigger than to");
+ }
+// if (!WebHeaderCollection.IsValidToken(rangeSpecifier))
+// {
+// throw new ArgumentException("Not a valid token", "rangeSpecifier");
+// }
+
+ if (!AddRange(request, rangeSpecifier, from.ToString(NumberFormatInfo.InvariantInfo), to.ToString(NumberFormatInfo.InvariantInfo)))
+ {
+ string msg = "A different range specifier has already been added to this request.";
+ throw new InvalidOperationException(msg);
+ }
+ }
+
+ private static bool AddRange(HttpWebRequest request, string rangeSpecifier, string from, string to)
+ {
+ string str = request.Headers["Range"];
+ if (string.IsNullOrEmpty(str))
+ {
+ str = rangeSpecifier + "=";
+ }
+ else
+ {
+ if (string.Compare(str.Substring(0, str.IndexOf('=')), rangeSpecifier, StringComparison.OrdinalIgnoreCase) != 0)
+ {
+ return false;
+ }
+ str = string.Empty;
+ }
+ str = str + from.ToString();
+ if (to != null)
+ {
+ str = str + "-" + to;
+ }
+
+ request.Headers.Add(HttpRequestHeader.Range, str);
+
+ return true;
+ }
+
+
+ }
+}
View
19 NooSphere/Libs/MonoDroid.System.Net.Http/Custom/OperationCanceledException.cs
@@ -0,0 +1,19 @@
+using System;
+
+namespace Microsoft.Http
+{
+ public class OperationCanceledException : Exception
+ {
+ public OperationCanceledException()
+ {
+ }
+
+ public OperationCanceledException(string message) : base(message)
+ {
+ }
+
+ public OperationCanceledException(string message, Exception inner) : base(message, inner)
+ {
+ }
+ }
+}
View
123 NooSphere/Libs/MonoDroid.System.Net.Http/Custom/RequestHelper.cs
@@ -0,0 +1,123 @@
+using System;
+using System.IO;
+using System.Net;
+using System.Threading;
+
+namespace Microsoft.Http
+{
+ /// <summary>
+ /// Some helper
+ /// </summary>
+ public static class RequestHelper
+ {
+ /// <summary>
+ /// A blocking operation that does not continue until a response has been
+ /// received for a given <see cref="HttpWebRequest"/>, or the request
+ /// timed out.
+ /// </summary>
+ /// <param name="request">The request to be sent.</param>
+ /// <param name="timeout">An optional timeout.</param>
+ /// <returns>The response that was received for the request.</returns>
+ /// <exception cref="TimeoutException">If the <paramref name="timeout"/>
+ /// parameter was set, and no response was received within the specified
+ /// time.</exception>
+ /// <remarks>You must not invoke this method on the UI thread, or the call will
+ /// time out. This is because the <see cref="HttpWebRequest.EndGetResponse"/>
+ /// method accesses the UI thread as well, which will starve the worker thread.</remarks>
+ public static HttpWebResponse GetResponse(this HttpWebRequest request, int? timeout)
+ {
+ if (request == null) throw new ArgumentNullException("request");
+
+ AutoResetEvent waitHandle = new AutoResetEvent(false);
+ HttpWebResponse response = null;
+ Exception exception = null;
+
+ AsyncCallback callback = ar =>
+ {
+ try
+ {
+ //get the response
+ response = (HttpWebResponse)request.EndGetResponse(ar);
+ }
+ catch(Exception e)
+ {
+ exception = e;
+ }
+ finally
+ {
+ //setting the handle unblocks the loop below
+ waitHandle.Set();
+ }
+ };
+
+
+ //request response async
+ var asyncResult = request.BeginGetResponse(callback, null);
+ if (asyncResult.CompletedSynchronously) return response;
+
+ bool hasSignal = waitHandle.WaitOne(timeout ?? Timeout.Infinite);
+ if (!hasSignal)
+ {
+ throw new TimeoutException("No response received in time.");
+ }
+
+ //bubble exception that occurred on worker thread
+ if (exception != null) throw exception;
+
+ return response;
+ }
+
+
+
+ /// <summary>
+ /// Synchronously gets a request stream for a given request.
+ /// </summary>
+ /// <param name="request">The request to be sent.</param>
+ /// <param name="timeout">An optional timeout.</param>
+ /// <returns>The stream that was received for the request.</returns>
+ /// <exception cref="TimeoutException">If the <paramref name="timeout"/>
+ /// parameter was set, and no stream was received within the specified
+ /// time.</exception>
+ public static Stream GetRequestStream(this HttpWebRequest request, int? timeout)
+ {
+ if (request == null) throw new ArgumentNullException("request");
+
+ AutoResetEvent waitHandle = new AutoResetEvent(false);
+ Stream requestStream = null;
+ Exception exception = null;
+
+ AsyncCallback callback = ar =>
+ {
+ //get the response
+ try
+ {
+ requestStream = request.EndGetRequestStream(ar);
+ }
+ catch (Exception e)
+ {
+ exception = e;
+ }
+ finally
+ {
+ //setting the handle unblocks the loop below
+ waitHandle.Set();
+ }
+ };
+
+ //request stream async
+ var asyncResult = request.BeginGetRequestStream(callback, null);
+ if (asyncResult.CompletedSynchronously) return requestStream;
+
+ bool hasSignal = waitHandle.WaitOne(timeout ?? Timeout.Infinite);
+ if (!hasSignal)
+ {
+ throw new TimeoutException("No response received in time.");
+ }
+
+ //bubble exception that occurred on worker thread
+ if (exception != null) throw exception;
+
+ return requestStream;
+ }
+ }
+}
View
118 NooSphere/Libs/MonoDroid.System.Net.Http/MonoDroid.System.Net.Http.csproj
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{627261EB-2DF1-4F85-B6A5-FE067164C86C}</ProjectGuid>
+ <ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>MonoDroid.System.Net.Http</RootNamespace>
+ <AssemblyName>MonoDroid.System.Net.Http</AssemblyName>
+ <FileAlignment>512</FileAlignment>
+ <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="mscorlib" />
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Web.Services" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Custom\AsyncHttpClientExtensions.cs" />
+ <Compile Include="Custom\HttpWebRequestExtensions.cs" />
+ <Compile Include="Custom\OperationCanceledException.cs" />
+ <Compile Include="Custom\RequestHelper.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="REST Client Lib\AsyncResult.cs" />
+ <Compile Include="REST Client Lib\CacheResponseProperty.cs" />
+ <Compile Include="REST Client Lib\CompletedAsyncResult.cs" />
+ <Compile Include="REST Client Lib\DelegatingStream.cs" />
+ <Compile Include="REST Client Lib\DetectEofStream.cs" />
+ <Compile Include="REST Client Lib\DrainOnCloseStream.cs" />
+ <Compile Include="REST Client Lib\Headers\AcceptRangeUnit.cs" />
+ <Compile Include="REST Client Lib\Headers\AuthenticationHelper.cs" />
+ <Compile Include="REST Client Lib\Headers\ByteRange.cs" />
+ <Compile Include="REST Client Lib\Headers\CacheControl.cs" />
+ <Compile Include="REST Client Lib\Headers\Challenge.cs" />
+ <Compile Include="REST Client Lib\Headers\Connection.cs" />
+ <Compile Include="REST Client Lib\Headers\ContentCoding.cs" />
+ <Compile Include="REST Client Lib\Headers\ContentRange.cs" />
+ <Compile Include="REST Client Lib\Headers\Cookie.cs" />
+ <Compile Include="REST Client Lib\Headers\Credential.cs" />
+ <Compile Include="REST Client Lib\Headers\DateOrDeltaSeconds.cs" />
+ <Compile Include="REST Client Lib\Headers\DateOrEntityTag.cs" />
+ <Compile Include="REST Client Lib\Headers\EntityTag.cs" />
+ <Compile Include="REST Client Lib\Headers\Expect.cs" />
+ <Compile Include="REST Client Lib\Headers\HeaderFormatter.cs" />
+ <Compile Include="REST Client Lib\Headers\HeaderStore.cs" />
+ <Compile Include="REST Client Lib\Headers\HeaderString.cs" />
+ <Compile Include="REST Client Lib\Headers\HeaderValues.cs" />
+ <Compile Include="REST Client Lib\Headers\Host.cs" />
+ <Compile Include="REST Client Lib\Headers\HttpHeaders.cs" />
+ <Compile Include="REST Client Lib\Headers\Product.cs" />
+ <Compile Include="REST Client Lib\Headers\ProductOrComment.cs" />
+ <Compile Include="REST Client Lib\Headers\Range.cs" />
+ <Compile Include="REST Client Lib\Headers\RequestHeaders.cs" />
+ <Compile Include="REST Client Lib\Headers\ResponseHeaders.cs" />
+ <Compile Include="REST Client Lib\Headers\StringWithOptionalQuality.cs" />
+ <Compile Include="REST Client Lib\Headers\TransferCoding.cs" />
+ <Compile Include="REST Client Lib\Headers\Via.cs" />
+ <Compile Include="REST Client Lib\Headers\Warning.cs" />
+ <Compile Include="REST Client Lib\HttpAsyncStage.cs" />
+ <Compile Include="REST Client Lib\HttpClient.cs" />
+ <Compile Include="REST Client Lib\HttpContent.cs" />
+ <Compile Include="REST Client Lib\HttpFormFile.cs" />
+ <Compile Include="REST Client Lib\HttpFormValue.cs" />
+ <Compile Include="REST Client Lib\HttpMessageCore.cs" />
+ <Compile Include="REST Client Lib\HttpMessageExtensions.cs" />
+ <Compile Include="REST Client Lib\HttpMethod.cs" />
+ <Compile Include="REST Client Lib\HttpMethodExtensions.cs" />
+ <Compile Include="REST Client Lib\HttpMultipartMimeForm.cs" />
+ <Compile Include="REST Client Lib\HttpProcessingException.cs" />
+ <Compile Include="REST Client Lib\HttpProcessingStage.cs" />
+ <Compile Include="REST Client Lib\HttpQueryString.cs" />
+ <Compile Include="REST Client Lib\HttpRequestMessage.cs" />
+ <Compile Include="REST Client Lib\HttpResponseMessage.cs" />
+ <Compile Include="REST Client Lib\HttpStage.cs" />
+ <Compile Include="REST Client Lib\HttpStageProcessingAsyncResult.cs" />
+ <Compile Include="REST Client Lib\HttpStageProcessingAsyncState.cs" />
+ <Compile Include="REST Client Lib\HttpStageProcessingException.cs" />
+ <Compile Include="REST Client Lib\HttpTransportSettings.cs" />
+ <Compile Include="REST Client Lib\HttpUrlEncodedForm.cs" />
+ <Compile Include="REST Client Lib\HttpUtility.cs" />
+ <Compile Include="REST Client Lib\HttpWebRequestTransportStage.cs" />
+ <Compile Include="REST Client Lib\ICreateHttpContent.cs" />
+ <Compile Include="REST Client Lib\SendCompletedEventArgs.cs" />
+ <Compile Include="REST Client Lib\StreamExtensions.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
View
29 NooSphere/Libs/MonoDroid.System.Net.Http/Properties/AssemblyInfo.cs
@@ -0,0 +1,29 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("MonoDroid.System.Net.Http")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("MonoDroid.System.Net.Http")]
+[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: ComVisible(false)]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
View
281 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/AsyncResult.cs
@@ -0,0 +1,281 @@
+//----------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//----------------------------------------------------------------
+using System.Collections.Generic;
+
+namespace Microsoft.Http
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using System.Threading;
+ using System.Reflection;
+ using System.Diagnostics;
+
+ abstract class AsyncResult : IAsyncResult
+ {
+ AsyncCallback callback;
+ bool completedSynchronously;
+ bool endCalled;
+ Exception exception;
+ bool isCompleted;
+ ManualResetEvent manualResetEvent;
+ object state;
+ object thisLock;
+
+ protected AsyncResult(AsyncCallback callback, object state)
+ {
+ this.callback = callback;
+ this.state = state;
+ this.thisLock = new object();
+
+ CallbackChecker.Check(callback);
+ }
+
+ // Properties
+ public object AsyncState
+ {
+ get
+ {
+ return this.state;
+ }
+ }
+
+ public WaitHandle AsyncWaitHandle
+ {
+ get
+ {
+ if (this.manualResetEvent == null)
+ {
+ lock (this.ThisLock)
+ {
+ if (this.manualResetEvent == null)
+ {
+ this.manualResetEvent = new ManualResetEvent(this.isCompleted);
+ }
+ }
+ }
+ return this.manualResetEvent;
+ }
+ }
+
+ public bool CompletedSynchronously
+ {
+ get
+ {
+ return this.completedSynchronously;
+ }
+ }
+
+ public bool IsCompleted
+ {
+ get
+ {
+ return this.isCompleted;
+ }
+ }
+
+ object ThisLock
+ {
+ get
+ {
+ return this.thisLock;
+ }
+ }
+ protected static TAsyncResult End<TAsyncResult>(IAsyncResult result) where TAsyncResult : AsyncResult
+ {
+ return End<TAsyncResult>(result, true);
+ }
+ protected static TAsyncResult End<TAsyncResult>(IAsyncResult result, bool throwException) where TAsyncResult : AsyncResult
+ {
+ if (result == null)
+ {
+ throw new ArgumentNullException("result");
+ }
+ TAsyncResult local = (TAsyncResult)result;
+ if (local.endCalled)
+ {
+ throw new InvalidOperationException("AsyncObjectAlreadyEnded");
+ }
+ local.endCalled = true;
+ if (!local.isCompleted)
+ {
+ local.AsyncWaitHandle.WaitOne();
+ }
+ if (local.manualResetEvent != null)
+ {
+ local.manualResetEvent.Close();
+ }
+ if (local.exception != null && throwException)
+ {
+ System.Diagnostics.Debug.WriteLine(local.exception);
+ throw local.exception;
+ }
+ return local;
+ }
+
+
+#if DEBUG
+ string completionStack;
+#endif
+
+ protected void Complete(bool completedSynchronously)
+ {
+ if (this.isCompleted)
+ {
+#if DEBUG && !SILVERLIGHT
+ Debug.WriteLine("///////////////////// original stack /////////////////\n" + completionStack + "\n///////////////////// second completion /////////////////\n" + Environment.StackTrace);
+ Debug.Assert(false);
+#endif
+ throw new InvalidOperationException("completed");
+ }
+#if DEBUG &&!SILVERLIGHT
+ this.completionStack = Environment.StackTrace;
+#endif
+ this.completedSynchronously = completedSynchronously;
+ if (completedSynchronously)
+ {
+ this.isCompleted = true;
+ }
+ else
+ {
+ lock (this.ThisLock)
+ {
+ this.isCompleted = true;
+ if (this.manualResetEvent != null)
+ {
+ this.manualResetEvent.Set();
+ }
+ }
+ }
+ if (this.callback != null)
+ {
+ try
+ {
+ this.callback(this);
+ }
+ catch (Exception exception)
+ {
+ if (IsFatal(exception))
+ {
+ throw;
+ }
+ throw new CallbackException(this.callback.Method.ToString(), exception);
+ }
+ }
+ }
+
+#if !SILVERLIGHT
+ [Serializable]
+#endif
+ internal sealed class CallbackException : SystemException
+ {
+ public CallbackException()
+ {
+ }
+
+ public CallbackException(string message)
+ : base(message)
+ {
+ }
+ public CallbackException(string message, Exception inner)
+ : base(message, inner)
+ {
+ }
+
+#if !SILVERLIGHT
+
+ CallbackException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
+ : base(info, context)
+ {
+ }
+#endif
+ }
+
+ public static bool IsFatal(Exception exception)
+ {
+ while (exception != null)
+ {
+//#if !SILVERLIGHT
+// fatal = (exception is OutOfMemoryException && !(exception is InsufficientMemoryException))
+//#endif
+ bool fatal = exception is CallbackException ||
+ exception is ThreadAbortException ||
+ exception is AccessViolationException ||
+ exception is System.Runtime.InteropServices.SEHException;
+
+ if (fatal) return true;
+
+
+ // These exceptions aren't themselves fatal, but since the CLR uses them to wrap other exceptions,
+ // we want to check to see whether they've been used to wrap a fatal exception. If so, then they
+ // count as fatal.
+ if (exception is TypeInitializationException ||
+ exception is TargetInvocationException)
+ {
+ exception = exception.InnerException;
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ return false;
+ }
+
+
+ protected void Complete(bool completedSynchronously, Exception exception)
+ {
+ this.exception = exception;
+ this.Complete(completedSynchronously);
+ }
+
+ static class CallbackChecker
+ {
+ static readonly Dictionary<MethodInfo, Delegate> seen = new Dictionary<MethodInfo, Delegate>();
+
+ [Conditional("DEBUG")]
+ public static void Check(Delegate callback)
+ {
+ if (callback != null)
+ {
+ if (seen.ContainsKey(callback.Method))
+ {
+ if (!object.ReferenceEquals(seen[callback.Method], callback) &&
+ callback.Method.DeclaringType.Assembly == typeof(CallbackChecker).Assembly)
+ {
+ throw new InvalidOperationException("callback to " + callback.Method + " was not cached");
+ }
+ }
+ else
+ {
+ seen.Add(callback.Method, callback);
+ }
+ }
+ }
+
+ }
+ }
+
+ abstract class AsyncResult<T> : AsyncResult
+ {
+ T data;
+ public AsyncResult(AsyncCallback callback, object state)
+ : base(callback, state)
+ {
+ }
+
+ public static T End(IAsyncResult result)
+ {
+ return AsyncResult.End<AsyncResult<T>>(result).data;
+ }
+
+ protected void Complete(bool completedSynchronously, T data)
+ {
+ this.data = data;
+ base.Complete(completedSynchronously);
+ }
+ }
+}
View
122 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/CacheResponseProperty.cs
@@ -0,0 +1,122 @@
+//----------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//----------------------------------------------------------------
+namespace Microsoft.Http
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Text;
+ using System.ComponentModel;
+ using System.Globalization;
+
+ public class CacheResponseProperty
+ {
+ public int? AgeInSeconds
+ {
+ get;
+ set;
+ }
+
+
+ public string CacheControl
+ {
+ get;
+ set;
+ }
+ public DateTime? CacheSyncDate
+ {
+ get;
+ set;
+ }
+
+ public bool IsFromCache
+ {
+ get;
+ set;
+ }
+
+#if !SILVERLIGHT
+ public System.Net.Cache.HttpRequestCacheLevel? Level
+ {
+ get;
+ set;
+ }
+#endif
+
+
+ public TimeSpan? MaxAge
+ {
+ get;
+ set;
+ }
+
+ public TimeSpan? MaxStale
+ {
+ get;
+ set;
+ }
+
+ public TimeSpan? MinFresh
+ {
+ get;
+ set;
+ }
+
+
+ public string Vary
+ {
+ get;
+ set;
+ }
+
+
+ public string Via
+ {
+ get;
+ set;
+ }
+
+
+ public string Warning
+ {
+ get;
+ set;
+ }
+
+ public override string ToString()
+ {
+ return "CacheResponseProperty(" + this.IsFromCache + ", Age = " + this.AgeInSeconds + ")";
+ }
+
+#if !SILVERLIGHT
+
+ internal static CacheResponseProperty LoadFrom(System.Net.Cache.RequestCachePolicy req, HttpWebResponse response)
+ {
+ var property = new CacheResponseProperty()
+ {
+ IsFromCache = response.IsFromCache,
+ };
+
+ if (response.IsFromCache)
+ {
+ var policy = req as System.Net.Cache.HttpRequestCachePolicy;
+
+ property.CacheSyncDate = policy.CacheSyncDate;
+ property.Level = policy.Level;
+ property.MaxAge = policy.MaxAge;
+ property.MaxStale = policy.MaxStale;
+ property.MinFresh = policy.MinFresh;
+
+ property.AgeInSeconds = int.Parse(response.Headers[HttpResponseHeader.Age],CultureInfo.InvariantCulture);
+ property.CacheControl = response.Headers[HttpResponseHeader.CacheControl];
+ property.Vary = response.Headers[HttpResponseHeader.Vary];
+ property.Via = response.Headers[HttpResponseHeader.Via];
+ property.Warning = response.Headers[HttpResponseHeader.Warning];
+ }
+ return property;
+ }
+#endif
+ }
+}
View
29 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/CompletedAsyncResult.cs
@@ -0,0 +1,29 @@
+//----------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//----------------------------------------------------------------
+namespace Microsoft.Http
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using System.Threading;
+ using System.Reflection;
+ using System.Diagnostics;
+
+
+ class CompletedAsyncResult : AsyncResult
+ {
+ public CompletedAsyncResult(AsyncCallback callback, object state)
+ : base(callback, state)
+ {
+ base.Complete(true);
+ }
+
+ public static void End(IAsyncResult result)
+ {
+ Debug.Assert(result.IsCompleted);
+ AsyncResult.End<CompletedAsyncResult>(result);
+ }
+ }
+}
View
171 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/DelegatingStream.cs
@@ -0,0 +1,171 @@
+//----------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//----------------------------------------------------------------
+namespace Microsoft.Http
+{
+ using System;
+ using System.IO;
+
+ abstract class DelegatingStream : Stream
+ {
+ readonly Stream stream;
+ protected DelegatingStream(Stream stream)
+ {
+ if (stream == null)
+ {
+ throw new ArgumentNullException("stream");
+ }
+ this.stream = stream;
+ }
+
+ public override bool CanRead
+ {
+ get
+ {
+ return this.stream.CanRead;
+ }
+ }
+
+ public override bool CanSeek
+ {
+ get
+ {
+ return this.stream.CanSeek;
+ }
+ }
+
+ public override bool CanTimeout
+ {
+ get
+ {
+ return this.stream.CanTimeout;
+ }
+ }
+
+ public override bool CanWrite
+ {
+ get
+ {
+ return this.stream.CanWrite;
+ }
+ }
+
+ public override long Length
+ {
+ get
+ {
+ return this.stream.Length;
+ }
+ }
+
+ public override long Position
+ {
+ get
+ {
+ return this.stream.Position;
+ }
+ set
+ {
+ this.stream.Position = value;
+ }
+ }
+
+ public override int ReadTimeout
+ {
+ get
+ {
+ return this.stream.ReadTimeout;
+ }
+ set
+ {
+ this.stream.ReadTimeout = value;
+ }
+ }
+
+ public override int WriteTimeout
+ {
+ get
+ {
+ return this.stream.WriteTimeout;
+ }
+ set
+ {
+ this.stream.WriteTimeout = value;
+ }
+ }
+
+ public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
+ {
+ return this.stream.BeginRead(buffer, offset, count, callback, state);
+ }
+
+ public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
+ {
+ ThrowIfNotCanWrite();
+ return this.stream.BeginWrite(buffer, offset, count, callback, state);
+ }
+
+ public override void Close()
+ {
+ if (this.stream != null)
+ {
+ this.stream.Close();
+ }
+ }
+
+ public override int EndRead(IAsyncResult result)
+ {
+ return this.stream.EndRead(result);
+ }
+
+ public override void EndWrite(IAsyncResult result)
+ {
+ ThrowIfNotCanWrite();
+ this.stream.EndWrite(result);
+ }
+
+ public override void Flush()
+ {
+ this.stream.Flush();
+ }
+
+ public override int Read(byte[] buffer, int offset, int count)
+ {
+ return this.stream.Read(buffer, offset, count);
+ }
+
+ public override int ReadByte()
+ {
+ return this.stream.ReadByte();
+ }
+
+ public override long Seek(long offset, SeekOrigin origin)
+ {
+ return this.stream.Seek(offset, origin);
+ }
+
+ public override void SetLength(long value)
+ {
+ this.stream.SetLength(value);
+ }
+
+ public override void Write(byte[] buffer, int offset, int count)
+ {
+ ThrowIfNotCanWrite();
+ this.stream.Write(buffer, offset, count);
+ }
+
+ public override void WriteByte(byte value)
+ {
+ ThrowIfNotCanWrite();
+ this.stream.WriteByte(value);
+ }
+ protected void ThrowIfNotCanWrite()
+ {
+ if (!this.CanWrite)
+ {
+ throw new NotSupportedException();
+ }
+ }
+ }
+}
View
79 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/DetectEofStream.cs
@@ -0,0 +1,79 @@
+//----------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//----------------------------------------------------------------
+namespace Microsoft.Http
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using System.IO;
+
+ abstract class DetectEofStream : DelegatingStream
+ {
+ bool isAtEof;
+ protected DetectEofStream(Stream stream)
+ : base(stream)
+ {
+ }
+
+ protected bool IsAtEof
+ {
+ get
+ {
+ return this.isAtEof;
+ }
+ }
+
+ public override int EndRead(IAsyncResult result)
+ {
+ int num = base.EndRead(result);
+ if (num == 0)
+ {
+ this.ReceivedEof();
+ }
+ return num;
+ }
+
+ public override int Read(byte[] buffer, int offset, int count)
+ {
+ int num = base.Read(buffer, offset, count);
+ if (num == 0)
+ {
+ this.ReceivedEof();
+ }
+ return num;
+ }
+
+ public override int ReadByte()
+ {
+ int num;
+ if (base.CanRead)
+ {
+ num = base.ReadByte();
+ }
+ else
+ {
+ num = -1;
+ }
+ if (num == -1)
+ {
+ this.ReceivedEof();
+ }
+ return num;
+ }
+
+ protected virtual void OnReceivedEof()
+ {
+ }
+
+ void ReceivedEof()
+ {
+ if (!this.isAtEof)
+ {
+ this.isAtEof = true;
+ this.OnReceivedEof();
+ }
+ }
+ }
+}
View
40 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/DrainOnCloseStream.cs
@@ -0,0 +1,40 @@
+//----------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//----------------------------------------------------------------
+namespace Microsoft.Http
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using System.IO;
+ using System.Diagnostics;
+
+ class DrainOnCloseStream : DetectEofStream
+ {
+
+ static byte[] drain;
+ public DrainOnCloseStream(Stream innerStream)
+ : base(innerStream)
+ {
+ }
+
+ public override void Close()
+ {
+ if (!base.IsAtEof)
+ {
+ if (drain == null)
+ {
+ drain = new byte[65536];
+ }
+ byte[] buffer = drain;
+ int drained = 0;
+ while (!base.IsAtEof)
+ {
+ drained += base.Read(buffer, 0, buffer.Length);
+ }
+ }
+ base.Close();
+ }
+ }
+}
View
20 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/AcceptRangeUnit.cs
@@ -0,0 +1,20 @@
+//----------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//----------------------------------------------------------------
+
+namespace Microsoft.Http.Headers
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using System.Globalization;
+ using System.Linq;
+ using System.Text;
+
+
+ public enum AcceptRangeUnit
+ {
+ Bytes,
+ None
+ }
+}
View
57 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/AuthenticationHelper.cs
@@ -0,0 +1,57 @@
+//----------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//----------------------------------------------------------------
+
+namespace Microsoft.Http.Headers
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using System.Globalization;
+ using System.Linq;
+ using System.Text;
+
+
+ static class AuthenticationHelper
+ {
+ public static void Parse(string value, out string scheme, out Collection<string> parameters)
+ {
+ var space = value.IndexOf(' ');
+ scheme = value.Substring(0, space).Trim();
+ var remaining = value.Substring(space + 1).Trim();
+ parameters = HeaderStore.ParseMultiValue(remaining, ',');
+ }
+
+
+ public static string ToString(string scheme, Collection<string> parameters)
+ {
+ if (string.IsNullOrEmpty(scheme) && (parameters == null || parameters.Count == 0))
+ {
+ return "";
+ }
+ if (parameters == null || parameters.Count == 0)
+ {
+ return scheme;
+ }
+ return scheme + " " + string.Join(", ", parameters.ToArray());
+ }
+ public static bool TryGetParameter(Collection<string> parameters, string parameter, out string value)
+ {
+ var lookFor = parameter + "=";
+ foreach (var x in parameters)
+ {
+ if (x.StartsWithInvariant(lookFor))
+ {
+ value = x.Substring(lookFor.Length).Trim();
+ if (value.StartsWithInvariant('"') && value.EndsWithInvariant('"'))
+ {
+ value = value.Substring(1, value.Length - 2);
+ }
+ return true;
+ }
+ }
+ value = null;
+ return false;
+ }
+ }
+}
View
72 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/ByteRange.cs
@@ -0,0 +1,72 @@
+//----------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//----------------------------------------------------------------
+
+namespace Microsoft.Http.Headers
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using System.Globalization;
+ using System.Linq;
+ using System.Text;
+
+
+ public class ByteRange
+ {
+
+ public ByteRange(int from, int to)
+ {
+ this.Begin = from;
+ this.End = to;
+ }
+
+ public ByteRange(int range)
+ {
+ this.Begin = range;
+ }
+
+ public int Begin
+ {
+ get;
+ set;
+ }
+
+ public int? End
+ {
+ get;
+ set;
+ }
+ public static ByteRange Parse(string value)
+ {
+ ByteRange br;
+ string r = value.Trim();
+ int minus = r.IndexOf('-');
+ if (minus == -1 || minus == 0)
+ {
+ br = new ByteRange(ParseInt32(r));
+ }
+ else
+ {
+ var from = ParseInt32(r.Substring(0, minus));
+ var to = ParseInt32(r.Substring(minus + 1));
+ br = new ByteRange(from, to);
+ }
+ return br;
+ }
+
+ private static int ParseInt32(string r)
+ {
+ return int.Parse(r, CultureInfo.InvariantCulture);
+ }
+
+ public override string ToString()
+ {
+ if (this.End == null)
+ {
+ return this.Begin.ToStringInvariant();
+ }
+ return this.Begin + "-" + this.End;
+ }
+ }
+}
View
334 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/CacheControl.cs
@@ -0,0 +1,334 @@
+//----------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//----------------------------------------------------------------
+
+namespace Microsoft.Http.Headers
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using System.Globalization;
+ using System.Linq;
+ using System.Text;
+
+
+ public class CacheControl
+ {
+ Collection<string> extensions;
+ Collection<string> noCacheHeaders;
+ Collection<string> privateHeaders;
+
+ public Collection<string> Extensions
+ {
+ get
+ {
+ if (extensions == null)
+ {
+ extensions = new Collection<string>();
+ }
+ return extensions;
+ }
+ }
+ public TimeSpan? MaxAge
+ {
+ get;
+ set;
+ }
+
+ public bool MaxStale
+ {
+ get;
+ set;
+ }
+ public TimeSpan? MaxStaleLimit
+ {
+ get;
+ set;
+ }
+ public TimeSpan? MinFresh
+ {
+ get;
+ set;
+ }
+ public bool MustRevalidate
+ {
+ get;
+ set;
+ }
+ public bool NoCache
+ {
+ get;
+ set;
+ }
+ public Collection<string> NoCacheHeaders
+ {
+ get
+ {
+ if (noCacheHeaders == null)
+ {
+ noCacheHeaders = new Collection<string>();
+ }
+ return noCacheHeaders;
+ }
+ }
+ public bool NoStore
+ {
+ get;
+ set;
+ }
+ public bool NoTransform
+ {
+ get;
+ set;
+ }
+ public bool OnlyIfCached
+ {
+ get;
+ set;
+ }
+ public bool Private
+ {
+ get;
+ set;
+ }
+ public Collection<string> PrivateHeaders
+ {
+ get
+ {
+ if (privateHeaders == null)
+ {
+ privateHeaders = new Collection<string>();
+ }
+ return privateHeaders;
+ }
+ }
+ public bool ProxyRevalidate
+ {
+ get;
+ set;
+ }
+ public bool Public
+ {
+ get;
+ set;
+ }
+ public TimeSpan? SharedMaxAge
+ {
+ get;
+ set;
+ }
+
+ public static CacheControl Parse(string headerValue)
+ {
+ var c = new CacheControl();
+ foreach (var d in HeaderStore.ParseMultiValue(headerValue, ','))
+ {
+ var directive = d.ToUpper(CultureInfo.InvariantCulture);
+ switch (directive)
+ {
+ case "NO-CACHE":
+ c.NoCache = true;
+ continue;
+ case "NO-STORE":
+ c.NoStore = true;
+ continue;
+ case "MAX-STALE":
+ c.MaxStale = true;
+ c.MaxStaleLimit = null;
+ continue;
+ case "NO-TRANSFORM":
+ c.NoTransform = true;
+ continue;
+ case "ONLY-IF-CACHED":
+ c.OnlyIfCached = true;
+ continue;
+ case "PUBLIC":
+ c.Public = true;
+ continue;
+ case "PRIVATE":
+ c.Private = true;
+ continue;
+ case "MUST-REVALIDATE":
+ c.MustRevalidate = true;
+ continue;
+ case "PROXY-REVALIDATE":
+ c.ProxyRevalidate = true;
+ continue;
+ }
+
+ if (directive.StartsWithInvariant("no-cache"))
+ {
+ c.noCacheHeaders = LoadHeaders(d);
+ c.NoCache = true;
+ continue;
+ }
+
+ if (directive.StartsWithInvariant("max-age"))
+ {
+ c.MaxAge = GetDeltaSeconds(directive);
+ continue;
+ }
+
+ if (directive.StartsWithInvariant("max-stale"))
+ {
+ c.MaxStaleLimit = GetDeltaSeconds(directive);
+ c.MaxStale = true;
+ continue;
+ }
+
+ if (directive.StartsWithInvariant("min-fresh"))
+ {
+ c.MinFresh = GetDeltaSeconds(directive);
+ continue;
+ }
+
+ if (directive.StartsWithInvariant("private"))
+ {
+ c.privateHeaders = LoadHeaders(d);
+ c.Private = true;
+ continue;
+ }
+
+ if (directive.StartsWithInvariant("s-maxage"))
+ {
+ c.SharedMaxAge = GetDeltaSeconds(directive);
+ continue;
+ }
+
+ c.Extensions.Add(d);
+ }
+ return c;
+ }
+
+
+ public override string ToString()
+ {
+ List<string> x = new List<string>();
+ //"no-cache"
+ //"no-cache" [ "=" <"> 1#field-name <">
+ if (this.NoCache)
+ {
+ x.Add(Make("no-cache", noCacheHeaders));
+ }
+ //"no-store"
+ if (this.NoStore)
+ {
+ x.Add("no-store");
+ }
+
+ //"max-age" "=" delta-seconds
+ if (this.MaxAge.HasValue)
+ {
+ x.Add(Make("max-age", this.MaxAge.Value));
+ }
+ //"max-stale" [ "=" delta-seconds ]
+ if (this.MaxStale)
+ {
+ if (this.MaxStaleLimit.HasValue)
+ {
+ x.Add(Make("max-stale", this.MaxStaleLimit.Value));
+ }
+ else
+ {
+ x.Add("max-stale");
+ }
+ }
+ //"min-fresh" "=" delta-seconds
+ if (this.MinFresh.HasValue)
+ {
+ x.Add(Make("min-fresh", this.MinFresh.Value));
+ }
+ //"must-revalidate"
+ if (this.MustRevalidate)
+ {
+ x.Add("must-revalidate");
+ }
+ //"no-transform"
+ if (this.NoTransform)
+ {
+ x.Add("no-transform");
+ }
+ //"only-if-cached"
+ if (this.OnlyIfCached)
+ {
+ x.Add("only-if-cached");
+ }
+ //"private" [ "=" <"> 1#field-name <"> ]
+ if (this.Private)
+ {
+ x.Add(Make("private", privateHeaders));
+ }
+ //"proxy-revalidate"
+ if (this.ProxyRevalidate)
+ {
+ x.Add("proxy-revalidate");
+ }
+ //"public"
+ if (this.Public)
+ {
+ x.Add("public");
+ }
+ if (this.SharedMaxAge.HasValue)
+ {
+ x.Add(Make("s-maxage", this.SharedMaxAge.Value));
+ }
+
+ //cache-extension
+ if (this.extensions != null)
+ {
+ foreach (var e in this.extensions)
+ {
+ x.Add(e);
+ }
+ }
+
+ return string.Join(", ", x.ToArray());
+ }
+ static TimeSpan GetDeltaSeconds(string directive)
+ {
+ var t = directive.Split('=').Last().Trim();
+ return TimeSpan.FromSeconds(int.Parse(t, CultureInfo.InvariantCulture));
+ }
+
+ static Collection<string> LoadHeaders(string s)
+ {
+ s = s.Substring(s.IndexOf('=') + 1).Trim();
+ if (s.StartsWithInvariant("\""))
+ {
+ s = s.Substring(1).Trim();
+ }
+ if (s.EndsWithInvariant("\""))
+ {
+ s = s.Substring(0, s.Length - 1);
+ }
+
+ return HeaderStore.ParseMultiValue(s, ',');
+ }
+
+ static string Make(string prefix, TimeSpan delta)
+ {
+ if (delta == null)
+ {
+ return prefix;
+ }
+ return prefix + "=" + HeaderFormatter.Default.ToString(delta);
+ }
+
+ static string Make(string prefix, Collection<string> fields)
+ {
+ if (fields == null || fields.Count == 0)
+ {
+ return prefix;
+ }
+
+ StringBuilder sb = new StringBuilder();
+ sb.Append(prefix);
+ sb.Append('=');
+ sb.Append('"');
+ sb.Append(string.Join(", ", fields.ToArray()));
+ sb.Append('"');
+
+ return sb.ToString();
+ }
+ }
+}
View
71 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/Challenge.cs
@@ -0,0 +1,71 @@
+//----------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//----------------------------------------------------------------
+
+namespace Microsoft.Http.Headers
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using System.Globalization;
+ using System.Linq;
+ using System.Text;
+
+
+ public class Challenge
+ {
+ Collection<string> parameters;
+ public Collection<string> Parameters
+ {
+ get
+ {
+ if (parameters == null)
+ {
+ parameters = new Collection<string>();
+ }
+ return parameters;
+ }
+ private set
+ {
+ this.parameters = value;
+ }
+ }
+ public string Scheme
+ {
+ get;
+ set;
+ }
+ public static Challenge Parse(string value)
+ {
+ string scheme;
+ Collection<string> parameters;
+ AuthenticationHelper.Parse(value, out scheme, out parameters);
+
+ return new Challenge()
+ {
+ Scheme = scheme,
+ Parameters = parameters
+ };
+ }
+
+ public string GetParameter(string parameter)
+ {
+ string value;
+ if (!TryGetParameter(parameter, out value))
+ {
+ throw new KeyNotFoundException(parameter);
+ }
+ return value;
+ }
+
+ public override string ToString()
+ {
+ return AuthenticationHelper.ToString(this.Scheme, this.parameters);
+ }
+
+ public bool TryGetParameter(string parameter, out string value)
+ {
+ return AuthenticationHelper.TryGetParameter(this.Parameters, parameter, out value);
+ }
+ }
+}
View
81 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/Connection.cs
@@ -0,0 +1,81 @@
+//----------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//----------------------------------------------------------------
+
+namespace Microsoft.Http.Headers
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using System.Globalization;
+ using System.Linq;
+ using System.Text;
+
+
+ public class Connection
+ {
+ Collection<string> headers;
+
+ public Connection()
+ {
+ }
+ public bool Close
+ {
+ get;
+ set;
+ }
+ public Collection<string> Headers
+ {
+ get
+ {
+ if (headers == null)
+ {
+ headers = new Collection<string>();
+ }
+ return headers;
+ }
+ }
+
+ public static Connection Parse(string value)
+ {
+ var c = new Connection();
+ foreach (var h in value.Split(','))
+ {
+ var t = h.Trim();
+ if (string.IsNullOrEmpty(t))
+ {
+ continue;
+ }
+
+ if (h.Equals("close", StringComparison.OrdinalIgnoreCase))
+ {
+ c.Close = true;
+ continue;
+ }
+
+ c.Headers.Add(t);
+ }
+
+ return c;
+ }
+
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ if (Close)
+ {
+ sb.Append("close");
+ }
+
+ foreach (var s in this.Headers)
+ {
+ if (sb.Length != 0)
+ {
+ sb.Append(", ");
+ }
+ sb.Append(s);
+ }
+ return sb.ToString();
+ }
+ }
+}
View
21 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/ContentCoding.cs
@@ -0,0 +1,21 @@
+//----------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//----------------------------------------------------------------
+
+namespace Microsoft.Http.Headers
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using System.Globalization;
+ using System.Linq;
+ using System.Text;
+
+ public enum ContentCoding
+ {
+ GZip,
+ Compress,
+ Deflate,
+ Identity
+ }
+}
View
118 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/ContentRange.cs
@@ -0,0 +1,118 @@
+//----------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//----------------------------------------------------------------
+
+namespace Microsoft.Http.Headers
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using System.Globalization;
+ using System.Linq;
+ using System.Text;
+
+
+ public class ContentRange
+ {
+ public int? FirstBytePosition
+ {
+ get;
+ set;
+ }
+
+ public int? LastBytePosition
+ {
+ get;
+ set;
+ }
+
+ public int? Length
+ {
+ get;
+ set;
+ }
+
+ public bool LengthIsStar
+ {
+ get;
+ set;
+ }
+
+ public bool RangeIsStar
+ {
+ get;
+ set;
+ }
+
+ public static ContentRange Parse(string value)
+ {
+ if (!value.StartsWithInvariant("bytes "))
+ {
+ throw new FormatException();
+ }
+ value = value.Substring(6);
+ var parts = value.Split('-', '/');
+ if (parts.Length <= 1 || parts.Length > 3)
+ {
+ throw new FormatException(value);
+ }
+ var r = new ContentRange();
+ if (parts.Length == 2)
+ {
+ if (parts[0] != "*")
+ {
+ throw new FormatException(parts[0]);
+ }
+ r.RangeIsStar = true;
+ }
+ else
+ {
+ r.FirstBytePosition = int.Parse(parts[0], CultureInfo.InvariantCulture);
+ r.LastBytePosition = int.Parse(parts[1], CultureInfo.InvariantCulture);
+ }
+
+ if (parts.Last() == "*")
+ {
+ r.LengthIsStar = true;
+ }
+ else
+ {
+ r.Length = int.Parse(parts.Last(), CultureInfo.InvariantCulture);
+ }
+ return r;
+ }
+
+ public override string ToString()
+ {
+ bool hasValues = this.RangeIsStar || this.LengthIsStar || this.FirstBytePosition.HasValue || this.LastBytePosition.HasValue || this.Length.HasValue;
+
+ if (!hasValues)
+ {
+ return "";
+ }
+
+ StringBuilder b = new StringBuilder();
+ b.Append("bytes ");
+ if (this.RangeIsStar)
+ {
+ b.Append('*');
+ }
+ else
+ {
+ b.Append(this.FirstBytePosition);
+ b.Append("-");
+ b.Append(this.LastBytePosition);
+ }
+ b.Append('/');
+ if (this.LengthIsStar)
+ {
+ b.Append('*');
+ }
+ else
+ {
+ b.Append(this.Length);
+ }
+ return b.ToString();
+ }
+ }
+}
View
151 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/Cookie.cs
@@ -0,0 +1,151 @@
+//----------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//----------------------------------------------------------------
+
+namespace Microsoft.Http.Headers
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using System.Globalization;
+ using System.Linq;
+ using System.Text;
+
+ public class Cookie // : Dictionary<string, string>
+ {
+ static readonly string AttributeOnly = Guid.NewGuid().ToString();
+ readonly Dictionary<string, string> dict = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
+ public Cookie()
+ {
+ }
+
+ public DateTime? Expires
+ {
+ get
+ {
+ if (!dict.ContainsKey("Expires"))
+ {
+ return null;
+ }
+
+ return HeaderFormatter.Default.FromString<DateTime>(dict["expires"]);
+ }
+ set
+ {
+ if (value == null)
+ {
+ dict.Remove("Expires");
+ }
+ else
+ {
+ dict["expires"] = HeaderFormatter.Default.ToString(value.Value);
+ }
+ }
+ }
+
+ public string Path
+ {
+ get
+ {
+ if (!dict.ContainsKey("path"))
+ {
+ return null;
+ }
+ return dict["path"];
+ }
+ set
+ {
+ dict["path"] = value;
+ }
+ }
+
+ public static Cookie Parse(string value)
+ {
+ var cookie = new Cookie();
+ foreach (var pair in HeaderStore.ParseMultiValue(value, ';'))
+ {
+ var eq = pair.IndexOf('=');
+ if (eq == -1)
+ {
+ cookie.Add(pair, Cookie.AttributeOnly);
+ continue;
+ }
+
+ cookie.Add(pair.Substring(0, eq).Trim(), pair.Substring(eq + 1).Trim());
+ }
+
+ return cookie;
+ }
+
+ public void Add(string key, string value)
+ {
+ dict.Add(key, value);
+ }
+
+ public void Add(string attributeName)
+ {
+ dict.Add(attributeName, Cookie.AttributeOnly);
+ }
+
+ // not there == exception, attribute = null, value = value
+ public string this[string key]
+ {
+ get
+ {
+ var v = dict[key];
+ if (v == AttributeOnly)
+ {
+ return null;
+ }
+ return v;
+ }
+
+ set
+ {
+ if (value == null)
+ {
+ throw new ArgumentNullException("value");
+ }
+ dict[key] = value;
+ }
+ }
+
+ public bool HasAttribute(string key)
+ {
+ return ContainsKey(key) && this[key] == null;
+ }
+
+ public bool ContainsKey(string key)
+ {
+ return dict.ContainsKey(key);
+ }
+
+ public override string ToString()
+ {
+ if (dict.Count == 0)
+ {
+ return "";
+ }
+
+ StringBuilder sb = new StringBuilder();
+ foreach (var pair in dict)
+ {
+ if (string.IsNullOrEmpty(pair.Value))
+ {
+ continue;
+ }
+ if (sb.Length != 0)
+ {
+ sb.Append("; ");
+ }
+ if (pair.Value == Cookie.AttributeOnly)
+ {
+ sb.Append(pair.Key);
+ continue;
+ }
+ sb.AppendFormat("{0}={1}", pair.Key, pair.Value);
+ }
+ return sb.ToString();
+ }
+ }
+}
View
95 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/Credential.cs
@@ -0,0 +1,95 @@
+//----------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//----------------------------------------------------------------
+
+namespace Microsoft.Http.Headers
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using System.Globalization;
+ using System.Linq;
+ using System.Text;
+
+ public class Credential
+ {
+ public static Credential CreateBasic(string user, string password)
+ {
+ Encoding enc;
+#if SILVERLIGHT
+ enc = Encoding.UTF8;
+#else
+ enc = Encoding.Default;
+#endif
+
+ return new Credential("Basic", Convert.ToBase64String(enc.GetBytes(user + ":" + password)));
+ }
+ public Credential()
+ {
+ }
+
+ public Credential(string scheme, params string[] parameters)
+ {
+ this.Scheme = scheme;
+ foreach (var p in parameters)
+ {
+ this.Parameters.Add(p);
+ }
+ }
+
+ Collection<string> parameters;
+ public Collection<string> Parameters
+ {
+ get
+ {
+ if (parameters == null)
+ {
+ parameters = new Collection<string>();
+ }
+ return parameters;
+ }
+ private set
+ {
+ parameters = value;
+ }
+ }
+ public string Scheme
+ {
+ get;
+ set;
+ }
+
+ public static Credential Parse(string value)
+ {
+ string scheme;
+ Collection<string> parameters;
+ AuthenticationHelper.Parse(value, out scheme, out parameters);
+
+ return new Credential()
+ {
+ Scheme = scheme,
+ Parameters = parameters,
+ };
+ }
+
+ public string GetParameter(string parameter)
+ {
+ string value;
+ if (!TryGetParameter(parameter, out value))
+ {
+ throw new KeyNotFoundException(parameter);
+ }
+ return value;
+ }
+
+ public override string ToString()
+ {
+ return AuthenticationHelper.ToString(this.Scheme, this.parameters);
+ }
+
+ public bool TryGetParameter(string parameter, out string value)
+ {
+ return AuthenticationHelper.TryGetParameter(this.Parameters, parameter, out value);
+ }
+ }
+}
View
80 NooSphere/Libs/MonoDroid.System.Net.Http/REST Client Lib/Headers/DateOrDeltaSeconds.cs
@@ -0,0 +1,80 @@
+//----------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//----------------------------------------------------------------
+
+namespace Microsoft.Http.Headers
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using System.Globalization;
+ using System.Linq;
+ using System.Text;
+
+
+ public class DateOrDeltaSeconds
+ {
+ static readonly HeaderFormatter formatter = HeaderFormatter.Default;
+
+ public DateOrDeltaSeconds(TimeSpan delta)
+ {
+ this.Delta = delta;
+ }
+