Changed preprocessor conditions for new monikers and updated packages.

This commit is contained in:
RogueException
2015-11-28 23:02:02 -04:00
parent 3b65526d09
commit ca25af5b8a
14 changed files with 35 additions and 38 deletions

View File

@@ -39,8 +39,8 @@ Global
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{ACFB060B-EC8A-4926-B293-04C01E17EE23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {ACFB060B-EC8A-4926-B293-04C01E17EE23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ACFB060B-EC8A-4926-B293-04C01E17EE23}.Debug|Any CPU.Build.0 = Debug|Any CPU {ACFB060B-EC8A-4926-B293-04C01E17EE23}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ACFB060B-EC8A-4926-B293-04C01E17EE23}.FullDebug|Any CPU.ActiveCfg = FullDebug|Any CPU {ACFB060B-EC8A-4926-B293-04C01E17EE23}.FullDebug|Any CPU.ActiveCfg = Debug|Any CPU
{ACFB060B-EC8A-4926-B293-04C01E17EE23}.FullDebug|Any CPU.Build.0 = FullDebug|Any CPU {ACFB060B-EC8A-4926-B293-04C01E17EE23}.FullDebug|Any CPU.Build.0 = Debug|Any CPU
{ACFB060B-EC8A-4926-B293-04C01E17EE23}.Release|Any CPU.ActiveCfg = Release|Any CPU {ACFB060B-EC8A-4926-B293-04C01E17EE23}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ACFB060B-EC8A-4926-B293-04C01E17EE23}.Release|Any CPU.Build.0 = Release|Any CPU {ACFB060B-EC8A-4926-B293-04C01E17EE23}.Release|Any CPU.Build.0 = Release|Any CPU
{19793545-EF89-48F4-8100-3EBAAD0A9141}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {19793545-EF89-48F4-8100-3EBAAD0A9141}.Debug|Any CPU.ActiveCfg = Debug|Any CPU

View File

@@ -5,7 +5,7 @@ Check out the [documentation](https://discordnet.readthedocs.org/en/latest/) or
### Current Features ### Current Features
- Using Discord API v3 - Using Discord API v3
- Supports .Net 4.5 and DNX 4.5.1 - Supports .Net Framework 4.5 and .Net Core 5.0
- Server Management (Servers, Channels, Messages, Invites, Roles, Users) - Server Management (Servers, Channels, Messages, Invites, Roles, Users)
- Send/Receieve Messages (Including mentions and formatting) - Send/Receieve Messages (Including mentions and formatting)
- Basic Voice Support (Outgoing only) - Basic Voice Support (Outgoing only)
@@ -17,4 +17,4 @@ You can download Discord.Net from NuGet:
- [Discord.Net.Commands](https://www.nuget.org/packages/Discord.Net.Commands/) - [Discord.Net.Commands](https://www.nuget.org/packages/Discord.Net.Commands/)
### Known Issues ### Known Issues
- DNX Core 5.0 is experiencing several network-related issues and support has been temporarily dropped. - .Net Core 5.0 is experiencing several network-related issues and support has been temporarily dropped.

View File

@@ -1,6 +1,6 @@
{ {
"projects": [ "src" ], "projects": [ "src" ],
"sdk": { "sdk": {
"version": "1.0.0-beta6" "version": "1.0.0-rc1-final"
} }
} }

View File

@@ -19,7 +19,6 @@
"frameworks": { "frameworks": {
"net45": { }, "net45": { },
"dnx451": { }, "dotnet5.4": { }
"dnxcore50": { }
} }
} }

View File

@@ -20,7 +20,6 @@
"frameworks": { "frameworks": {
"net45": { }, "net45": { },
"dnx451": { }, "dotnet5.4": { }
"dnxcore50": { }
} }
} }

View File

