@@ -4,8 +4,9 @@ | |||||
<AssemblyName>Discord.Net.Core</AssemblyName> | <AssemblyName>Discord.Net.Core</AssemblyName> | ||||
<RootNamespace>Discord</RootNamespace> | <RootNamespace>Discord</RootNamespace> | ||||
<Description>The core components for the Discord.Net library.</Description> | <Description>The core components for the Discord.Net library.</Description> | ||||
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net45;netstandard1.1;netstandard1.3</TargetFrameworks> | |||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard1.1;netstandard1.3</TargetFrameworks> | |||||
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net45;netstandard1.1;netstandard1.3;netstandard2.0</TargetFrameworks> | |||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard1.1;netstandard1.3;netstandard2.0</TargetFrameworks> | |||||
<DefineConstants Condition=" '$(TargetFramework)' == 'netstandard2.0' ">NETSTANDARD2</DefineConstants> | |||||
</PropertyGroup> | </PropertyGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<PackageReference Include="Newtonsoft.Json" Version="10.0.2" /> | <PackageReference Include="Newtonsoft.Json" Version="10.0.2" /> | ||||
@@ -1,5 +1,8 @@ | |||||
using System; | using System; | ||||
using System.Diagnostics; | using System.Diagnostics; | ||||
#if NETSTANDARD2 | |||||
using StandardColor = System.Drawing.Color; | |||||
#endif | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
@@ -96,7 +99,14 @@ namespace Discord | |||||
((uint)(g * 255.0f) << 8) | | ((uint)(g * 255.0f) << 8) | | ||||
(uint)(b * 255.0f); | (uint)(b * 255.0f); | ||||
} | } | ||||
#if NETSTANDARD2 | |||||
public static implicit operator StandardColor(Color color) => | |||||
StandardColor.FromArgb((int)color.RawValue); | |||||
public static explicit operator Color(StandardColor color) => | |||||
new Color((uint)color.ToArgb() << 8 >> 8); | |||||
#endif | |||||
public override string ToString() => | public override string ToString() => | ||||
$"#{Convert.ToString(RawValue, 16)}"; | $"#{Convert.ToString(RawValue, 16)}"; | ||||
private string DebuggerDisplay => | private string DebuggerDisplay => | ||||