Promote Sound

This commit is contained in:
Matt Nadareski
2020-09-02 12:51:21 -07:00
parent 7aa042f76d
commit 07cf2135ff
11 changed files with 251 additions and 105 deletions

View File

@@ -369,7 +369,21 @@ namespace SabreTools.Library.DatFiles
});
reader.Read();
break;
case "sound":
datItems.Add(new Sound
{
Channels = reader.GetAttribute("channels"),
Source = new Source
{
Index = indexId,
Name = filename,
},
});
reader.Read();
break;
case "display":
@@ -398,19 +412,6 @@ namespace SabreTools.Library.DatFiles
reader.Read();
break;
case "sound":
var sound = new Sound();
sound.Channels = reader.GetAttribute("channels");
// Ensure the list exists
if (machine.Sounds == null)
machine.Sounds = new List<Sound>();
machine.Sounds.Add(sound);
reader.Read();
break;
case "condition":
var condition = new Condition();
condition.Tag = reader.GetAttribute("tag");
@@ -1223,18 +1224,6 @@ namespace SabreTools.Library.DatFiles
xtw.WriteEndElement();
}
}
if (datItem.Machine.Sounds != null)
{
foreach (var sound in datItem.Machine.Sounds)
{
xtw.WriteStartElement("sound");
xtw.WriteOptionalAttributeString("channels", sound.Channels);
// End sound
xtw.WriteEndElement();
}
}
if (datItem.Machine.Conditions != null)
{
foreach (var condition in datItem.Machine.Conditions)
@@ -1653,6 +1642,13 @@ namespace SabreTools.Library.DatFiles
xtw.WriteOptionalAttributeString("filter", softwareList.Filter);
xtw.WriteEndElement();
break;
case ItemType.Sound:
var sound = datItem as Sound;
xtw.WriteStartElement("sound");
xtw.WriteOptionalAttributeString("channels", sound.Channels);
xtw.WriteEndElement();
break;
}
xtw.Flush();