mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-28 19:04:50 +00:00
Update RichPresence class
This commit is contained in:
@@ -7,38 +7,40 @@ namespace RichPresenceClient
|
||||
public static class RPC
|
||||
{
|
||||
|
||||
public static DiscordRpcClient client;
|
||||
public static DiscordRpcClient client = null;
|
||||
|
||||
public static void Initialize(string ClientID)
|
||||
{
|
||||
//client = new DiscordRpcClient(ClientID);
|
||||
//if (!client.Initialize())
|
||||
//{
|
||||
// throw new Exception("ERROR initializing Discord RPC");
|
||||
//}
|
||||
client = new DiscordRpcClient(ClientID);
|
||||
if (!client.Initialize())
|
||||
{
|
||||
throw new Exception("ERROR initializing Discord RPC");
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetRPC(string details, string state, string imageLarge, string imageLargeText, string imageSmall)
|
||||
{
|
||||
//if (client == null) return;
|
||||
//client.SetPresence(new RichPresence()
|
||||
//{
|
||||
// Details = details,
|
||||
// State = state,
|
||||
// Assets = new Assets()
|
||||
// {
|
||||
// LargeImageKey = imageLarge,
|
||||
// LargeImageText = imageLargeText,
|
||||
// SmallImageKey = imageSmall
|
||||
// }
|
||||
//});
|
||||
if (client == null) return;
|
||||
client.SetPresence(new RichPresence()
|
||||
{
|
||||
Details = details,
|
||||
State = state,
|
||||
Assets = new Assets()
|
||||
{
|
||||
LargeImageKey = imageLarge,
|
||||
LargeImageText = imageLargeText,
|
||||
SmallImageKey = imageSmall
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void CloseRPC()
|
||||
{
|
||||
//if (client != null)
|
||||
// client.Deinitialize();
|
||||
// client.Dispose();
|
||||
if (client != null && client.IsInitialized)
|
||||
{
|
||||
client.Deinitialize();
|
||||
}
|
||||
client.Dispose();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user