[DatTools] Fix offsets again

This commit is contained in:
Matt Nadareski
2016-09-05 20:31:44 -07:00
parent cf92165a34
commit 74a6aad25d

View File

@@ -24,6 +24,13 @@ namespace SabreTools.Helper
/// <remarks>There is currently no differentiation between XML and SabreDAT here</remarks> /// <remarks>There is currently no differentiation between XML and SabreDAT here</remarks>
public static OutputFormat GetOutputFormat(string filename) public static OutputFormat GetOutputFormat(string filename)
{ {
// Limit the output formats based on extension
string ext = Path.GetExtension(filename).ToLowerInvariant();
if (ext != ".dat" && ext != ".xml")
{
return OutputFormat.None;
}
try try
{ {
StreamReader sr = File.OpenText(filename); StreamReader sr = File.OpenText(filename);
@@ -1005,9 +1012,11 @@ namespace SabreTools.Helper
// If we have a subtree, add what is possible // If we have a subtree, add what is possible
if (subreader != null) if (subreader != null)
{ {
subreader.MoveToContent();
if (!softlist && temptype == "software" && subreader.ReadToFollowing("description")) if (!softlist && temptype == "software" && subreader.ReadToFollowing("description"))
{ {
tempname = subreader.ReadElementContentAsString(); tempname = subreader.ReadElementContentAsString();
gamedesc = tempname;
tempname = tempname.Replace('/', '_').Replace("\"", "''"); tempname = tempname.Replace('/', '_').Replace("\"", "''");
software = true; software = true;
} }
@@ -1093,6 +1102,7 @@ namespace SabreTools.Helper
lastrom.HashData.Size += size; lastrom.HashData.Size += size;
datdata.Files[key].RemoveAt(index); datdata.Files[key].RemoveAt(index);
datdata.Files[key].Add(lastrom); datdata.Files[key].Add(lastrom);
subreader.Read();
continue; continue;
} }