Merge branch 'master' of https://github.com/KillzXGaming/Switch-Toolbox
This commit is contained in:
commit
364c9ceeed
BIN
Switch_Toolbox/Lib/DiscordRPC.dll
Normal file
BIN
Switch_Toolbox/Lib/DiscordRPC.dll
Normal file
Binary file not shown.
BIN
Switch_Toolbox/Lib/Newtonsoft.Json.dll
Normal file
BIN
Switch_Toolbox/Lib/Newtonsoft.Json.dll
Normal file
Binary file not shown.
@ -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;
|
||||
|
||||
|
@ -53,6 +53,9 @@
|
||||
<HintPath>..\packages\CsvHelper.8.0.0-beta01\lib\net45\CsvHelper.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="DiscordRPC">
|
||||
<HintPath>Lib\DiscordRPC.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EditorCoreCommon">
|
||||
<HintPath>..\..\..\..\Documents\Visual Studio 2017\Projects\WindowsFormsApp2\WindowsFormsApp2\Lib\EditorCoreCommon.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
@ -402,4 +405,4 @@
|
||||
</Target>
|
||||
<Import Project="..\packages\Costura.Fody.3.1.4\build\Costura.Fody.targets" Condition="Exists('..\packages\Costura.Fody.3.1.4\build\Costura.Fody.targets')" />
|
||||
<Import Project="..\packages\AssimpNet.4.1.0\build\AssimpNet.targets" Condition="Exists('..\packages\AssimpNet.4.1.0\build\AssimpNet.targets')" />
|
||||
</Project>
|
||||
</Project>
|
||||
|
58
Switch_Toolbox_Library/DiscordPresence.cs
Normal file
58
Switch_Toolbox_Library/DiscordPresence.cs
Normal file
@ -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"
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user