My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 10 attachment: ProxySupport.patch (3.3 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
87
88
89
90
91
92
93
94
95
96
Index: Core/IGeoCoder.cs
===================================================================
--- Core/IGeoCoder.cs (revision 84)
+++ Core/IGeoCoder.cs (working copy)
@@ -1,10 +1,12 @@
using System;
using System.Collections.Generic;
+using System.Net;

namespace GeoCoding
{
public interface IGeoCoder
{
+ WebProxy Proxy { get; set; }
IEnumerable<Address> GeoCode(string address);
IEnumerable<Address> GeoCode(string street, string city, string state, string postalCode, string country);
}
Index: Google/GoogleGeoCoder.cs
===================================================================
--- Google/GoogleGeoCoder.cs (revision 84)
+++ Google/GoogleGeoCoder.cs (working copy)
@@ -20,7 +20,9 @@
get { return (UseSsl ? "https:" : "http:") + "//maps.googleapis.com/maps/api/geocode/xml?address={0}&sensor=false"; }
}

- public IEnumerable<GoogleAddress> GeoCode(string address)
+ public WebProxy Proxy { get; set; }
+
+ public IEnumerable<GoogleAddress> GeoCode(string address)
{
if (String.IsNullOrEmpty(address))
throw new ArgumentNullException("address");
@@ -60,6 +62,7 @@
{
string url = String.Format(ServiceUrl, HttpUtility.UrlEncode(address));
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
+ req.Proxy = Proxy;
req.Method = "GET";
return req;
}
Index: Microsoft/BingMapsGeocoder.cs
===================================================================
--- Microsoft/BingMapsGeocoder.cs (revision 84)
+++ Microsoft/BingMapsGeocoder.cs (working copy)
@@ -28,7 +28,9 @@
this.bingKey = bingKey;
}

- public IEnumerable<BingAddress> GeoCode(string address)
+ public WebProxy Proxy { get; set; }
+
+ public IEnumerable<BingAddress> GeoCode(string address)
{
try
{
@@ -112,6 +114,7 @@
private Json.Response GetResponse(string queryURL)
{
HttpWebRequest request = WebRequest.Create(queryURL) as HttpWebRequest;
+ request.Proxy = Proxy;
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(Json.Response));
Index: Yahoo/YahooGeoCoder.cs
===================================================================
--- Yahoo/YahooGeoCoder.cs (revision 84)
+++ Yahoo/YahooGeoCoder.cs (working copy)
@@ -31,7 +31,9 @@
this.appId = appId;
}

- public IEnumerable<YahooAddress> GeoCode(string address)
+ public WebProxy Proxy { get; set; }
+
+ public IEnumerable<YahooAddress> GeoCode(string address)
{
if (String.IsNullOrEmpty(address))
throw new ArgumentNullException("address");
@@ -86,6 +88,7 @@
{
string url = String.Format(ServiceUrl, HttpUtility.UrlEncode(address), appId);
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
+ req.Proxy = Proxy;
req.Method = "GET";
return req;
}
@@ -94,7 +97,8 @@
{
string url = String.Format(ServiceUrlNormal, HttpUtility.UrlEncode(street), HttpUtility.UrlEncode(city), HttpUtility.UrlEncode(state), HttpUtility.UrlEncode(postalCode), HttpUtility.UrlEncode(country), appId);
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
- req.Method = "GET";
+ req.Proxy = Proxy;
+ req.Method = "GET";
return req;
}

Powered by Google Project Hosting