Add support casting System.Drawing.Color to Discord.Color
commit fa3303426766a59e7aa4d67e8b50826cfe7204ec Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Date: Sun Apr 29 13:50:56 2018 +0900 Use built-in symbol refs: https://github.com/RogueException/Discord.Net/pull/1043#issuecomment-385223999 commit 27ea82668587960925b73f97c924c9d39ee71f7b Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Date: Sun Apr 29 11:29:31 2018 +0900 Add support casting System.Drawing.Color to Discord.Color commit 1ab9de24978ff24a018767f80dc95ba19b616988 Merge: f5bb99c7a4d1e2bcAuthor: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Date: Sun Apr 29 10:16:46 2018 +0900 Merge remote-tracking branch 'upstream/dev' into dev commit f5bb99c77d0fecec21ad769778d17144c047d8b1 Merge: 3be8e40db8b59d97Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Date: Tue Apr 10 11:07:36 2018 +0900 Merge remote-tracking branch 'upstream/dev' into dev commit 3be8e40d3814fe8455af475b8641ee07a8f368d6 Merge: c692306f9d77a3cdAuthor: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Date: Sun Jan 7 15:05:31 2018 +0900 Merge remote-tracking branch 'upstream/dev' into dev commit c692306fcc1e86ab92dd10683d3719f16c02a249 Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Date: Sat Nov 11 10:49:00 2017 +0900 Add target of the internal fields commit 2d08f9a655b4949c1177f778d0f499047484a537 Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Date: Sat Nov 11 10:17:42 2017 +0900 Add some more extension commit 4f19b835ffe8c64a93a9b4659e60b03ac797760f Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Date: Sat Nov 11 01:19:11 2017 +0900 Add naming rules commit af756cd9feb630baadbf6025cbb079cd9e1f45cb Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Date: Sat Nov 11 00:35:30 2017 +0900 Add basic .NET style rules commit 503ece558b4f07bd8008157d3aeb6a4e7100d349 Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Date: Fri Nov 10 22:36:52 2017 +0900 Add EditorConfig
This commit is contained in:
committed by
Christopher F
parent
5023357a60
commit
c275e57528
@@ -4,8 +4,8 @@
|
||||
<AssemblyName>Discord.Net.Core</AssemblyName>
|
||||
<RootNamespace>Discord</RootNamespace>
|
||||
<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>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="10.0.2" />
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
#if NETSTANDARD2_0 || NET45
|
||||
using StandardColor = System.Drawing.Color;
|
||||
#endif
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
@@ -97,6 +100,13 @@ namespace Discord
|
||||
(uint)(b * 255.0f);
|
||||
}
|
||||
|
||||
#if NETSTANDARD2_0 || NET45
|
||||
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() =>
|
||||
$"#{Convert.ToString(RawValue, 16)}";
|
||||
private string DebuggerDisplay =>
|
||||
|
||||
Reference in New Issue
Block a user