mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-28 11:05:48 +00:00
Update Discord RPC class
This commit is contained in:
@@ -10,12 +10,32 @@ namespace PckStudio.Classes.Misc
|
||||
public static DiscordRpcClient Client;
|
||||
public static readonly DateTime StartUpTime = DateTime.UtcNow;
|
||||
|
||||
private static readonly Assets _assets = new Assets()
|
||||
{
|
||||
LargeImageKey = "pcklgo",
|
||||
LargeImageText = "PCK-Studio",
|
||||
};
|
||||
|
||||
private static readonly Button[] _buttons = new Button[]
|
||||
{
|
||||
new Button()
|
||||
{
|
||||
Label = "Check it out.",
|
||||
Url = Program.ProjectUrl,
|
||||
}
|
||||
};
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
Client = new DiscordRpcClient(Settings.Default.RichPresenceId);
|
||||
Client.Initialize();
|
||||
}
|
||||
|
||||
public static void SetPresence(string details)
|
||||
{
|
||||
SetPresence(details, null);
|
||||
}
|
||||
|
||||
public static void SetPresence(string details, string state)
|
||||
{
|
||||
Client?.SetPresence(new RichPresence()
|
||||
@@ -23,16 +43,14 @@ namespace PckStudio.Classes.Misc
|
||||
Details = details,
|
||||
State = state,
|
||||
Timestamps = new Timestamps() { Start = StartUpTime },
|
||||
Assets = new Assets()
|
||||
{
|
||||
LargeImageKey = "pcklgo",
|
||||
LargeImageText = "PCK-Studio",
|
||||
}
|
||||
Assets = _assets,
|
||||
Buttons = _buttons
|
||||
});
|
||||
}
|
||||
|
||||
public static void Deinitialize()
|
||||
{
|
||||
Client?.ClearPresence();
|
||||
Client?.Dispose();
|
||||
Client = null;
|
||||
}
|
||||
|
||||
@@ -312,7 +312,7 @@ namespace PckStudio.Forms.Utilities
|
||||
|
||||
try
|
||||
{
|
||||
RPC.SetPresence("Viewing the PCK Center", "Program by PhoenixARC");
|
||||
RPC.SetPresence("Viewing the PCK Center");
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -113,8 +113,7 @@ namespace PckStudio
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
RPC.Initialize();
|
||||
if (currentPCK == null)
|
||||
RPC.SetPresence("An Open Source .PCK File Editor", "Program by PhoenixARC");
|
||||
UpdateRPC();
|
||||
|
||||
skinToolStripMenuItem1.Click += (sender, e) => setFileType_Click(sender, e, PckFile.FileData.FileType.SkinFile);
|
||||
capeToolStripMenuItem.Click += (sender, e) => setFileType_Click(sender, e, PckFile.FileData.FileType.CapeFile);
|
||||
@@ -385,7 +384,7 @@ namespace PckStudio
|
||||
{
|
||||
if (currentPCK == null)
|
||||
{
|
||||
RPC.SetPresence("An Open Source .PCK File Editor", "Program by PhoenixARC");
|
||||
RPC.SetPresence("An Open Source .PCK File Editor");
|
||||
return;
|
||||
};
|
||||
|
||||
@@ -393,11 +392,11 @@ namespace PckStudio
|
||||
locfile.HasLocEntry("IDS_DISPLAY_NAME") &&
|
||||
locfile.Languages.Contains("en-EN"))
|
||||
{
|
||||
RPC.SetPresence($"Editing a Pack: {locfile.GetLocEntry("IDS_DISPLAY_NAME", "en-EN")}", "Program by PhoenixARC");
|
||||
RPC.SetPresence($"Editing a Pack: {locfile.GetLocEntry("IDS_DISPLAY_NAME", "en-EN")}");
|
||||
return;
|
||||
}
|
||||
// default
|
||||
RPC.SetPresence("An Open Source .PCK File Editor", "Program by PhoenixARC");
|
||||
RPC.SetPresence("An Open Source .PCK File Editor");
|
||||
}
|
||||
|
||||
private void HandleAudioFile(PckFile.FileData file)
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace PckStudio
|
||||
|
||||
static class Program
|
||||
{
|
||||
public static readonly string ProjectUrl = "https://github.com/PhoenixARC/-PCK-Studio";
|
||||
public static readonly string BaseAPIUrl = "http://api.pckstudio.xyz/api/pck";
|
||||
public static readonly string BackUpAPIUrl = "https://raw.githubusercontent.com/PhoenixARC/pckstudio.tk/main/studio/PCK/api/";
|
||||
public static readonly string AppData = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "PCK-Studio");
|
||||
|
||||
Reference in New Issue
Block a user