mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DATFromDir] Romba ignores empty folders
This commit is contained in:
@@ -379,51 +379,54 @@ namespace SabreTools
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now output any empties to the stream
|
// Now output any empties to the stream (if not in Romba mode)
|
||||||
foreach (List<RomData> roms in _datdata.Roms.Values)
|
if (!_datdata.Romba)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < roms.Count; i++)
|
foreach (List<RomData> roms in _datdata.Roms.Values)
|
||||||
{
|
{
|
||||||
RomData rom = roms[i];
|
for (int i = 0; i < roms.Count; i++)
|
||||||
|
|
||||||
// If we're in a mode that doesn't allow for actual empty folders, add the blank info
|
|
||||||
if (_datdata.OutputFormat != OutputFormat.SabreDat && _datdata.OutputFormat != OutputFormat.MissFile)
|
|
||||||
{
|
{
|
||||||
rom.Type = "rom";
|
RomData rom = roms[i];
|
||||||
rom.Name = "-";
|
|
||||||
rom.Size = Constants.SizeZero;
|
|
||||||
rom.CRC = Constants.CRCZero;
|
|
||||||
rom.MD5 = Constants.MD5Zero;
|
|
||||||
rom.SHA1 = Constants.SHA1Zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we have a different game and we're not at the start of the list, output the end of last item
|
// If we're in a mode that doesn't allow for actual empty folders, add the blank info
|
||||||
int last = 0;
|
if (_datdata.OutputFormat != OutputFormat.SabreDat && _datdata.OutputFormat != OutputFormat.MissFile)
|
||||||
if (lastparent != null && lastparent.ToLowerInvariant() != rom.Game.ToLowerInvariant())
|
{
|
||||||
{
|
rom.Type = "rom";
|
||||||
Output.WriteEndGame(sw, rom, new List<string>(), new List<string>(), lastparent, _datdata, 0, out last, _logger);
|
rom.Name = "-";
|
||||||
}
|
rom.Size = Constants.SizeZero;
|
||||||
|
rom.CRC = Constants.CRCZero;
|
||||||
|
rom.MD5 = Constants.MD5Zero;
|
||||||
|
rom.SHA1 = Constants.SHA1Zero;
|
||||||
|
}
|
||||||
|
|
||||||
// If we have a new game, output the beginning of the new item
|
// If we have a different game and we're not at the start of the list, output the end of last item
|
||||||
if (lastparent == null || lastparent.ToLowerInvariant() != rom.Game.ToLowerInvariant())
|
int last = 0;
|
||||||
{
|
if (lastparent != null && lastparent.ToLowerInvariant() != rom.Game.ToLowerInvariant())
|
||||||
Output.WriteStartGame(sw, rom, new List<string>(), lastparent, _datdata, 0, last, _logger);
|
{
|
||||||
}
|
Output.WriteEndGame(sw, rom, new List<string>(), new List<string>(), lastparent, _datdata, 0, out last, _logger);
|
||||||
|
}
|
||||||
|
|
||||||
// Write out the rom data
|
// If we have a new game, output the beginning of the new item
|
||||||
if (_datdata.OutputFormat != OutputFormat.SabreDat && _datdata.OutputFormat != OutputFormat.MissFile)
|
if (lastparent == null || lastparent.ToLowerInvariant() != rom.Game.ToLowerInvariant())
|
||||||
{
|
{
|
||||||
Output.WriteRomData(sw, rom, lastparent, _datdata, 0, _logger);
|
Output.WriteStartGame(sw, rom, new List<string>(), lastparent, _datdata, 0, last, _logger);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write out the rom data
|
||||||
|
if (_datdata.OutputFormat != OutputFormat.SabreDat && _datdata.OutputFormat != OutputFormat.MissFile)
|
||||||
|
{
|
||||||
|
Output.WriteRomData(sw, rom, lastparent, _datdata, 0, _logger);
|
||||||
|
}
|
||||||
|
|
||||||
|
lastparent = rom.Game;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastparent = rom.Game;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// If we had roms but not blanks (and not in Romba mode), create an artifical rom for the purposes of outputting
|
// If we had roms but not blanks (and not in Romba mode), create an artifical rom for the purposes of outputting
|
||||||
if (lastparent != null && _datdata.Roms.Count == 0 && !_datdata.Romba)
|
if (lastparent != null && _datdata.Roms.Count == 0)
|
||||||
{
|
{
|
||||||
_datdata.Roms.Add("temp", new List<RomData>());
|
_datdata.Roms.Add("temp", new List<RomData>());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now write the final piece and close the output stream
|
// Now write the final piece and close the output stream
|
||||||
|
|||||||
Reference in New Issue
Block a user