Changed preprocessor conditions for new monikers and updated packages.
This commit is contained in:
@@ -19,7 +19,6 @@
|
||||
|
||||
"frameworks": {
|
||||
"net45": { },
|
||||
"dnx451": { },
|
||||
"dnxcore50": { }
|
||||
"dotnet5.4": { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
"frameworks": {
|
||||
"net45": { },
|
||||
"dnx451": { },
|
||||
"dnxcore50": { }
|
||||
"dotnet5.4": { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,8 +61,8 @@
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="websocket-sharp, Version=1.0.2.36589, Culture=neutral, PublicKeyToken=5660b08a1845a91e, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\WebSocketSharp.1.0.3-rc9\lib\websocket-sharp.dll</HintPath>
|
||||
<Reference Include="websocket-sharp, Version=1.0.2.59610, Culture=neutral, PublicKeyToken=5660b08a1845a91e, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\DiscordBot\packages\WebSocketSharp.1.0.3-rc10\lib\websocket-sharp.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
|
||||
<package id="RestSharp" version="105.2.3" targetFramework="net45" />
|
||||
<package id="WebSocketSharp" version="1.0.3-rc9" targetFramework="net45" />
|
||||
<package id="WebSocketSharp" version="1.0.3-rc10" targetFramework="net45" />
|
||||
</packages>
|
||||
@@ -16,8 +16,8 @@ namespace Discord.Net.Rest
|
||||
public RestClient(DiscordAPIClientConfig config)
|
||||
{
|
||||
_config = config;
|
||||
#if !DNXCORE50
|
||||
_engine = new SharpRestEngine(config);
|
||||
#if !DOTNET5_4
|
||||
_engine = new RestSharpEngine(config);
|
||||
#else
|
||||
//_engine = new BuiltInRestEngine(config);
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#if !DNXCORE50
|
||||
#if !DOTNET5_4
|
||||
using Discord.API;
|
||||
using RestSharp;
|
||||
using System;
|
||||
@@ -8,12 +8,12 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Discord.Net.Rest
|
||||
{
|
||||
internal sealed class SharpRestEngine : IRestEngine
|
||||
internal sealed class RestSharpEngine : IRestEngine
|
||||
{
|
||||
private readonly DiscordAPIClientConfig _config;
|
||||
private readonly RestSharp.RestClient _client;
|
||||
|
||||
public SharpRestEngine(DiscordAPIClientConfig config)
|
||||
public RestSharpEngine(DiscordAPIClientConfig config)
|
||||
{
|
||||
_config = config;
|
||||
_client = new RestSharp.RestClient(Endpoints.BaseApi)
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace Discord.Net.WebSockets
|
||||
else //Dont make an OS thread if we only want to capture one packet...
|
||||
tasks.Add(Task.Run(() => ReceiveVoiceAsync(_cancelToken)));
|
||||
|
||||
#if !DNXCORE50
|
||||
#if !DOTNET5_4
|
||||
tasks.Add(WatcherAsync());
|
||||
#endif
|
||||
if (tasks.Count > 0)
|
||||
@@ -199,10 +199,10 @@ namespace Discord.Net.WebSockets
|
||||
Thread.Sleep(1);
|
||||
if (_udp.Available > 0)
|
||||
{
|
||||
#if !DNXCORE50
|
||||
#if !DOTNET5_4
|
||||
packet = _udp.Receive(ref endpoint);
|
||||
#else
|
||||
//TODO: Is this really the only way to end a Receive call in DNXCore?
|
||||
//TODO: Is this really the only way to end a Receive call in DOTNET5_4?
|
||||
var receiveTask = _udp.ReceiveAsync();
|
||||
var task = Task.WhenAny(closeTask, receiveTask).Result;
|
||||
if (task == closeTask)
|
||||
@@ -221,7 +221,7 @@ namespace Discord.Net.WebSockets
|
||||
return;
|
||||
|
||||
int port = packet[68] | packet[69] << 8;
|
||||
string ip = Encoding.ASCII.GetString(packet, 4, 70 - 6).TrimEnd('\0');
|
||||
string ip = Encoding.UTF8.GetString(packet, 4, 70 - 6).TrimEnd('\0');
|
||||
|
||||
var login2 = new VoiceLogin2Command();
|
||||
login2.Payload.Protocol = "udp";
|
||||
@@ -423,7 +423,7 @@ namespace Discord.Net.WebSockets
|
||||
catch (OperationCanceledException) { }
|
||||
catch (InvalidOperationException) { } //Includes ObjectDisposedException
|
||||
}
|
||||
#if !DNXCORE50
|
||||
#if !DOTNET5_4
|
||||
//Closes the UDP socket when _disconnectToken is triggered, since UDPClient doesn't allow passing a canceltoken
|
||||
private Task WatcherAsync()
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#if DNXCORE50zzz
|
||||
using Discord.Helpers;
|
||||
using System;
|
||||
#if DOTNET5_4
|
||||
/*using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -149,5 +148,5 @@ namespace Discord.Net.WebSockets
|
||||
_sendQueue.Enqueue(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
#endif
|
||||
@@ -52,7 +52,7 @@ namespace Discord.Net.WebSockets
|
||||
_cancelToken = new CancellationToken(true);
|
||||
_connectedEvent = new ManualResetEventSlim(false);
|
||||
|
||||
#if !DNXCORE50
|
||||
#if !DOTNET5_4
|
||||
_engine = new WebSocketSharpEngine(this, client.Config);
|
||||
#else
|
||||
//_engine = new BuiltInWebSocketEngine(this, client.Config);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#if !DNXCORE50
|
||||
#if !DOTNET5_4
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
@@ -40,13 +40,13 @@ namespace Discord.Net.WebSockets
|
||||
_webSocket = new WSSharpNWebSocket(host);
|
||||
_webSocket.EmitOnPing = false;
|
||||
_webSocket.EnableRedirection = true;
|
||||
_webSocket.Compression = WebSocketSharp.CompressionMethod.Deflate;
|
||||
_webSocket.Compression = WebSocketSharp.CompressionMethod.Deflate;
|
||||
_webSocket.SetProxy(_config.ProxyUrl, _config.ProxyCredentials?.UserName, _config.ProxyCredentials?.Password);
|
||||
_webSocket.OnMessage += (s, e) =>
|
||||
{
|
||||
if (e.Type == WebSocketSharp.Opcode.Binary)
|
||||
if (e.IsBinary)
|
||||
RaiseBinaryMessage(e.RawData);
|
||||
else if (e.Type == WebSocketSharp.Opcode.Text)
|
||||
else if (e.IsText)
|
||||
RaiseTextMessage(e.Data);
|
||||
};
|
||||
_webSocket.OnError += async (s, e) =>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"allowUnsafe": true
|
||||
},
|
||||
"configurations": {
|
||||
"FullDebug": {
|
||||
"TestResponses": {
|
||||
"compilationOptions": {
|
||||
"define": [
|
||||
"DEBUG",
|
||||
@@ -29,15 +29,15 @@
|
||||
}
|
||||
},
|
||||
|
||||
"dependencies": {
|
||||
"Newtonsoft.Json": "7.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"Newtonsoft.Json": "7.0.1"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
"net45": {
|
||||
"dependencies": {
|
||||
"RestSharp": "105.2.3",
|
||||
"WebSocketSharp": "1.0.3-rc9"
|
||||
"WebSocketSharp": "1.0.3-rc10",
|
||||
"RestSharp": "105.2.3"
|
||||
}
|
||||
},
|
||||
"dotnet5.4": {
|
||||
@@ -47,7 +47,7 @@
|
||||
"System.IO.Compression": "4.1.0-beta-23516",
|
||||
"System.Linq": "4.0.1-beta-23516",
|
||||
"System.Net.NameResolution": "4.0.0-beta-23516",
|
||||
"System.Net.Sockets": "4.1.0-beta-23516",
|
||||
"System.Net.Sockets": "4.1.0-beta-23409",
|
||||
"System.Net.Requests": "4.0.11-beta-23516",
|
||||
"System.Net.WebSockets.Client": "4.0.0-beta-23516",
|
||||
"System.Runtime.InteropServices": "4.0.21-beta-23516",
|
||||
|
||||
Reference in New Issue
Block a user