[DATFromDir] Fix basic SuperDAT output

This commit is contained in:
Matt Nadareski
2016-09-14 12:16:34 -07:00
parent 909a01cf18
commit 2cff1a48b1
3 changed files with 13 additions and 4 deletions

View File

@@ -432,7 +432,9 @@ namespace SabreTools
if (!encounteredErrors) if (!encounteredErrors)
{ {
_logger.Log(Path.GetFileName(item) + " treated like an archive"); _logger.Log(Path.GetFileName(item) + " treated like an archive");
foreach (string entry in Directory.EnumerateFiles(tempdir, "*", SearchOption.AllDirectories)) List<string> entries = Directory.EnumerateFiles(tempdir, "*", SearchOption.AllDirectories).ToList();
entries.Sort(Style.CompareNumeric);
foreach (string entry in entries)
{ {
string tempbasepath = (Path.GetDirectoryName(Path.GetFullPath(item)) + Path.DirectorySeparatorChar); string tempbasepath = (Path.GetDirectoryName(Path.GetFullPath(item)) + Path.DirectorySeparatorChar);
lastparent = ProcessFile(Path.GetFullPath(entry), sw, Path.GetFullPath(tempdir), lastparent = ProcessFile(Path.GetFullPath(entry), sw, Path.GetFullPath(tempdir),

View File

@@ -245,7 +245,9 @@ namespace SabreTools
List<Rom> extracted = FileTools.GetArchiveFileInfo(item, _logger); List<Rom> extracted = FileTools.GetArchiveFileInfo(item, _logger);
foreach (Rom rom in extracted) foreach (Rom rom in extracted)
{ {
ProcessFileHelper(item, rom, _basePath, ProcessFileHelper(item,
rom,
_basePath,
(Path.GetDirectoryName(Path.GetFullPath(item)) + Path.DirectorySeparatorChar).Remove(0, _basePath.Length) + Path.GetFileNameWithoutExtension(item)); (Path.GetDirectoryName(Path.GetFullPath(item)) + Path.DirectorySeparatorChar).Remove(0, _basePath.Length) + Path.GetFileNameWithoutExtension(item));
} }
} }
@@ -274,7 +276,12 @@ namespace SabreTools
new ParallelOptions { MaxDegreeOfParallelism = _maxDegreeOfParallelism }, new ParallelOptions { MaxDegreeOfParallelism = _maxDegreeOfParallelism },
entry => entry =>
{ {
ProcessFile(entry, tempSubDir, Path.GetFileNameWithoutExtension(item)); ProcessFile(entry,
tempSubDir,
Path.Combine((_datdata.Type == "SuperDAT"
? (Path.GetDirectoryName(Path.GetFullPath(item)) + Path.DirectorySeparatorChar).Remove(0, _basePath.Length)
: ""),
Path.GetFileNameWithoutExtension(item)));
}); });
// Clear the temp directory // Clear the temp directory

View File

@@ -2940,7 +2940,7 @@ namespace SabreTools.Helper
"\t\t<homepage>" + HttpUtility.HtmlEncode(datdata.Homepage) + "</homepage>\n" + "\t\t<homepage>" + HttpUtility.HtmlEncode(datdata.Homepage) + "</homepage>\n" +
"\t\t<url>" + HttpUtility.HtmlEncode(datdata.Url) + "</url>\n" + "\t\t<url>" + HttpUtility.HtmlEncode(datdata.Url) + "</url>\n" +
"\t\t<comment>" + HttpUtility.HtmlEncode(datdata.Comment) + "</comment>\n" + "\t\t<comment>" + HttpUtility.HtmlEncode(datdata.Comment) + "</comment>\n" +
(!String.IsNullOrEmpty(datdata.Type) ? "\t\t<type>" + datdata.Type + "</type>\n" : "") + (!String.IsNullOrEmpty(datdata.Type) ? "\t\t<type>" + HttpUtility.HtmlEncode(datdata.Type) + "</type>\n" : "") +
(datdata.ForcePacking != ForcePacking.None || datdata.ForceMerging != ForceMerging.None || datdata.ForceNodump != ForceNodump.None ? (datdata.ForcePacking != ForcePacking.None || datdata.ForceMerging != ForceMerging.None || datdata.ForceNodump != ForceNodump.None ?
"\t\t<clrmamepro" + "\t\t<clrmamepro" +
(datdata.ForcePacking == ForcePacking.Unzip ? " forcepacking=\"unzip\"" : "") + (datdata.ForcePacking == ForcePacking.Unzip ? " forcepacking=\"unzip\"" : "") +