mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DATFromDir] Romba ignores all empty folders
This commit is contained in:
@@ -305,43 +305,13 @@ namespace SabreTools
|
|||||||
lastparent = ProcessFile(subitem, sw, lastparent);
|
lastparent = ProcessFile(subitem, sw, lastparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there were no subitems, add a "blank" game to to the set
|
// In romba mode we ignore empty folders completely
|
||||||
if (!items)
|
if (!_datdata.Romba)
|
||||||
{
|
{
|
||||||
string actualroot = item.Remove(0, basePathBackup.Length);
|
// If there were no subitems, add a "blank" game to to the set (if not in Romba mode)
|
||||||
RomData rom = new RomData
|
if (!items)
|
||||||
{
|
{
|
||||||
Name = "null",
|
string actualroot = item.Remove(0, basePathBackup.Length);
|
||||||
Game = (_datdata.Type == "SuperDAT" ?
|
|
||||||
_datdata.Name + (actualroot != "" && !actualroot.StartsWith(Path.DirectorySeparatorChar.ToString()) ?
|
|
||||||
Path.DirectorySeparatorChar.ToString() :
|
|
||||||
"") + actualroot :
|
|
||||||
actualroot),
|
|
||||||
Size = -1,
|
|
||||||
CRC = "null",
|
|
||||||
MD5 = "null",
|
|
||||||
SHA1 = "null",
|
|
||||||
};
|
|
||||||
|
|
||||||
string key = rom.Size + "-" + rom.CRC;
|
|
||||||
if (_datdata.Roms.ContainsKey(key))
|
|
||||||
{
|
|
||||||
_datdata.Roms[key].Add(rom);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
List<RomData> temp = new List<RomData>();
|
|
||||||
temp.Add(rom);
|
|
||||||
_datdata.Roms.Add(key, temp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now scour subdirectories for empties and add those as well
|
|
||||||
foreach (string subdir in Directory.EnumerateDirectories(item, "*", SearchOption.AllDirectories))
|
|
||||||
{
|
|
||||||
if (Directory.EnumerateFiles(subdir, "*", SearchOption.AllDirectories).Count() == 0)
|
|
||||||
{
|
|
||||||
string actualroot = subdir.Remove(0, basePathBackup.Length);
|
|
||||||
RomData rom = new RomData
|
RomData rom = new RomData
|
||||||
{
|
{
|
||||||
Name = "null",
|
Name = "null",
|
||||||
@@ -368,6 +338,40 @@ namespace SabreTools
|
|||||||
_datdata.Roms.Add(key, temp);
|
_datdata.Roms.Add(key, temp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Now scour subdirectories for empties and add those as well (if not in Romba mode)
|
||||||
|
foreach (string subdir in Directory.EnumerateDirectories(item, "*", SearchOption.AllDirectories))
|
||||||
|
{
|
||||||
|
if (Directory.EnumerateFiles(subdir, "*", SearchOption.AllDirectories).Count() == 0)
|
||||||
|
{
|
||||||
|
string actualroot = subdir.Remove(0, basePathBackup.Length);
|
||||||
|
RomData rom = new RomData
|
||||||
|
{
|
||||||
|
Name = "null",
|
||||||
|
Game = (_datdata.Type == "SuperDAT" ?
|
||||||
|
_datdata.Name + (actualroot != "" && !actualroot.StartsWith(Path.DirectorySeparatorChar.ToString()) ?
|
||||||
|
Path.DirectorySeparatorChar.ToString() :
|
||||||
|
"") + actualroot :
|
||||||
|
actualroot),
|
||||||
|
Size = -1,
|
||||||
|
CRC = "null",
|
||||||
|
MD5 = "null",
|
||||||
|
SHA1 = "null",
|
||||||
|
};
|
||||||
|
|
||||||
|
string key = rom.Size + "-" + rom.CRC;
|
||||||
|
if (_datdata.Roms.ContainsKey(key))
|
||||||
|
{
|
||||||
|
_datdata.Roms[key].Add(rom);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
List<RomData> temp = new List<RomData>();
|
||||||
|
temp.Add(rom);
|
||||||
|
_datdata.Roms.Add(key, temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_basePath = basePathBackup;
|
_basePath = basePathBackup;
|
||||||
|
|||||||
@@ -207,6 +207,7 @@ namespace SabreTools.Helper
|
|||||||
rom.Name = gc[i].Replace("\"", "");
|
rom.Name = gc[i].Replace("\"", "");
|
||||||
break;
|
break;
|
||||||
case "size":
|
case "size":
|
||||||
|
|
||||||
Int64.TryParse(gc[i].Replace("\"", ""), out rom.Size);
|
Int64.TryParse(gc[i].Replace("\"", ""), out rom.Size);
|
||||||
break;
|
break;
|
||||||
case "crc":
|
case "crc":
|
||||||
|
|||||||
Reference in New Issue
Block a user