diff --git a/src/Discord.Net.Net45/Discord.Net.csproj b/src/Discord.Net.Net45/Discord.Net.csproj index 97a65a89a..e2d76b727 100644 --- a/src/Discord.Net.Net45/Discord.Net.csproj +++ b/src/Discord.Net.Net45/Discord.Net.csproj @@ -165,20 +165,20 @@ Net\API\Responses.cs - - Net\HttpException.cs + + Net\API\RestClient.BuiltIn.cs - - Net\RestClient.BuiltIn.cs + + Net\API\RestClient.cs - - Net\RestClient.cs + + Net\API\RestClient.Events.cs - - Net\RestClient.Events.cs + + Net\API\RestClient.SharpRest.cs - - Net\RestClient.SharpRest.cs + + Net\HttpException.cs Net\WebSockets\Commands.cs diff --git a/src/Discord.Net/Net/RestClient.BuiltIn.cs b/src/Discord.Net/Net/API/RestClient.BuiltIn.cs similarity index 97% rename from src/Discord.Net/Net/RestClient.BuiltIn.cs rename to src/Discord.Net/Net/API/RestClient.BuiltIn.cs index 6d538b2b5..f6b2cb3ae 100644 --- a/src/Discord.Net/Net/RestClient.BuiltIn.cs +++ b/src/Discord.Net/Net/API/RestClient.BuiltIn.cs @@ -1,5 +1,4 @@ #if DNXCORE50 -using Discord.Net.API; using System; using System.Globalization; using System.IO; @@ -9,7 +8,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -namespace Discord.Net +namespace Discord.Net.API { internal class BuiltInRestEngine : IRestEngine { diff --git a/src/Discord.Net/Net/RestClient.Events.cs b/src/Discord.Net/Net/API/RestClient.Events.cs similarity index 96% rename from src/Discord.Net/Net/RestClient.Events.cs rename to src/Discord.Net/Net/API/RestClient.Events.cs index 85c4d02a1..2f3fa3945 100644 --- a/src/Discord.Net/Net/RestClient.Events.cs +++ b/src/Discord.Net/Net/API/RestClient.Events.cs @@ -1,7 +1,7 @@ using System; using System.Net.Http; -namespace Discord.Net +namespace Discord.Net.API { internal partial class RestClient { diff --git a/src/Discord.Net/Net/RestClient.SharpRest.cs b/src/Discord.Net/Net/API/RestClient.SharpRest.cs similarity index 93% rename from src/Discord.Net/Net/RestClient.SharpRest.cs rename to src/Discord.Net/Net/API/RestClient.SharpRest.cs index a8733ae87..f14d575e8 100644 --- a/src/Discord.Net/Net/RestClient.SharpRest.cs +++ b/src/Discord.Net/Net/API/RestClient.SharpRest.cs @@ -1,5 +1,4 @@ #if !DNXCORE50 -using Discord.Net.API; using RestSharp; using System; using System.IO; @@ -7,13 +6,13 @@ using System.Net.Http; using System.Threading; using System.Threading.Tasks; -namespace Discord.Net +namespace Discord.Net.API { - internal class SharpRestEngine : IRestEngine + internal class RestSharpRestEngine : IRestEngine { private readonly RestSharp.RestClient _client; - public SharpRestEngine(string userAgent) + public RestSharpRestEngine(string userAgent) { _client = new RestSharp.RestClient(Endpoints.BaseApi) { diff --git a/src/Discord.Net/Net/RestClient.cs b/src/Discord.Net/Net/API/RestClient.cs similarity index 98% rename from src/Discord.Net/Net/RestClient.cs rename to src/Discord.Net/Net/API/RestClient.cs index f7dafa985..f3e64a3b1 100644 --- a/src/Discord.Net/Net/RestClient.cs +++ b/src/Discord.Net/Net/API/RestClient.cs @@ -1,5 +1,4 @@ -using Discord.Net.API; -using Newtonsoft.Json; +using Newtonsoft.Json; using System; using System.Diagnostics; using System.Net.Http; @@ -7,7 +6,7 @@ using System.Reflection; using System.Threading; using System.Threading.Tasks; -namespace Discord.Net +namespace Discord.Net.API { internal interface IRestEngine { @@ -31,7 +30,7 @@ namespace Discord.Net #if DNXCORE50 _engine = new BuiltInRestEngine(userAgent); #else - _engine = new SharpRestEngine(userAgent); + _engine = new RestSharpRestEngine(userAgent); #endif } diff --git a/src/Discord.Net/project.json b/src/Discord.Net/project.json index edbc886fb..d04d7c73c 100644 --- a/src/Discord.Net/project.json +++ b/src/Discord.Net/project.json @@ -27,14 +27,18 @@ "frameworks": { "net45": { "dependencies": { - "Microsoft.Net.Http": "2.2.29", "RestSharp": "105.2.3" + }, + "frameworkAssemblies": { + "System.Net.Http": "4.0.0.0" } }, "dnx451": { "dependencies": { - "Microsoft.Net.Http": "2.2.29", "RestSharp": "105.2.3" + }, + "frameworkAssemblies": { + "System.Net.Http": "4.0.0.0" } }, "dnxcore50": { diff --git a/test/Discord.Net.Tests/Discord.Net.Tests.csproj b/test/Discord.Net.Tests/Discord.Net.Tests.csproj index 536d853bd..a4e5ea574 100644 --- a/test/Discord.Net.Tests/Discord.Net.Tests.csproj +++ b/test/Discord.Net.Tests/Discord.Net.Tests.csproj @@ -62,6 +62,12 @@ + + + {8d71a857-879a-4a10-859e-5ff824ed6688} + Discord.Net + + diff --git a/test/Discord.Net.Tests/Tests.cs b/test/Discord.Net.Tests/Tests.cs index c87add1bc..7a673431b 100644 --- a/test/Discord.Net.Tests/Tests.cs +++ b/test/Discord.Net.Tests/Tests.cs @@ -110,9 +110,9 @@ namespace Discord.Net.Tests public static void Cleanup() { WaitMany( - _hostClient.IsConnected ? _hostClient.Servers.Select(x => _hostClient.LeaveServer(x)) : null, - _targetBot.IsConnected ? _targetBot.Servers.Select(x => _targetBot.LeaveServer(x)) : null, - _observerBot.IsConnected ? _observerBot.Servers.Select(x => _observerBot.LeaveServer(x)) : null); + _hostClient.State == DiscordClientState.Connected ? _hostClient.Servers.Select(x => _hostClient.LeaveServer(x)) : null, + _targetBot.State == DiscordClientState.Connected ? _targetBot.Servers.Select(x => _targetBot.LeaveServer(x)) : null, + _observerBot.State == DiscordClientState.Connected ? _observerBot.Servers.Select(x => _observerBot.LeaveServer(x)) : null); WaitAll( _hostClient.Disconnect(),