From 5f3efa7e0468a96810583c266fd4edf835fccfb5 Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Thu, 4 Aug 2022 19:15:40 +0200 Subject: [PATCH] Add RPC text when opening/closing a pck --- MinecraftUSkinEditor/Classes/FileTypes/LOCFile.cs | 3 +++ MinecraftUSkinEditor/MainForm.cs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/MinecraftUSkinEditor/Classes/FileTypes/LOCFile.cs b/MinecraftUSkinEditor/Classes/FileTypes/LOCFile.cs index 31a10e2e..ef7c2c8e 100644 --- a/MinecraftUSkinEditor/Classes/FileTypes/LOCFile.cs +++ b/MinecraftUSkinEditor/Classes/FileTypes/LOCFile.cs @@ -118,6 +118,9 @@ namespace PckStudio.Classes.FileTypes return LocKeys[locKey]; } + public bool HasLocEntry(string locKey) + => LocKeys.ContainsKey(locKey); + public string GetLocEntry(string locKey, string language) { if (!LocKeys.ContainsKey(locKey)) diff --git a/MinecraftUSkinEditor/MainForm.cs b/MinecraftUSkinEditor/MainForm.cs index 5277eb16..cec9986d 100644 --- a/MinecraftUSkinEditor/MainForm.cs +++ b/MinecraftUSkinEditor/MainForm.cs @@ -142,6 +142,8 @@ namespace PckStudio convertToBedrockToolStripMenuItem.Enabled = true; BuildMainTreeView(); tabControl.SelectTab(1); + if (TryGetLocFile(out LOCFile locfile) && locfile.HasLocEntry("IDS_DISPLAY_NAME")) + RPC.SetPresence($"Editing a Pack: {locfile.GetLocEntry("IDS_DISPLAY_NAME", "en-EN")}", "Program by PhoenixARC"); } private void CloseEditorTab() @@ -161,6 +163,7 @@ namespace PckStudio closeToolStripMenuItem.Visible = false; fileEntryCountLabel.Text = "Files:0"; tabControl.SelectTab(0); + RPC.SetPresence("An Open Source .PCK File Editor", "Program by PhoenixARC"); } ///