mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Promote Sound
This commit is contained in:
@@ -167,6 +167,12 @@ namespace SabreTools.Library.DatFiles
|
||||
[JsonIgnore]
|
||||
public long SoftwareListCount { get; private set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Number of Sound items
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public long SoundCount { get; private set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Number of machines
|
||||
/// </summary>
|
||||
@@ -569,6 +575,9 @@ namespace SabreTools.Library.DatFiles
|
||||
case ItemType.SoftwareList:
|
||||
SoftwareListCount++;
|
||||
break;
|
||||
case ItemType.Sound:
|
||||
SoundCount++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -719,6 +728,9 @@ namespace SabreTools.Library.DatFiles
|
||||
case ItemType.SoftwareList:
|
||||
SoftwareListCount--;
|
||||
break;
|
||||
case ItemType.Sound:
|
||||
SoundCount--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -256,6 +256,9 @@ namespace SabreTools.Library.DatFiles
|
||||
case ItemType.SoftwareList:
|
||||
datItem = datItemObj.ToObject<DatItems.SoftwareList>();
|
||||
break;
|
||||
case ItemType.Sound:
|
||||
datItem = datItemObj.ToObject<DatItems.Sound>();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -1489,6 +1489,14 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteOptionalAttributeString("sha512", softwareList.Filter);
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
|
||||
case ItemType.Sound:
|
||||
var sound = datItem as Sound;
|
||||
xtw.WriteStartElement("file");
|
||||
xtw.WriteAttributeString("type", "sound");
|
||||
xtw.WriteOptionalAttributeString("channels", sound.Channels);
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
}
|
||||
|
||||
xtw.Flush();
|
||||
|
||||
Reference in New Issue
Block a user