Add support for old CMP dats (partial library-only)

This commit is contained in:
Matt Nadareski
2020-09-20 21:12:57 -07:00
parent 195aaba308
commit 9510d9efe6
4 changed files with 60 additions and 10 deletions

View File

@@ -42,6 +42,17 @@ namespace SabreTools.Library.IO
/// </summary>
public bool DosCenter { get; set; } = false;
/// <summary>
/// Get if quotes should surround attribute values
/// </summary>
/// <remarks>
/// If this is disabled, then a special bit of code will be
/// invoked to deal with unquoted, multi-part names. This can
/// backfire in a lot of circumstances, so don't disable this
/// unless you know what you're doing
/// </remarks>
public bool Quotes { get; set; } = true;
/// <summary>
/// Current row type
/// </summary>
@@ -166,6 +177,22 @@ namespace SabreTools.Library.IO
value = linegc[++i].Replace("\"", string.Empty);
}
}
// Special case for assumed unquoted values (only affects `name`)
else if (!Quotes && key == "name")
{
while (++i < linegc.Length
&& linegc[i] != "merge"
&& linegc[i] != "size"
&& linegc[i] != "crc"
&& linegc[i] != "md5"
&& linegc[i] != "sha1")
{
value += $" {linegc[i]}";
}
value = value.Trim();
i--;
}
else
{
// Special cases for standalone statuses