1
0
mirror of https://github.com/JKorf/CryptoExchange.Net.git synced 2026-08-12 00:43:03 +00:00

Initial commit

This commit is contained in:
JKorf
2018-02-28 13:53:29 +01:00
parent e2af98f2c9
commit 2bf860947a
23 changed files with 837 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
using System;
using System.Net;
using CryptoExchange.Net.Interfaces;
namespace CryptoExchange.Net.Requests
{
public class Request : IRequest
{
private readonly WebRequest request;
public Request(WebRequest request)
{
this.request = request;
}
public WebHeaderCollection Headers
{
get => request.Headers;
set => request.Headers = value;
}
public string Method
{
get => request.Method;
set => request.Method = value;
}
public Uri Uri
{
get => request.RequestUri;
}
public void SetProxy(string host, int port)
{
request.Proxy = new WebProxy(host, port); ;
}
public IResponse GetResponse()
{
return new Response(request.GetResponse());
}
}
}
+13
View File
@@ -0,0 +1,13 @@
using System.Net;
using CryptoExchange.Net.Interfaces;
namespace CryptoExchange.Net.Requests
{
public class RequestFactory : IRequestFactory
{
public IRequest Create(string uri)
{
return new Request(WebRequest.Create(uri));
}
}
}
+21
View File
@@ -0,0 +1,21 @@
using System.IO;
using System.Net;
using CryptoExchange.Net.Interfaces;
namespace CryptoExchange.Net.Requests
{
public class Response : IResponse
{
private readonly WebResponse response;
public Response(WebResponse response)
{
this.response = response;
}
public Stream GetResponseStream()
{
return response.GetResponseStream();
}
}
}