Added support for .NET Standard 1.1 and 1.2

This commit is contained in:
RogueException
2016-12-16 05:51:07 -04:00
parent a1addd4016
commit 8f87b2cc71
49 changed files with 533 additions and 348 deletions

View File

@@ -1,6 +1,8 @@
using Discord.Audio;
using Discord.Net.Udp;
using Discord.Net.WebSockets;
using Discord.Rest;
using System;
namespace Discord.WebSocket
{
@@ -27,9 +29,30 @@ namespace Discord.WebSocket
public AudioMode AudioMode { get; set; } = AudioMode.Disabled;
/// <summary> Gets or sets the provider used to generate new websocket connections. </summary>
public WebSocketProvider WebSocketProvider { get; set; } = () => new DefaultWebSocketClient();
public WebSocketProvider WebSocketProvider { get; set; }
/// <summary> Gets or sets the provider used to generate new udp sockets. </summary>
public UdpSocketProvider UdpSocketProvider { get; set; }
/// <summary> Gets or sets whether or not all users should be downloaded as guilds come available. </summary>
public bool DownloadUsersOnGuildAvailable { get; set; } = false;
public DiscordSocketConfig()
{
#if NETSTANDARD1_3
WebSocketProvider = () => new DefaultWebSocketClient();
UdpSocketProvider = () => new DefaultUdpSocket();
#else
WebSocketProvider = () =>
{
throw new InvalidOperationException("The default websocket provider is not supported on this platform.\n" +
"You must specify a WebSocketProvider or target a runtime supporting .NET Standard 1.3, such as .NET Framework 4.6+.");
};
UdpSocketProvider = () =>
{
throw new InvalidOperationException("The default UDP provider is not supported on this platform.\n" +
"You must specify a UdpSocketProvider or target a runtime supporting .NET Standard 1.3, such as .NET Framework 4.6+.");
};
#endif
}
}
}