mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-24 13:34:36 +00:00
Fix AddingDuplicate Error when setting credits and add GetCreditsString Property
This commit is contained in:
@@ -59,6 +59,7 @@ namespace PckStudio.Classes.FileTypes
|
||||
}
|
||||
|
||||
public string[] GetCredits() => Credits.Values.ToArray();
|
||||
public string GetCreditsString() => string.Join("\n", Credits.Values.ToArray());
|
||||
|
||||
public void AddCredits(params string[] credits)
|
||||
{
|
||||
@@ -101,7 +102,7 @@ namespace PckStudio.Classes.FileTypes
|
||||
|
||||
public void AddCredit(string credit)
|
||||
{
|
||||
Credits.Add($"IDS_CREDIT{(Credits.Count > 1 ? $"_{Credits.Count}" : string.Empty)}", credit);
|
||||
Credits.Add($"IDS_CREDIT{(Credits.Count > 0 ? $"_{Credits.Count+1}" : string.Empty)}", credit);
|
||||
}
|
||||
|
||||
public void AddCreditId(string creditId) => Credits.Add(creditId, string.Empty);
|
||||
|
||||
@@ -421,10 +421,10 @@ namespace PckStudio.Forms.Utilities
|
||||
|
||||
private void creditsEditorToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var credits = string.Join("\n", audioFile.GetCredits());
|
||||
using creditsEditor prompt = new creditsEditor(credits);
|
||||
if (prompt.ShowDialog() == DialogResult.OK)
|
||||
audioFile.SetCredits(prompt.Credits.Split('\n'));
|
||||
var credits = audioFile.GetCreditsString();
|
||||
using (creditsEditor prompt = new creditsEditor(credits))
|
||||
if (prompt.ShowDialog() == DialogResult.OK)
|
||||
audioFile.SetCredits(prompt.Credits.Split('\n'));
|
||||
}
|
||||
|
||||
private void AudioEditor_FormClosing(object sender, FormClosingEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user