@@ -17,7 +17,7 @@ class RemoteServer {
1717
1818 private RequestMethod _request_method ;
1919 private string _request_uri ;
20- private JsonWriter _request_data ;
20+ private JSON _request_data ;
2121 private NetworkCredential _credentials = null ;
2222
2323
@@ -84,10 +84,10 @@ public Dictionary Send(RequestMethod method, string relativeUri) {
8484 /// <returns></returns>
8585 public Dictionary Send ( RequestMethod method , string relativeUri , Dictionary param ) {
8686 //Serialise the parameters
87- JsonWriter data = null ;
87+ JSON data = null ;
8888 if ( method == RequestMethod . POST ) {
8989 if ( param != null ) {
90- data = JsonWriter . Serialize ( param ) ;
90+ data = JSON . Serialize ( param ) ;
9191 }
9292 }
9393
@@ -107,12 +107,12 @@ public Dictionary SendAgain() {
107107 return SendRequest ( _request_method , _request_uri , _request_data ) ;
108108 }
109109
110- protected Dictionary SendRequest ( RequestMethod method , string uri , JsonWriter data ) {
110+ protected Dictionary SendRequest ( RequestMethod method , string uri , JSON data ) {
111111 _request_method = method ;
112112 _request_uri = uri ;
113113 _request_data = data ;
114114
115- HttpWebRequest request = CreateHttpWebRequest ( method , uri , data , _response_timeout ) ;
115+ HttpWebRequest request = CreateHttpWebRequest ( method , uri , data ) ;
116116 SysWaiter . OnInterrupt = request . Abort ;
117117 HttpWebResponse response = null ;
118118 Dictionary responseDict = null ;
@@ -164,12 +164,10 @@ protected Dictionary SendRequest(RequestMethod method, string uri, JsonWriter da
164164 return responseDict ;
165165 }
166166
167- private HttpWebRequest CreateHttpWebRequest ( RequestMethod method
168- , string url , JsonWriter data , int timeout ) {
167+ private HttpWebRequest CreateHttpWebRequest ( RequestMethod method , string url , JSON data ) {
169168
170169 HttpWebRequest request = ( HttpWebRequest ) HttpWebRequest . CreateDefault ( new Uri ( url ) ) ;
171170 request . Method = FormatRequestMethod ( method ) ;
172- request . Timeout = timeout ;
173171 request . Accept = HEADER_ACCEPT ;
174172 request . KeepAlive = true ;
175173
@@ -182,7 +180,7 @@ private HttpWebRequest CreateHttpWebRequest(RequestMethod method
182180 request . ContentType = HEADER_CONTENT_TYPE ;
183181 request . ContentLength = data . Length ;
184182 using ( Stream rstream = request . GetRequestStream ( ) ) {
185- data . CopyTo ( rstream ) ;
183+ rstream . Write ( data . GetBuffer ( ) , 0 , ( int ) data . Length ) ;
186184 }
187185 } else {
188186 request . ContentLength = 0 ;
@@ -195,7 +193,7 @@ private static Dictionary GetHttpWebResponseContent(HttpWebResponse response) {
195193 return null ;
196194 using ( Stream stream = response . GetResponseStream ( ) ) {
197195 if ( IsJsonResponse ( response ) ) {
198- Dictionary dict = ( Dictionary ) JsonReader . Deserialize ( stream ) ;
196+ Dictionary dict = ( Dictionary ) JSON . Parse ( stream ) ;
199197 return dict ;
200198 } else {
201199 string bodyText = new StreamReader ( stream ) . ReadToEnd ( ) ;
0 commit comments