diff --git a/Switch_Toolbox/Lib/DiscordRPC.dll b/Switch_Toolbox/Lib/DiscordRPC.dll new file mode 100644 index 00000000..73f47427 Binary files /dev/null and b/Switch_Toolbox/Lib/DiscordRPC.dll differ diff --git a/Switch_Toolbox/Lib/Newtonsoft.Json.dll b/Switch_Toolbox/Lib/Newtonsoft.Json.dll new file mode 100644 index 00000000..1971a356 Binary files /dev/null and b/Switch_Toolbox/Lib/Newtonsoft.Json.dll differ diff --git a/Switch_Toolbox/MainForm.cs b/Switch_Toolbox/MainForm.cs index a9fd5229..924d4ff6 100644 --- a/Switch_Toolbox/MainForm.cs +++ b/Switch_Toolbox/MainForm.cs @@ -11,10 +11,10 @@ using Switch_Toolbox.Library.Forms; using WeifenLuo.WinFormsUI.Docking; using Switch_Toolbox.Library; using Smash_Forge.Rendering; +using Switch_Toolbox_Library; using Switch_Toolbox.Library.IO; using System.Net; - namespace Switch_Toolbox { public partial class MainForm : Form @@ -35,6 +35,7 @@ namespace Switch_Toolbox public MainForm() { InitializeComponent(); + new DiscordPresence().Initialize(); ShaderTools.executableDir = executableDir; diff --git a/Switch_Toolbox/Switch_Toolbox.csproj b/Switch_Toolbox/Switch_Toolbox.csproj index 7d5fd328..7824f874 100644 --- a/Switch_Toolbox/Switch_Toolbox.csproj +++ b/Switch_Toolbox/Switch_Toolbox.csproj @@ -53,6 +53,9 @@ ..\packages\CsvHelper.8.0.0-beta01\lib\net45\CsvHelper.dll False + + Lib\DiscordRPC.dll + ..\..\..\..\Documents\Visual Studio 2017\Projects\WindowsFormsApp2\WindowsFormsApp2\Lib\EditorCoreCommon.dll False @@ -402,4 +405,4 @@ - \ No newline at end of file + diff --git a/Switch_Toolbox_Library/DiscordPresence.cs b/Switch_Toolbox_Library/DiscordPresence.cs new file mode 100644 index 00000000..c51dd298 --- /dev/null +++ b/Switch_Toolbox_Library/DiscordPresence.cs @@ -0,0 +1,58 @@ +using DiscordRPC; +using DiscordRPC.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Switch_Toolbox_Library +{ + /** + * Code from the DiscordRpc examples: + * https://github.com/Lachee/discord-rpc-csharp#usage + */ + public class DiscordPresence + { + public DiscordRpcClient client; + public String ClientID = "517901453935771668"; + + public void Initialize() + { + client = new DiscordRpcClient(ClientID); + + client.Logger = new ConsoleLogger() { Level = LogLevel.Warning }; + + client.OnReady += (sender, e) => + { + Console.WriteLine("Received Ready from user {0}", e.User.Username); + }; + + client.OnPresenceUpdate += (sender, e) => + { + Console.WriteLine("Received Update! {0}", e.Presence); + }; + + client.Initialize(); + + var timer = new System.Timers.Timer(150); + timer.Elapsed += (sender, args) => { UpdatePresence(); }; + timer.Start(); + } + + void UpdatePresence() + { + client.SetPresence(new RichPresence() + { + Details = "Working on a mod", + State ="", + Assets = new Assets() + { + LargeImageKey = "toolbox-logo", + LargeImageText = "Switch Toolbox" + } + }); + } + + } +}