mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-30 17:47:20 +00:00
Added check for missing files when saving in the AudioEditor
This commit is contained in:
@@ -304,6 +304,7 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
PCKAudioFile.AudioCategory overworldCategory = audioFile.GetCategory(PCKAudioFile.AudioCategory.EAudioType.Overworld);
|
||||
|
||||
bool songs_missing = false;
|
||||
foreach (var category in audioFile.Categories)
|
||||
{
|
||||
if (category.SongNames.Count < 1)
|
||||
@@ -312,6 +313,16 @@ namespace PckStudio.Forms.Editor
|
||||
return;
|
||||
}
|
||||
|
||||
foreach(var song in category.SongNames)
|
||||
{
|
||||
string FileName = Path.Combine(parent.GetDataPath(), song + ".binka");
|
||||
if (!File.Exists(FileName))
|
||||
{
|
||||
songs_missing = true;
|
||||
MessageBox.Show("\"" + song + ".binka\" does not exist in the \"Data\" folder. The game will crash when attempting to load this track.", "File missing");
|
||||
}
|
||||
}
|
||||
|
||||
category.Name = "";
|
||||
if (playOverworldInCreative.Checked && category.audioType == PCKAudioFile.AudioCategory.EAudioType.Creative)
|
||||
{
|
||||
@@ -327,6 +338,12 @@ namespace PckStudio.Forms.Editor
|
||||
}
|
||||
}
|
||||
|
||||
if (songs_missing)
|
||||
{
|
||||
MessageBox.Show("Failed to save AudioData file because there are missing song entries", "Error");
|
||||
return;
|
||||
}
|
||||
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
PCKAudioFileWriter.Write(stream, audioFile, _isLittleEndian);
|
||||
|
||||
Reference in New Issue
Block a user