@@ -61,8 +61,8 @@
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http" />
<Reference Include="websocket-sharp, Version=1.0.2.36589, Culture=neutral, PublicKeyToken=5660b08a1845a91e, processorArchitecture=MSIL"> <Reference Include="websocket-sharp, Version=1.0.2.59610, Culture=neutral, PublicKeyToken=5660b08a1845a91e, processorArchitecture=MSIL">
<HintPath>..\..\packages\WebSocketSharp.1.0.3-rc9\lib\websocket-sharp.dll</HintPath> <HintPath>..\..\..\DiscordBot\packages\WebSocketSharp.1.0.3-rc10\lib\websocket-sharp.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
</ItemGroup> </ItemGroup>

View File

@@ -2,5 +2,5 @@
<packages> <packages>
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" /> <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
<package id="RestSharp" version="105.2.3" 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> </packages>

View File

@@ -16,8 +16,8 @@ namespace Discord.Net.Rest
public RestClient(DiscordAPIClientConfig config) public RestClient(DiscordAPIClientConfig config)
{ {
_config = config; _config = config;
#if !DNXCORE50 #if !DOTNET5_4
_engine = new SharpRestEngine(config); _engine = new RestSharpEngine(config);
#else #else
//_engine = new BuiltInRestEngine(config); //_engine = new BuiltInRestEngine(config);
#endif #endif

View File

@@ -1,4 +1,4 @@
#if !DNXCORE50 #if !DOTNET5_4
using Discord.API; using Discord.API;
using RestSharp; using RestSharp;
using System; using System;
@@ -8,12 +8,12 @@ using System.Threading.Tasks;
namespace Discord.Net.Rest namespace Discord.Net.Rest
{ {
internal sealed class SharpRestEngine : IRestEngine internal sealed class RestSharpEngine : IRestEngine
{ {
private readonly DiscordAPIClientConfig _config; private readonly DiscordAPIClientConfig _config;
private readonly RestSharp.RestClient _client; private readonly RestSharp.RestClient _client;
public SharpRestEngine(DiscordAPIClientConfig config) public RestSharpEngine(DiscordAPIClientConfig config)
{ {
_config = config; _config = config;
_client = new RestSharp.RestClient(Endpoints.BaseApi) _client = new RestSharp.RestClient(Endpoints.BaseApi)

View File

@@ -135,7 +135,7 @@ namespace Discord.Net.WebSockets
else //Dont make an OS thread if we only want to capture one packet... else //Dont make an OS thread if we only want to capture one packet...
tasks.Add(Task.Run(() => ReceiveVoiceAsync(_cancelToken))); tasks.Add(Task.Run(() => ReceiveVoiceAsync(_cancelToken)));
#if !DNXCORE50 #if !DOTNET5_4
tasks.Add(WatcherAsync()); tasks.Add(WatcherAsync());
#endif #endif
if (tasks.Count > 0) if (tasks.Count > 0)
@@ -199,10 +199,10 @@ namespace Discord.Net.WebSockets
Thread.Sleep(1); Thread.Sleep(1);
if (_udp.Available > 0) if (_udp.Available > 0)
{ {
#if !DNXCORE50 #if !DOTNET5_4
packet = _udp.Receive(ref endpoint); packet = _udp.Receive(ref endpoint);
#else #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 receiveTask = _udp.ReceiveAsync();
var task = Task.WhenAny(closeTask, receiveTask).Result; var task = Task.WhenAny(closeTask, receiveTask).Result;
if (task == closeTask) if (task == closeTask)
@@ -221,7 +221,7 @@ namespace Discord.Net.WebSockets
return; return;
int port = packet[68] | packet[69] << 8; 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(); var login2 = new VoiceLogin2Command();
login2.Payload.Protocol = "udp"; login2.Payload.Protocol = "udp";
@@ -423,7 +423,7 @@ namespace Discord.Net.WebSockets
catch (OperationCanceledException) { } catch (OperationCanceledException) { }
catch (InvalidOperationException) { } //Includes ObjectDisposedException 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 //Closes the UDP socket when _disconnectToken is triggered, since UDPClient doesn't allow passing a canceltoken
private Task WatcherAsync() private Task WatcherAsync()
{ {

View File

@@ -1,6 +1,5 @@
#if DNXCORE50zzz #if DOTNET5_4
using Discord.Helpers; /*using System;
using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@@ -149,5 +148,5 @@ namespace Discord.Net.WebSockets
_sendQueue.Enqueue(message); _sendQueue.Enqueue(message);
} }
} }
} }*/
#endif #endif

View File

@@ -52,7 +52,7 @@ namespace Discord.Net.WebSockets
_cancelToken = new CancellationToken(true); _cancelToken = new CancellationToken(true);
_connectedEvent = new ManualResetEventSlim(false); _connectedEvent = new ManualResetEventSlim(false);
#if !DNXCORE50 #if !DOTNET5_4
_engine = new WebSocketSharpEngine(this, client.Config); _engine = new WebSocketSharpEngine(this, client.Config);
#else #else
//_engine = new BuiltInWebSocketEngine(this, client.Config); //_engine = new BuiltInWebSocketEngine(this, client.Config);

View File

@@ -1,4 +1,4 @@
#if !DNXCORE50 #if !DOTNET5_4
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
@@ -40,13 +40,13 @@ namespace Discord.Net.WebSockets
_webSocket = new WSSharpNWebSocket(host); _webSocket = new WSSharpNWebSocket(host);
_webSocket.EmitOnPing = false; _webSocket.EmitOnPing = false;
_webSocket.EnableRedirection = true; _webSocket.EnableRedirection = true;
_webSocket.Compression = WebSocketSharp.CompressionMethod.Deflate; _webSocket.Compression = WebSocketSharp.CompressionMethod.Deflate;
_webSocket.SetProxy(_config.ProxyUrl, _config.ProxyCredentials?.UserName, _config.ProxyCredentials?.Password); _webSocket.SetProxy(_config.ProxyUrl, _config.ProxyCredentials?.UserName, _config.ProxyCredentials?.Password);
_webSocket.OnMessage += (s, e) => _webSocket.OnMessage += (s, e) =>
{ {
if (e.Type == WebSocketSharp.Opcode.Binary) if (e.IsBinary)
RaiseBinaryMessage(e.RawData); RaiseBinaryMessage(e.RawData);
else if (e.Type == WebSocketSharp.Opcode.Text) else if (e.IsText)
RaiseTextMessage(e.Data); RaiseTextMessage(e.Data);
}; };
_webSocket.OnError += async (s, e) => _webSocket.OnError += async (s, e) =>

View File

@@ -18,7 +18,7 @@
"allowUnsafe": true "allowUnsafe": true
}, },
"configurations": { "configurations": {
"FullDebug": { "TestResponses": {
"compilationOptions": { "compilationOptions": {
"define": [ "define": [
"DEBUG", "DEBUG",
@@ -29,15 +29,15 @@
} }
}, },
"dependencies": { "dependencies": {
"Newtonsoft.Json": "7.0.1" "Newtonsoft.Json": "7.0.1"
}, },
"frameworks": { "frameworks": {
"net45": { "net45": {
"dependencies": { "dependencies": {
"RestSharp": "105.2.3", "WebSocketSharp": "1.0.3-rc10",
"WebSocketSharp": "1.0.3-rc9" "RestSharp": "105.2.3"
} }
}, },
"dotnet5.4": { "dotnet5.4": {
@@ -47,7 +47,7 @@
"System.IO.Compression": "4.1.0-beta-23516", "System.IO.Compression": "4.1.0-beta-23516",
"System.Linq": "4.0.1-beta-23516", "System.Linq": "4.0.1-beta-23516",
"System.Net.NameResolution": "4.0.0-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.Requests": "4.0.11-beta-23516",
"System.Net.WebSockets.Client": "4.0.0-beta-23516", "System.Net.WebSockets.Client": "4.0.0-beta-23516",
"System.Runtime.InteropServices": "4.0.21-beta-23516", "System.Runtime.InteropServices": "4.0.21-beta-23516",