THE CURRENT YEAR (but still .net 4.0)
This commit is contained in:
parent
bf61e6f6d8
commit
e135ad7159
4 changed files with 59 additions and 2 deletions
|
@ -39,6 +39,27 @@
|
||||||
<HintPath>$(SolutionDir)\packages\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
|
<HintPath>$(SolutionDir)\packages\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.IO, Version=2.6.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\packages\Microsoft.Bcl.1.1.10\lib\net40\System.IO.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Net.Http, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net40\System.Net.Http.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net40\System.Net.Http.Extensions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Net.Http.Primitives, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net40\System.Net.Http.Primitives.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Net.Http.WebRequest, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net40\System.Net.Http.WebRequest.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Runtime, Version=2.6.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\packages\Microsoft.Bcl.1.1.10\lib\net40\System.Runtime.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Threading.Tasks, Version=2.6.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\packages\Microsoft.Bcl.1.1.10\lib\net40\System.Threading.Tasks.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="websocket-sharp, Version=1.0.2.59611, Culture=neutral, PublicKeyToken=5660b08a1845a91e, processorArchitecture=MSIL">
|
<Reference Include="websocket-sharp, Version=1.0.2.59611, Culture=neutral, PublicKeyToken=5660b08a1845a91e, processorArchitecture=MSIL">
|
||||||
<HintPath>$(SolutionDir)\packages\WebSocketSharp.1.0.3-rc11\lib\websocket-sharp.dll</HintPath>
|
<HintPath>$(SolutionDir)\packages\WebSocketSharp.1.0.3-rc11\lib\websocket-sharp.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
@ -125,7 +146,13 @@
|
||||||
<Compile Include="Utility.cs" />
|
<Compile Include="Utility.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Include="app.config" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
|
||||||
|
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
|
||||||
|
<Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
|
||||||
|
<Error Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
|
||||||
|
</Target>
|
||||||
</Project>
|
</Project>
|
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
|
@ -18,6 +19,8 @@ namespace Maki.Rest
|
||||||
|
|
||||||
private const long BUFFER_SIZE = 8192000;
|
private const long BUFFER_SIZE = 8192000;
|
||||||
|
|
||||||
|
private static HttpClient HttpClient;
|
||||||
|
|
||||||
public readonly HttpMethod Method;
|
public readonly HttpMethod Method;
|
||||||
public readonly string Url;
|
public readonly string Url;
|
||||||
|
|
||||||
|
@ -91,7 +94,21 @@ namespace Maki.Rest
|
||||||
|
|
||||||
static WebRequest()
|
static WebRequest()
|
||||||
{
|
{
|
||||||
ServicePointManager.Expect100Continue = false;
|
CreateHttpClientInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CreateHttpClientInstance()
|
||||||
|
{
|
||||||
|
HttpClient?.Dispose();
|
||||||
|
|
||||||
|
HttpClient = new HttpClient(new HttpClientHandler
|
||||||
|
{
|
||||||
|
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
|
||||||
|
});
|
||||||
|
|
||||||
|
HttpClient.DefaultRequestHeaders.UserAgent.ParseAdd(USER_AGENT);
|
||||||
|
HttpClient.DefaultRequestHeaders.ExpectContinue = true;
|
||||||
|
HttpClient.Timeout = new TimeSpan(0, 0, 0, 0, Timeout.Infinite);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WebRequest(HttpMethod method, string url)
|
public WebRequest(HttpMethod method, string url)
|
||||||
|
@ -147,7 +164,6 @@ namespace Maki.Rest
|
||||||
HttpWebRequest.Method = Method.ToString();
|
HttpWebRequest.Method = Method.ToString();
|
||||||
HttpWebRequest.UserAgent = UserAgent;
|
HttpWebRequest.UserAgent = UserAgent;
|
||||||
HttpWebRequest.KeepAlive = true;
|
HttpWebRequest.KeepAlive = true;
|
||||||
//wRequest.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip;
|
|
||||||
HttpWebRequest.ReadWriteTimeout = Timeout.Infinite;
|
HttpWebRequest.ReadWriteTimeout = Timeout.Infinite;
|
||||||
HttpWebRequest.Timeout = Timeout.Infinite;
|
HttpWebRequest.Timeout = Timeout.Infinite;
|
||||||
|
|
||||||
|
|
11
Maki/app.config
Normal file
11
Maki/app.config
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.2.29.0" newVersion="2.2.29.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
|
</configuration>
|
|
@ -1,5 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
|
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net40" />
|
||||||
|
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net40" />
|
||||||
|
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net40" />
|
||||||
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net40" />
|
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net40" />
|
||||||
<package id="WebSocketSharp" version="1.0.3-rc11" targetFramework="net40" />
|
<package id="WebSocketSharp" version="1.0.3-rc11" targetFramework="net40" />
|
||||||
</packages>
|
</packages>
|
Reference in a new issue