Permalink
Browse files

Update

  • Loading branch information...
1 parent d4bd238 commit d0b0dc1670a12dfa0feff49a0d2f99af106089bf Steven Houben committed Aug 24, 2012
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
@@ -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);
+ }
+ }
+ }
+}
@@ -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;
+ }
+
+
+ }
+}
@@ -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)
+ {
+ }
+ }
+}
Oops, something went wrong.

0 comments on commit d0b0dc1

Please sign in to comment.