Added net45 TFM

This commit is contained in:
RogueException
2017-04-26 10:25:08 -03:00
parent f8b9acc4a1
commit a306d83283
33 changed files with 82 additions and 57 deletions

View File

@@ -4,7 +4,7 @@
<AssemblyName>Discord.Net.Core</AssemblyName>
<RootNamespace>Discord</RootNamespace>
<Description>The core components for the Discord.Net library.</Description>
<TargetFrameworks>netstandard1.1;netstandard1.3</TargetFrameworks>
<TargetFrameworks>net45;netstandard1.1;netstandard1.3</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />

View File

@@ -9,7 +9,7 @@ namespace Discord
{
/// <summary> Sends a message to this message channel. </summary>
Task<IUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null);
#if NETSTANDARD1_3
#if FILESYSTEM
/// <summary> Sends a file to this text channel, with an optional caption. </summary>
Task<IUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, RequestOptions options = null);
#endif

View File

@@ -15,7 +15,7 @@ namespace Discord
{
Stream = stream;
}
#if NETSTANDARD1_3
#if FILESYSTEM
/// <summary>
/// Create the image from a file path.
/// </summary>

View File

@@ -35,7 +35,7 @@ namespace Discord.Logging
}
catch { }
}
#if NETSTANDARD1_3
#if FORMATSTR
public async Task LogAsync(LogSeverity severity, string source, FormattableString message, Exception ex = null)
{
try
@@ -51,7 +51,7 @@ namespace Discord.Logging
=> LogAsync(LogSeverity.Error, source, ex);
public Task ErrorAsync(string source, string message, Exception ex = null)
=> LogAsync(LogSeverity.Error, source, message, ex);
#if NETSTANDARD1_3
#if FORMATSTR
public Task ErrorAsync(string source, FormattableString message, Exception ex = null)
=> LogAsync(LogSeverity.Error, source, message, ex);
#endif
@@ -60,7 +60,7 @@ namespace Discord.Logging
=> LogAsync(LogSeverity.Warning, source, ex);
public Task WarningAsync(string source, string message, Exception ex = null)
=> LogAsync(LogSeverity.Warning, source, message, ex);
#if NETSTANDARD1_3
#if FORMATSTR
public Task WarningAsync(string source, FormattableString message, Exception ex = null)
=> LogAsync(LogSeverity.Warning, source, message, ex);
#endif
@@ -69,7 +69,7 @@ namespace Discord.Logging
=> LogAsync(LogSeverity.Info, source, ex);
public Task InfoAsync(string source, string message, Exception ex = null)
=> LogAsync(LogSeverity.Info, source, message, ex);
#if NETSTANDARD1_3
#if FORMATSTR
public Task InfoAsync(string source, FormattableString message, Exception ex = null)
=> LogAsync(LogSeverity.Info, source, message, ex);
#endif
@@ -78,7 +78,7 @@ namespace Discord.Logging
=> LogAsync(LogSeverity.Verbose, source, ex);
public Task VerboseAsync(string source, string message, Exception ex = null)
=> LogAsync(LogSeverity.Verbose, source, message, ex);
#if NETSTANDARD1_3
#if FORMATSTR
public Task VerboseAsync(string source, FormattableString message, Exception ex = null)
=> LogAsync(LogSeverity.Verbose, source, message, ex);
#endif
@@ -87,7 +87,7 @@ namespace Discord.Logging
=> LogAsync(LogSeverity.Debug, source, ex);
public Task DebugAsync(string source, string message, Exception ex = null)
=> LogAsync(LogSeverity.Debug, source, message, ex);
#if NETSTANDARD1_3
#if FORMATSTR
public Task DebugAsync(string source, FormattableString message, Exception ex = null)
=> LogAsync(LogSeverity.Debug, source, message, ex);
#endif

View File

@@ -20,7 +20,7 @@ namespace Discord.Logging
=> _manager.LogAsync(severity, Name, exception);
public Task LogAsync(LogSeverity severity, string message, Exception exception = null)
=> _manager.LogAsync(severity, Name, message, exception);
#if NETSTANDARD1_3
#if FORMATSTR
public Task LogAsync(LogSeverity severity, FormattableString message, Exception exception = null)
=> _manager.LogAsync(severity, Name, message, exception);
#endif
@@ -29,7 +29,7 @@ namespace Discord.Logging
=> _manager.ErrorAsync(Name, exception);
public Task ErrorAsync(string message, Exception exception = null)
=> _manager.ErrorAsync(Name, message, exception);
#if NETSTANDARD1_3
#if FORMATSTR
public Task ErrorAsync(FormattableString message, Exception exception = null)
=> _manager.ErrorAsync(Name, message, exception);
#endif
@@ -38,7 +38,7 @@ namespace Discord.Logging
=> _manager.WarningAsync(Name, exception);
public Task WarningAsync(string message, Exception exception = null)
=> _manager.WarningAsync(Name, message, exception);
#if NETSTANDARD1_3
#if FORMATSTR
public Task WarningAsync(FormattableString message, Exception exception = null)
=> _manager.WarningAsync(Name, message, exception);
#endif
@@ -47,7 +47,7 @@ namespace Discord.Logging
=> _manager.InfoAsync(Name, exception);
public Task InfoAsync(string message, Exception exception = null)
=> _manager.InfoAsync(Name, message, exception);
#if NETSTANDARD1_3
#if FORMATSTR
public Task InfoAsync(FormattableString message, Exception exception = null)
=> _manager.InfoAsync(Name, message, exception);
#endif
@@ -56,7 +56,7 @@ namespace Discord.Logging
=> _manager.VerboseAsync(Name, exception);
public Task VerboseAsync(string message, Exception exception = null)
=> _manager.VerboseAsync(Name, message, exception);
#if NETSTANDARD1_3
#if FORMATSTR
public Task VerboseAsync(FormattableString message, Exception exception = null)
=> _manager.VerboseAsync(Name, message, exception);
#endif
@@ -65,7 +65,7 @@ namespace Discord.Logging
=> _manager.DebugAsync(Name, exception);
public Task DebugAsync(string message, Exception exception = null)
=> _manager.DebugAsync(Name, message, exception);
#if NETSTANDARD1_3
#if FORMATSTR
public Task DebugAsync(FormattableString message, Exception exception = null)
=> _manager.DebugAsync(Name, message, exception);
#endif

View File

@@ -5,7 +5,7 @@ namespace Discord
//Source: https://github.com/dotnet/coreclr/blob/master/src/mscorlib/src/System/DateTimeOffset.cs
internal static class DateTimeUtils
{
#if !NETSTANDARD1_3
#if !UNIXTIME
private const long UnixEpochTicks = 621_355_968_000_000_000;
private const long UnixEpochSeconds = 62_135_596_800;
private const long UnixEpochMilliseconds = 62_135_596_800_000;
@@ -18,7 +18,7 @@ namespace Discord
public static DateTimeOffset FromUnixSeconds(long seconds)
{
#if NETSTANDARD1_3
#if UNIXTIME
return DateTimeOffset.FromUnixTimeSeconds(seconds);
#else
long ticks = seconds * TimeSpan.TicksPerSecond + UnixEpochTicks;
@@ -27,7 +27,7 @@ namespace Discord
}
public static DateTimeOffset FromUnixMilliseconds(long milliseconds)
{
#if NETSTANDARD1_3
#if UNIXTIME
return DateTimeOffset.FromUnixTimeMilliseconds(milliseconds);
#else
long ticks = milliseconds * TimeSpan.TicksPerMillisecond + UnixEpochTicks;
@@ -37,7 +37,7 @@ namespace Discord
public static long ToUnixSeconds(DateTimeOffset dto)
{
#if NETSTANDARD1_3
#if UNIXTIME
return dto.ToUnixTimeSeconds();
#else
long seconds = dto.UtcDateTime.Ticks / TimeSpan.TicksPerSecond;
@@ -46,7 +46,7 @@ namespace Discord
}
public static long ToUnixMilliseconds(DateTimeOffset dto)
{
#if NETSTANDARD1_3
#if UNIXTIME
return dto.ToUnixTimeMilliseconds();
#else
long milliseconds = dto.UtcDateTime.Ticks / TimeSpan.TicksPerMillisecond;