[SabreTools, DatFiles/] Add flag for keeping empty games instead of making it default

This commit is contained in:
Matt Nadareski
2018-02-14 12:09:18 -08:00
parent aad04c42ac
commit a8460d6ff8
11 changed files with 104 additions and 38 deletions

View File

@@ -652,16 +652,19 @@ namespace SabreTools.Library.DatFiles
// If no items were found for this machine, add a Blank placeholder
if (!containsItems)
{
Blank blank = new Blank()
if (this.KeepEmptyGames)
{
SystemID = sysid,
System = filename,
SourceID = srcid,
};
blank.CopyMachineInformation(machine);
Blank blank = new Blank()
{
SystemID = sysid,
System = filename,
SourceID = srcid,
};
blank.CopyMachineInformation(machine);
// Now process and add the rom
ParseAddHelper(blank, clean, remUnicode);
// Now process and add the rom
ParseAddHelper(blank, clean, remUnicode);
}
}
}

View File

@@ -451,6 +451,27 @@ namespace SabreTools.Library.DatFiles
_datHeader.ExcludeOf = value;
}
}
public bool KeepEmptyGames
{
get
{
if (_datHeader == null)
{
_datHeader = new DatHeader();
}
return _datHeader.KeepEmptyGames;
}
set
{
if (_datHeader == null)
{
_datHeader = new DatHeader();
}
_datHeader.KeepEmptyGames = value;
}
}
public bool SceneDateStrip
{
get

View File

@@ -32,6 +32,7 @@ namespace SabreTools.Library.DatFiles
private ForcePacking _forcePacking;
private DatFormat _datFormat;
private bool _excludeOf;
private bool _keepEmptyGames;
private bool _sceneDateStrip;
private DedupeType _dedupeRoms;
private Hash _stripHash;
@@ -147,6 +148,11 @@ namespace SabreTools.Library.DatFiles
get { return _excludeOf; }
set { _excludeOf = value; }
}
public bool KeepEmptyGames
{
get { return _keepEmptyGames; }
set { _keepEmptyGames = value; }
}
public bool SceneDateStrip
{
get { return _sceneDateStrip; }
@@ -243,6 +249,7 @@ namespace SabreTools.Library.DatFiles
_forcePacking = this._forcePacking,
_datFormat = this._datFormat,
_excludeOf = this._excludeOf,
_keepEmptyGames = this._keepEmptyGames,
_sceneDateStrip = this._sceneDateStrip,
_dedupeRoms = this._dedupeRoms,
_stripHash = this._stripHash,

View File

@@ -494,17 +494,19 @@ namespace SabreTools.Library.DatFiles
// If no items were found for this machine, add a Blank placeholder
if (!containsItems)
{
Blank blank = new Blank()
if (this.KeepEmptyGames)
{
SystemID = sysid,
System = filename,
SourceID = srcid,
};
Blank blank = new Blank()
{
SystemID = sysid,
System = filename,
SourceID = srcid,
};
blank.CopyMachineInformation(machine);
blank.CopyMachineInformation(machine);
// Now process and add the rom
key = ParseAddHelper(blank, clean, remUnicode);
// Now process and add the rom
ParseAddHelper(blank, clean, remUnicode);
}
}
}

View File

@@ -534,17 +534,19 @@ namespace SabreTools.Library.DatFiles
// If no items were found for this machine, add a Blank placeholder
if (!containsItems)
{
Blank blank = new Blank()
if (this.KeepEmptyGames)
{
SystemID = sysid,
System = filename,
SourceID = srcid,
};
Blank blank = new Blank()
{
SystemID = sysid,
System = filename,
SourceID = srcid,
};
blank.CopyMachineInformation(machine);
blank.CopyMachineInformation(machine);
// Now process and add the rom
key = ParseAddHelper(blank, clean, remUnicode);
// Now process and add the rom
ParseAddHelper(blank, clean, remUnicode);
}
}
}

View File

@@ -462,11 +462,18 @@ namespace SabreTools.Library.DatFiles
break;
default:
// By default, create a new Blank, just in case
datItem = new Blank();
if (this.KeepEmptyGames)
{
datItem = new Blank();
}
else
{
datItem = null;
}
break;
}
datItem.CopyMachineInformation(dir);
datItem?.CopyMachineInformation(dir);
// Now process and add the rom
key = ParseAddHelper(datItem, clean, remUnicode);

View File

@@ -231,17 +231,19 @@ namespace SabreTools.Library.DatFiles
// If no items were found for this machine, add a Blank placeholder
if (!containsItems)
{
Blank blank = new Blank()
if (this.KeepEmptyGames)
{
SystemID = sysid,
System = filename,
SourceID = srcid,
};
Blank blank = new Blank()
{
SystemID = sysid,
System = filename,
SourceID = srcid,
};
blank.CopyMachineInformation(machine);
blank.CopyMachineInformation(machine);
// Now process and add the rom
key = ParseAddHelper(blank, clean, remUnicode);
// Now process and add the rom
ParseAddHelper(blank, clean, remUnicode);
}
}
}