1
0
mirror of synced 2024-11-28 17:30:57 +01:00

Automatically bind bars data to always save changes

This commit is contained in:
KillzXGaming 2019-07-13 21:16:23 -04:00
parent 859303408c
commit 16d065d835
3 changed files with 14 additions and 19 deletions

Binary file not shown.

View File

@ -72,8 +72,20 @@ namespace FirstPlugin
public class AudioEntry : TreeNodeCustom public class AudioEntry : TreeNodeCustom
{ {
public BARSAudioFile audioFile;
public string Magic; public string Magic;
public byte[] Data; public byte[] Data
{
get
{
return audioFile.data;
}
set
{
audioFile.data = value;
}
}
public AudioEntry() public AudioEntry()
{ {
@ -248,8 +260,8 @@ namespace FirstPlugin
BARSAudioFile audio = bars.AudioEntries[i].AudioFile; BARSAudioFile audio = bars.AudioEntries[i].AudioFile;
AudioEntry node = new AudioEntry(); AudioEntry node = new AudioEntry();
node.audioFile = audio;
node.Magic = audio.Magic; node.Magic = audio.Magic;
node.Data = audio.data;
node.SetupMusic(); node.SetupMusic();
if (audio.Magic == "FWAV") if (audio.Magic == "FWAV")
@ -290,23 +302,6 @@ namespace FirstPlugin
public byte[] Save() public byte[] Save()
{ {
MemoryStream mem = new MemoryStream(); MemoryStream mem = new MemoryStream();
foreach (TreeNode node in Nodes[1].Nodes)
{
if (node is AudioEntry)
{
for (int i = 0; i < bars.AudioEntries.Count; i++)
{
string audioName = bars.AudioEntries[i].MetaData.Name;
if (Path.GetFileNameWithoutExtension(node.Text) == audioName)
{
bars.AudioEntries[i].AudioFile.data = ((AudioEntry)node).Data;
}
}
}
}
bars.Save(mem); bars.Save(mem);
return mem.ToArray(); return mem.ToArray();
} }