Attempt to add multi-category support

This commit is contained in:
Matt Nadareski
2023-04-03 11:52:38 -04:00
parent 9d1dc11c6a
commit fb20e5c92b
2 changed files with 10 additions and 2 deletions

View File

@@ -270,7 +270,7 @@ namespace SabreTools.DatFiles.Formats
case "category":
content = reader.ReadElementContentAsString();
Header.Category ??= content;
Header.Category = (Header.Category == null ? content : $"{Header.Category};{content}");
break;
case "version":
@@ -879,7 +879,14 @@ namespace SabreTools.DatFiles.Formats
xtw.WriteRequiredElementString("name", Header.Name);
xtw.WriteRequiredElementString("description", Header.Description);
xtw.WriteOptionalElementString("rootdir", Header.RootDir);
xtw.WriteOptionalElementString("category", Header.Category);
if (!string.IsNullOrWhiteSpace(Header.Category))
{
var categories = Header.Category.Split(';');
foreach (string category in categories)
{
xtw.WriteOptionalElementString("category", category);
}
}
xtw.WriteRequiredElementString("version", Header.Version);
xtw.WriteOptionalElementString("date", Header.Date);
xtw.WriteRequiredElementString("author", Header.Author);

View File

@@ -26,6 +26,7 @@
<year>1980</year>
<manufacturer>Manufacturer</manufacturer>
<publisher>Publisher</publisher>
<category>Games</category>
<category>Arcade</category>
<trurip>
<titleid>0001</titleid>