forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPclExportClient.Net40.cs
More file actions
86 lines (71 loc) · 2.23 KB
/
Copy pathPclExportClient.Net40.cs
File metadata and controls
86 lines (71 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//Copyright (c) Service Stack LLC. All Rights Reserved.
//License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt
#if !(XBOX || SL5 || NETFX_CORE || WP || PCL)
using System;
using System.Collections.Specialized;
using System.Threading;
using System.Web;
using ServiceStack;
using ServiceStack.Web;
namespace ServiceStack
{
public class Net40PclExportClient : PclExportClient
{
public static Net40PclExportClient Provider = new Net40PclExportClient();
public static PclExportClient Configure()
{
Configure(Provider);
Net40PclExport.Configure();
return Provider;
}
public override INameValueCollection NewNameValueCollection()
{
return new NameValueCollectionWrapper(new NameValueCollection());
}
public override INameValueCollection ParseQueryString(string query)
{
return HttpUtility.ParseQueryString(query).InWrapper();
}
public override string UrlEncode(string url)
{
return HttpUtility.UrlEncode(url);
}
public override string UrlDecode(string url)
{
return HttpUtility.UrlDecode(url);
}
public override string HtmlEncode(string html)
{
return HttpUtility.HtmlEncode(html);
}
public override string HtmlDecode(string html)
{
return HttpUtility.HtmlDecode(html);
}
public override ITimer CreateTimer<TResponse>(AsyncState<TResponse> state, TimeSpan timeOut)
{
return new AsyncTimer(new
System.Threading.Timer(state.TimedOut, state, (int)timeOut.TotalMilliseconds, Timeout.Infinite));
}
}
public class AsyncTimer : ITimer
{
public System.Threading.Timer Timer;
public AsyncTimer(System.Threading.Timer timer)
{
Timer = timer;
}
public void Cancel()
{
this.Timer.Change(Timeout.Infinite, Timeout.Infinite);
this.Dispose();
}
public void Dispose()
{
if (Timer == null) return;
this.Timer.Dispose();
this.Timer = null;
}
}
}
#endif