mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[ALL] Rename OutputFormatFlag to OutputFormat
Since the original OutputFormat doesn't exist anymore, adding "Flag" to the var name isn't necessary
This commit is contained in:
@@ -62,7 +62,7 @@ namespace SabreTools
|
|||||||
FileName = Path.GetFileName(inputs[0]) + " Dir2Dat",
|
FileName = Path.GetFileName(inputs[0]) + " Dir2Dat",
|
||||||
Name = Path.GetFileName(inputs[0]) + " Dir2Dat",
|
Name = Path.GetFileName(inputs[0]) + " Dir2Dat",
|
||||||
Description = Path.GetFileName(inputs[0]) + " Dir2Dat",
|
Description = Path.GetFileName(inputs[0]) + " Dir2Dat",
|
||||||
OutputFormatFlag = OutputFormatFlag.Xml,
|
OutputFormat = OutputFormat.Xml,
|
||||||
Files = new Dictionary<string, List<Rom>>(),
|
Files = new Dictionary<string, List<Rom>>(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace SabreTools.Helper
|
|||||||
/// Determines the DAT output format
|
/// Determines the DAT output format
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum OutputFormatFlag
|
public enum OutputFormat
|
||||||
{
|
{
|
||||||
Xml = 0x001,
|
Xml = 0x001,
|
||||||
ClrMamePro = 0x002,
|
ClrMamePro = 0x002,
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ namespace SabreTools.Helper
|
|||||||
public ForceMerging ForceMerging;
|
public ForceMerging ForceMerging;
|
||||||
public ForceNodump ForceNodump;
|
public ForceNodump ForceNodump;
|
||||||
public ForcePacking ForcePacking;
|
public ForcePacking ForcePacking;
|
||||||
public OutputFormatFlag OutputFormatFlag;
|
public OutputFormat OutputFormat;
|
||||||
public bool MergeRoms;
|
public bool MergeRoms;
|
||||||
public List<HashData> Hashes;
|
public List<HashData> Hashes;
|
||||||
|
|
||||||
@@ -318,7 +318,7 @@ namespace SabreTools.Helper
|
|||||||
public ForceMerging ForceMerging;
|
public ForceMerging ForceMerging;
|
||||||
public ForceNodump ForceNodump;
|
public ForceNodump ForceNodump;
|
||||||
public ForcePacking ForcePacking;
|
public ForcePacking ForcePacking;
|
||||||
public OutputFormatFlag OutputFormatFlag;
|
public OutputFormat OutputFormat;
|
||||||
public bool MergeRoms;
|
public bool MergeRoms;
|
||||||
public Dictionary<string, List<Rom>> Files;
|
public Dictionary<string, List<Rom>> Files;
|
||||||
|
|
||||||
@@ -363,7 +363,7 @@ namespace SabreTools.Helper
|
|||||||
ForceMerging = this.ForceMerging,
|
ForceMerging = this.ForceMerging,
|
||||||
ForceNodump = this.ForceNodump,
|
ForceNodump = this.ForceNodump,
|
||||||
ForcePacking = this.ForcePacking,
|
ForcePacking = this.ForcePacking,
|
||||||
OutputFormatFlag = this.OutputFormatFlag,
|
OutputFormat = this.OutputFormat,
|
||||||
MergeRoms = this.MergeRoms,
|
MergeRoms = this.MergeRoms,
|
||||||
Files = this.Files,
|
Files = this.Files,
|
||||||
UseGame = this.UseGame,
|
UseGame = this.UseGame,
|
||||||
@@ -406,7 +406,7 @@ namespace SabreTools.Helper
|
|||||||
ForceMerging = this.ForceMerging,
|
ForceMerging = this.ForceMerging,
|
||||||
ForceNodump = this.ForceNodump,
|
ForceNodump = this.ForceNodump,
|
||||||
ForcePacking = this.ForcePacking,
|
ForcePacking = this.ForcePacking,
|
||||||
OutputFormatFlag = this.OutputFormatFlag,
|
OutputFormat = this.OutputFormat,
|
||||||
MergeRoms = this.MergeRoms,
|
MergeRoms = this.MergeRoms,
|
||||||
Files = new Dictionary<string, List<Rom>>(),
|
Files = new Dictionary<string, List<Rom>>(),
|
||||||
UseGame = this.UseGame,
|
UseGame = this.UseGame,
|
||||||
|
|||||||
@@ -115,13 +115,13 @@ namespace SabreTools
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Create and open the output file for writing
|
// Create and open the output file for writing
|
||||||
FileStream fs = File.Create(Style.CreateOutfileNames(Environment.CurrentDirectory, _datdata)[_datdata.OutputFormatFlag]);
|
FileStream fs = File.Create(Style.CreateOutfileNames(Environment.CurrentDirectory, _datdata)[_datdata.OutputFormat]);
|
||||||
sw = new StreamWriter(fs, Encoding.UTF8);
|
sw = new StreamWriter(fs, Encoding.UTF8);
|
||||||
sw.AutoFlush = true;
|
sw.AutoFlush = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write out the initial file header
|
// Write out the initial file header
|
||||||
DatTools.WriteHeader(sw, _datdata.OutputFormatFlag, _datdata, _logger);
|
DatTools.WriteHeader(sw, _datdata.OutputFormat, _datdata, _logger);
|
||||||
|
|
||||||
// Loop over each of the found paths, if any
|
// Loop over each of the found paths, if any
|
||||||
string lastparent = null;
|
string lastparent = null;
|
||||||
@@ -265,7 +265,7 @@ namespace SabreTools
|
|||||||
Rom rom = roms[i];
|
Rom rom = roms[i];
|
||||||
|
|
||||||
// If we're in a mode that doesn't allow for actual empty folders, add the blank info
|
// If we're in a mode that doesn't allow for actual empty folders, add the blank info
|
||||||
if ((_datdata.OutputFormatFlag & OutputFormatFlag.SabreDat) == 0 && (_datdata.OutputFormatFlag & OutputFormatFlag.MissFile) == 0)
|
if ((_datdata.OutputFormat & OutputFormat.SabreDat) == 0 && (_datdata.OutputFormat & OutputFormat.MissFile) == 0)
|
||||||
{
|
{
|
||||||
rom.Type = ItemType.Rom;
|
rom.Type = ItemType.Rom;
|
||||||
rom.Name = "-";
|
rom.Name = "-";
|
||||||
@@ -295,19 +295,19 @@ namespace SabreTools
|
|||||||
int last = 0;
|
int last = 0;
|
||||||
if (lastparent != null && lastparent.ToLowerInvariant() != rom.Machine.Name.ToLowerInvariant())
|
if (lastparent != null && lastparent.ToLowerInvariant() != rom.Machine.Name.ToLowerInvariant())
|
||||||
{
|
{
|
||||||
DatTools.WriteEndGame(sw, _datdata.OutputFormatFlag, rom, new List<string>(), new List<string>(), lastparent, 0, out last, _logger);
|
DatTools.WriteEndGame(sw, _datdata.OutputFormat, rom, new List<string>(), new List<string>(), lastparent, 0, out last, _logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have a new game, output the beginning of the new item
|
// If we have a new game, output the beginning of the new item
|
||||||
if (lastparent == null || lastparent.ToLowerInvariant() != rom.Machine.Name.ToLowerInvariant())
|
if (lastparent == null || lastparent.ToLowerInvariant() != rom.Machine.Name.ToLowerInvariant())
|
||||||
{
|
{
|
||||||
DatTools.WriteStartGame(sw, _datdata.OutputFormatFlag, rom, new List<string>(), lastparent, 0, last, _logger);
|
DatTools.WriteStartGame(sw, _datdata.OutputFormat, rom, new List<string>(), lastparent, 0, last, _logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write out the rom data
|
// Write out the rom data
|
||||||
if ((_datdata.OutputFormatFlag & OutputFormatFlag.SabreDat) == 0 && (_datdata.OutputFormatFlag & OutputFormatFlag.MissFile) == 0)
|
if ((_datdata.OutputFormat & OutputFormat.SabreDat) == 0 && (_datdata.OutputFormat & OutputFormat.MissFile) == 0)
|
||||||
{
|
{
|
||||||
DatTools.WriteRomData(sw, _datdata.OutputFormatFlag, rom, lastparent, _datdata, 0, _logger);
|
DatTools.WriteRomData(sw, _datdata.OutputFormat, rom, lastparent, _datdata, 0, _logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -323,7 +323,7 @@ namespace SabreTools
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now write the final piece and close the output stream
|
// Now write the final piece and close the output stream
|
||||||
DatTools.WriteFooter(sw, _datdata.OutputFormatFlag, _datdata, 0, _logger);
|
DatTools.WriteFooter(sw, _datdata.OutputFormat, _datdata, 0, _logger);
|
||||||
sw.Close();
|
sw.Close();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -369,9 +369,9 @@ namespace SabreTools
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DatTools.WriteStartGame(sw, _datdata.OutputFormatFlag, rom, new List<string>(), "", 0, 0, _logger);
|
DatTools.WriteStartGame(sw, _datdata.OutputFormat, rom, new List<string>(), "", 0, 0, _logger);
|
||||||
DatTools.WriteRomData(sw, _datdata.OutputFormatFlag, rom, "", _datdata, 0, _logger);
|
DatTools.WriteRomData(sw, _datdata.OutputFormat, rom, "", _datdata, 0, _logger);
|
||||||
DatTools.WriteEndGame(sw, _datdata.OutputFormatFlag, rom, new List<string>(), new List<string>(), "", 0, out last, _logger);
|
DatTools.WriteEndGame(sw, _datdata.OutputFormat, rom, new List<string>(), new List<string>(), "", 0, out last, _logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -548,17 +548,17 @@ namespace SabreTools
|
|||||||
int last = 0;
|
int last = 0;
|
||||||
if (lastparent != null && lastparent.ToLowerInvariant() != rom.Machine.Name.ToLowerInvariant())
|
if (lastparent != null && lastparent.ToLowerInvariant() != rom.Machine.Name.ToLowerInvariant())
|
||||||
{
|
{
|
||||||
DatTools.WriteEndGame(sw, datdata.OutputFormatFlag, rom, new List<string>(), new List<string>(), lastparent, 0, out last, _logger);
|
DatTools.WriteEndGame(sw, datdata.OutputFormat, rom, new List<string>(), new List<string>(), lastparent, 0, out last, _logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have a new game, output the beginning of the new item
|
// If we have a new game, output the beginning of the new item
|
||||||
if (lastparent == null || lastparent.ToLowerInvariant() != rom.Machine.Name.ToLowerInvariant())
|
if (lastparent == null || lastparent.ToLowerInvariant() != rom.Machine.Name.ToLowerInvariant())
|
||||||
{
|
{
|
||||||
DatTools.WriteStartGame(sw, datdata.OutputFormatFlag, rom, new List<string>(), lastparent, 0, last, _logger);
|
DatTools.WriteStartGame(sw, datdata.OutputFormat, rom, new List<string>(), lastparent, 0, last, _logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write out the rom data
|
// Write out the rom data
|
||||||
DatTools.WriteRomData(sw, datdata.OutputFormatFlag, rom, lastparent, datdata, 0, _logger);
|
DatTools.WriteRomData(sw, datdata.OutputFormat, rom, lastparent, datdata, 0, _logger);
|
||||||
}
|
}
|
||||||
_logger.User("File added: " + actualitem + Environment.NewLine);
|
_logger.User("File added: " + actualitem + Environment.NewLine);
|
||||||
|
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ namespace SabreTools
|
|||||||
Category = "The Wizard of DATz",
|
Category = "The Wizard of DATz",
|
||||||
Author = "The Wizard of DATz",
|
Author = "The Wizard of DATz",
|
||||||
ForcePacking = ForcePacking.None,
|
ForcePacking = ForcePacking.None,
|
||||||
OutputFormatFlag = (_old ? OutputFormatFlag.ClrMamePro : OutputFormatFlag.Xml),
|
OutputFormat = (_old ? OutputFormat.ClrMamePro : OutputFormat.Xml),
|
||||||
Files = dict,
|
Files = dict,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ namespace SabreTools
|
|||||||
Category = "SabreTools",
|
Category = "SabreTools",
|
||||||
Author = "SabreTools",
|
Author = "SabreTools",
|
||||||
ForcePacking = ForcePacking.None,
|
ForcePacking = ForcePacking.None,
|
||||||
OutputFormatFlag = (_old ? OutputFormatFlag.ClrMamePro : OutputFormatFlag.Xml),
|
OutputFormat = (_old ? OutputFormat.ClrMamePro : OutputFormat.Xml),
|
||||||
MergeRoms = true,
|
MergeRoms = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ namespace SabreTools
|
|||||||
Category = "",
|
Category = "",
|
||||||
Author = "SabreTools",
|
Author = "SabreTools",
|
||||||
ForcePacking = ForcePacking.None,
|
ForcePacking = ForcePacking.None,
|
||||||
OutputFormatFlag = OutputFormatFlag.Xml,
|
OutputFormat = OutputFormat.Xml,
|
||||||
MergeRoms = true,
|
MergeRoms = true,
|
||||||
Files = netNew,
|
Files = netNew,
|
||||||
};
|
};
|
||||||
@@ -317,7 +317,7 @@ namespace SabreTools
|
|||||||
Category = "",
|
Category = "",
|
||||||
Author = "SabreTools",
|
Author = "SabreTools",
|
||||||
ForcePacking = ForcePacking.None,
|
ForcePacking = ForcePacking.None,
|
||||||
OutputFormatFlag = OutputFormatFlag.Xml,
|
OutputFormat = OutputFormat.Xml,
|
||||||
MergeRoms = true,
|
MergeRoms = true,
|
||||||
Files = unneeded,
|
Files = unneeded,
|
||||||
};
|
};
|
||||||
@@ -330,7 +330,7 @@ namespace SabreTools
|
|||||||
Category = "",
|
Category = "",
|
||||||
Author = "SabreTools",
|
Author = "SabreTools",
|
||||||
ForcePacking = ForcePacking.None,
|
ForcePacking = ForcePacking.None,
|
||||||
OutputFormatFlag = OutputFormatFlag.Xml,
|
OutputFormat = OutputFormat.Xml,
|
||||||
MergeRoms = true,
|
MergeRoms = true,
|
||||||
Files = newMissing,
|
Files = newMissing,
|
||||||
};
|
};
|
||||||
@@ -343,7 +343,7 @@ namespace SabreTools
|
|||||||
Category = "",
|
Category = "",
|
||||||
Author = "SabreTools",
|
Author = "SabreTools",
|
||||||
ForcePacking = ForcePacking.None,
|
ForcePacking = ForcePacking.None,
|
||||||
OutputFormatFlag = OutputFormatFlag.Xml,
|
OutputFormat = OutputFormat.Xml,
|
||||||
MergeRoms = true,
|
MergeRoms = true,
|
||||||
Files = have,
|
Files = have,
|
||||||
};
|
};
|
||||||
@@ -417,7 +417,7 @@ namespace SabreTools
|
|||||||
Category = "",
|
Category = "",
|
||||||
Author = "SabreTools",
|
Author = "SabreTools",
|
||||||
ForcePacking = ForcePacking.None,
|
ForcePacking = ForcePacking.None,
|
||||||
OutputFormatFlag = OutputFormatFlag.Xml,
|
OutputFormat = OutputFormat.Xml,
|
||||||
MergeRoms = true,
|
MergeRoms = true,
|
||||||
Files = have,
|
Files = have,
|
||||||
};
|
};
|
||||||
@@ -487,7 +487,7 @@ namespace SabreTools
|
|||||||
Category = "",
|
Category = "",
|
||||||
Author = "SabreTools",
|
Author = "SabreTools",
|
||||||
ForcePacking = ForcePacking.None,
|
ForcePacking = ForcePacking.None,
|
||||||
OutputFormatFlag = OutputFormatFlag.Xml,
|
OutputFormat = OutputFormat.Xml,
|
||||||
MergeRoms = true,
|
MergeRoms = true,
|
||||||
Files = have,
|
Files = have,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace SabreTools.Helper
|
|||||||
datdata.FileName = (String.IsNullOrEmpty(datdata.FileName) ? (keepext ? Path.GetFileName(filename) : Path.GetFileNameWithoutExtension(filename)) : datdata.FileName);
|
datdata.FileName = (String.IsNullOrEmpty(datdata.FileName) ? (keepext ? Path.GetFileName(filename) : Path.GetFileNameWithoutExtension(filename)) : datdata.FileName);
|
||||||
|
|
||||||
// If the output type isn't set already, get the internal output type
|
// If the output type isn't set already, get the internal output type
|
||||||
datdata.OutputFormatFlag = (datdata.OutputFormatFlag == 0 ? DatTools.GetOutputFormat(filename, logger) : datdata.OutputFormatFlag);
|
datdata.OutputFormat = (datdata.OutputFormat == 0 ? DatTools.GetOutputFormat(filename, logger) : datdata.OutputFormat);
|
||||||
|
|
||||||
// Make sure there's a dictionary to read to
|
// Make sure there's a dictionary to read to
|
||||||
if (datdata.Hashes == null)
|
if (datdata.Hashes == null)
|
||||||
@@ -50,12 +50,12 @@ namespace SabreTools.Helper
|
|||||||
// Now parse the correct type of DAT
|
// Now parse the correct type of DAT
|
||||||
switch (DatTools.GetOutputFormat(filename, logger))
|
switch (DatTools.GetOutputFormat(filename, logger))
|
||||||
{
|
{
|
||||||
case OutputFormatFlag.ClrMamePro:
|
case OutputFormat.ClrMamePro:
|
||||||
return ParseCMP(filename, sysid, srcid, datdata, logger, keep, clean);
|
return ParseCMP(filename, sysid, srcid, datdata, logger, keep, clean);
|
||||||
case OutputFormatFlag.RomCenter:
|
case OutputFormat.RomCenter:
|
||||||
return ParseRC(filename, sysid, srcid, datdata, logger, clean);
|
return ParseRC(filename, sysid, srcid, datdata, logger, clean);
|
||||||
case OutputFormatFlag.SabreDat:
|
case OutputFormat.SabreDat:
|
||||||
case OutputFormatFlag.Xml:
|
case OutputFormat.Xml:
|
||||||
return ParseXML(filename, sysid, srcid, datdata, logger, keep, clean, softlist);
|
return ParseXML(filename, sysid, srcid, datdata, logger, keep, clean, softlist);
|
||||||
default:
|
default:
|
||||||
return datdata;
|
return datdata;
|
||||||
|
|||||||
@@ -154,10 +154,10 @@ namespace SabreTools.Helper
|
|||||||
/// <param name="datdata">DAT information</param>
|
/// <param name="datdata">DAT information</param>
|
||||||
/// <param name="overwrite">True if we ignore existing files (default), false otherwise</param>
|
/// <param name="overwrite">True if we ignore existing files (default), false otherwise</param>
|
||||||
/// <returns>Dictionary of output formats mapped to file names</returns>
|
/// <returns>Dictionary of output formats mapped to file names</returns>
|
||||||
public static Dictionary<OutputFormatFlag, string> CreateOutfileNames(string outDir, Dat datdata, bool overwrite = true)
|
public static Dictionary<OutputFormat, string> CreateOutfileNames(string outDir, Dat datdata, bool overwrite = true)
|
||||||
{
|
{
|
||||||
// Create the output dictionary
|
// Create the output dictionary
|
||||||
Dictionary<OutputFormatFlag, string> outfileNames = new Dictionary<OutputFormatFlag, string>();
|
Dictionary<OutputFormat, string> outfileNames = new Dictionary<OutputFormat, string>();
|
||||||
|
|
||||||
// Double check the outdir for the end delim
|
// Double check the outdir for the end delim
|
||||||
if (!outDir.EndsWith(Path.DirectorySeparatorChar.ToString()))
|
if (!outDir.EndsWith(Path.DirectorySeparatorChar.ToString()))
|
||||||
@@ -166,41 +166,41 @@ namespace SabreTools.Helper
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the extensions from the output type
|
// Get the extensions from the output type
|
||||||
if ((datdata.OutputFormatFlag & OutputFormatFlag.Xml) != 0)
|
if ((datdata.OutputFormat & OutputFormat.Xml) != 0)
|
||||||
{
|
{
|
||||||
outfileNames.Add(OutputFormatFlag.Xml, CreateOutfileNamesHelper(outDir, ".xml", datdata, overwrite));
|
outfileNames.Add(OutputFormat.Xml, CreateOutfileNamesHelper(outDir, ".xml", datdata, overwrite));
|
||||||
};
|
};
|
||||||
if ((datdata.OutputFormatFlag & OutputFormatFlag.ClrMamePro) != 0)
|
if ((datdata.OutputFormat & OutputFormat.ClrMamePro) != 0)
|
||||||
{
|
{
|
||||||
outfileNames.Add(OutputFormatFlag.ClrMamePro, CreateOutfileNamesHelper(outDir, ".dat", datdata, overwrite));
|
outfileNames.Add(OutputFormat.ClrMamePro, CreateOutfileNamesHelper(outDir, ".dat", datdata, overwrite));
|
||||||
};
|
};
|
||||||
if ((datdata.OutputFormatFlag & OutputFormatFlag.RomCenter) != 0)
|
if ((datdata.OutputFormat & OutputFormat.RomCenter) != 0)
|
||||||
{
|
{
|
||||||
outfileNames.Add(OutputFormatFlag.RomCenter, CreateOutfileNamesHelper(outDir, ".rc.dat", datdata, overwrite));
|
outfileNames.Add(OutputFormat.RomCenter, CreateOutfileNamesHelper(outDir, ".rc.dat", datdata, overwrite));
|
||||||
};
|
};
|
||||||
if ((datdata.OutputFormatFlag & OutputFormatFlag.DOSCenter) != 0)
|
if ((datdata.OutputFormat & OutputFormat.DOSCenter) != 0)
|
||||||
{
|
{
|
||||||
outfileNames.Add(OutputFormatFlag.DOSCenter, CreateOutfileNamesHelper(outDir, ".dc.dat", datdata, overwrite));
|
outfileNames.Add(OutputFormat.DOSCenter, CreateOutfileNamesHelper(outDir, ".dc.dat", datdata, overwrite));
|
||||||
};
|
};
|
||||||
if ((datdata.OutputFormatFlag & OutputFormatFlag.MissFile) != 0)
|
if ((datdata.OutputFormat & OutputFormat.MissFile) != 0)
|
||||||
{
|
{
|
||||||
outfileNames.Add(OutputFormatFlag.MissFile, CreateOutfileNamesHelper(outDir, ".txt", datdata, overwrite));
|
outfileNames.Add(OutputFormat.MissFile, CreateOutfileNamesHelper(outDir, ".txt", datdata, overwrite));
|
||||||
};
|
};
|
||||||
if ((datdata.OutputFormatFlag & OutputFormatFlag.SabreDat) != 0)
|
if ((datdata.OutputFormat & OutputFormat.SabreDat) != 0)
|
||||||
{
|
{
|
||||||
outfileNames.Add(OutputFormatFlag.SabreDat, CreateOutfileNamesHelper(outDir, ".sd.xml", datdata, overwrite));
|
outfileNames.Add(OutputFormat.SabreDat, CreateOutfileNamesHelper(outDir, ".sd.xml", datdata, overwrite));
|
||||||
};
|
};
|
||||||
if ((datdata.OutputFormatFlag & OutputFormatFlag.RedumpMD5) != 0)
|
if ((datdata.OutputFormat & OutputFormat.RedumpMD5) != 0)
|
||||||
{
|
{
|
||||||
outfileNames.Add(OutputFormatFlag.RedumpMD5, CreateOutfileNamesHelper(outDir, ".md5", datdata, overwrite));
|
outfileNames.Add(OutputFormat.RedumpMD5, CreateOutfileNamesHelper(outDir, ".md5", datdata, overwrite));
|
||||||
};
|
};
|
||||||
if ((datdata.OutputFormatFlag & OutputFormatFlag.RedumpSHA1) != 0)
|
if ((datdata.OutputFormat & OutputFormat.RedumpSHA1) != 0)
|
||||||
{
|
{
|
||||||
outfileNames.Add(OutputFormatFlag.RedumpSHA1, CreateOutfileNamesHelper(outDir, ".sha1", datdata, overwrite));
|
outfileNames.Add(OutputFormat.RedumpSHA1, CreateOutfileNamesHelper(outDir, ".sha1", datdata, overwrite));
|
||||||
};
|
};
|
||||||
if ((datdata.OutputFormatFlag & OutputFormatFlag.RedumpSFV) != 0)
|
if ((datdata.OutputFormat & OutputFormat.RedumpSFV) != 0)
|
||||||
{
|
{
|
||||||
outfileNames.Add(OutputFormatFlag.RedumpSFV, CreateOutfileNamesHelper(outDir, ".sfv", datdata, overwrite));
|
outfileNames.Add(OutputFormat.RedumpSFV, CreateOutfileNamesHelper(outDir, ".sfv", datdata, overwrite));
|
||||||
};
|
};
|
||||||
|
|
||||||
return outfileNames;
|
return outfileNames;
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ namespace SabreTools
|
|||||||
/// <param name="forcemerge">None, Split, Full</param>
|
/// <param name="forcemerge">None, Split, Full</param>
|
||||||
/// <param name="forcend">None, Obsolete, Required, Ignore</param>
|
/// <param name="forcend">None, Obsolete, Required, Ignore</param>
|
||||||
/// <param name="forcepack">None, Zip, Unzip</param>
|
/// <param name="forcepack">None, Zip, Unzip</param>
|
||||||
/// <param name="outputFormatFlag">Non-zero flag for output format, zero otherwise for default</param>
|
/// <param name="outputFormat">Non-zero flag for output format, zero otherwise for default</param>
|
||||||
/// /* Missfile-specific DAT info */
|
/// /* Missfile-specific DAT info */
|
||||||
/// <param name="usegame">True if games are to be used in output, false if roms are</param>
|
/// <param name="usegame">True if games are to be used in output, false if roms are</param>
|
||||||
/// <param name="prefix">Generic prefix to be added to each line</param>
|
/// <param name="prefix">Generic prefix to be added to each line</param>
|
||||||
@@ -152,7 +152,7 @@ namespace SabreTools
|
|||||||
string forcemerge,
|
string forcemerge,
|
||||||
string forcend,
|
string forcend,
|
||||||
string forcepack,
|
string forcepack,
|
||||||
OutputFormatFlag outputFormatFlag,
|
OutputFormat outputFormat,
|
||||||
|
|
||||||
/* Missfile-specific DAT info */
|
/* Missfile-specific DAT info */
|
||||||
bool usegame,
|
bool usegame,
|
||||||
@@ -303,7 +303,7 @@ namespace SabreTools
|
|||||||
ForceNodump = fn,
|
ForceNodump = fn,
|
||||||
ForcePacking = fp,
|
ForcePacking = fp,
|
||||||
MergeRoms = dedup,
|
MergeRoms = dedup,
|
||||||
OutputFormatFlag = outputFormatFlag,
|
OutputFormat = outputFormat,
|
||||||
|
|
||||||
UseGame = usegame,
|
UseGame = usegame,
|
||||||
Prefix = prefix,
|
Prefix = prefix,
|
||||||
@@ -316,7 +316,7 @@ namespace SabreTools
|
|||||||
XSV = tsv,
|
XSV = tsv,
|
||||||
};
|
};
|
||||||
|
|
||||||
DatTools.UpdateParallel(inputs, userInputDat, outputFormatFlag, outdir, merge, diffMode, cascade, inplace, skip, bare, clean, softlist,
|
DatTools.UpdateParallel(inputs, userInputDat, outputFormat, outdir, merge, diffMode, cascade, inplace, skip, bare, clean, softlist,
|
||||||
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, maxDegreeOfParallelism, _logger);
|
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, maxDegreeOfParallelism, _logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,7 +369,7 @@ namespace SabreTools
|
|||||||
Date = DateTime.Now.ToString("yyyy-MM-dd"),
|
Date = DateTime.Now.ToString("yyyy-MM-dd"),
|
||||||
Author = author,
|
Author = author,
|
||||||
ForcePacking = (forceunpack ? ForcePacking.Unzip : ForcePacking.None),
|
ForcePacking = (forceunpack ? ForcePacking.Unzip : ForcePacking.None),
|
||||||
OutputFormatFlag = (old ? OutputFormatFlag.ClrMamePro : OutputFormatFlag.Xml),
|
OutputFormat = (old ? OutputFormat.ClrMamePro : OutputFormat.Xml),
|
||||||
Romba = romba,
|
Romba = romba,
|
||||||
Type = (superdat ? "SuperDAT" : ""),
|
Type = (superdat ? "SuperDAT" : ""),
|
||||||
Files = new Dictionary<string, List<Rom>>(),
|
Files = new Dictionary<string, List<Rom>>(),
|
||||||
@@ -437,7 +437,7 @@ namespace SabreTools
|
|||||||
Date = DateTime.Now.ToString("yyyy-MM-dd"),
|
Date = DateTime.Now.ToString("yyyy-MM-dd"),
|
||||||
Author = author,
|
Author = author,
|
||||||
ForcePacking = (forceunpack ? ForcePacking.Unzip : ForcePacking.None),
|
ForcePacking = (forceunpack ? ForcePacking.Unzip : ForcePacking.None),
|
||||||
OutputFormatFlag = (old ? OutputFormatFlag.ClrMamePro : OutputFormatFlag.Xml),
|
OutputFormat = (old ? OutputFormat.ClrMamePro : OutputFormat.Xml),
|
||||||
Romba = romba,
|
Romba = romba,
|
||||||
Type = (superdat ? "SuperDAT" : ""),
|
Type = (superdat ? "SuperDAT" : ""),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ Make a selection:
|
|||||||
private static void ConvertMenu()
|
private static void ConvertMenu()
|
||||||
{
|
{
|
||||||
string selection = "", input = "", outdir = "";
|
string selection = "", input = "", outdir = "";
|
||||||
OutputFormatFlag outputFormatFlag = OutputFormatFlag.Xml;
|
OutputFormat outputFormat = OutputFormat.Xml;
|
||||||
while (selection.ToLowerInvariant() != "b")
|
while (selection.ToLowerInvariant() != "b")
|
||||||
{
|
{
|
||||||
Console.Clear();
|
Console.Clear();
|
||||||
@@ -252,7 +252,7 @@ Make a selection:
|
|||||||
|
|
||||||
1) File or folder to convert" + (input == "" ? "" : ":\n" + input) + @"
|
1) File or folder to convert" + (input == "" ? "" : ":\n" + input) + @"
|
||||||
2) New output folder" + (outdir == "" ? " (blank means source directory)" : ":\n" + outdir) + @"
|
2) New output folder" + (outdir == "" ? " (blank means source directory)" : ":\n" + outdir) + @"
|
||||||
3) Current output type: " + (outputFormatFlag.ToString()) + @"
|
3) Current output type: " + (outputFormat.ToString()) + @"
|
||||||
4) Process file or folder
|
4) Process file or folder
|
||||||
B) Go back to the previous menu
|
B) Go back to the previous menu
|
||||||
");
|
");
|
||||||
@@ -287,16 +287,16 @@ Make a selection:
|
|||||||
switch (subsel)
|
switch (subsel)
|
||||||
{
|
{
|
||||||
case "1":
|
case "1":
|
||||||
outputFormatFlag = OutputFormatFlag.Xml;
|
outputFormat = OutputFormat.Xml;
|
||||||
break;
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
outputFormatFlag = OutputFormatFlag.ClrMamePro;
|
outputFormat = OutputFormat.ClrMamePro;
|
||||||
break;
|
break;
|
||||||
case "3":
|
case "3":
|
||||||
outputFormatFlag = OutputFormatFlag.RomCenter;
|
outputFormat = OutputFormat.RomCenter;
|
||||||
break;
|
break;
|
||||||
case "4":
|
case "4":
|
||||||
outputFormatFlag = OutputFormatFlag.SabreDat;
|
outputFormat = OutputFormat.SabreDat;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
subsel = "";
|
subsel = "";
|
||||||
@@ -310,14 +310,14 @@ Make a selection:
|
|||||||
temp.Add(input);
|
temp.Add(input);
|
||||||
/*
|
/*
|
||||||
InitUpdate(temp, "", "", "", "", "", "", "", "", "", "", "", "", false, "", "", "",
|
InitUpdate(temp, "", "", "", "", "", "", "", "", "", "", "", "", false, "", "", "",
|
||||||
(outputFormatFlag == OutputFormatFlag.ClrMamePro), (outputFormatFlag == OutputFormatFlag.MissFile), (outputFormatFlag == OutputFormatFlag.RomCenter),
|
(outputFormat == OutputFormat.ClrMamePro), (outputFormat == OutputFormat.MissFile), (outputFormat == OutputFormat.RomCenter),
|
||||||
(outputFormatFlag == OutputFormatFlag.SabreDat), (outputFormatFlag == OutputFormatFlag.Xml), false, "", "", false, "", "", false, false, false,
|
(outputFormat == OutputFormat.SabreDat), (outputFormat == OutputFormat.Xml), false, "", "", false, "", "", false, false, false,
|
||||||
false, false, false, false, false, "", "", "", -1, -1, -1, "", "", "", null, outdir, false, false);
|
false, false, false, false, false, "", "", "", -1, -1, -1, "", "", "", null, outdir, false, false);
|
||||||
*/
|
*/
|
||||||
Console.Write("\nPress any key to continue...");
|
Console.Write("\nPress any key to continue...");
|
||||||
Console.ReadKey();
|
Console.ReadKey();
|
||||||
input = ""; outdir = "";
|
input = ""; outdir = "";
|
||||||
outputFormatFlag = OutputFormatFlag.Xml;
|
outputFormat = OutputFormat.Xml;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ namespace SabreTools
|
|||||||
long sgt = -1,
|
long sgt = -1,
|
||||||
slt = -1,
|
slt = -1,
|
||||||
seq = -1;
|
seq = -1;
|
||||||
OutputFormatFlag outputFormatFlag = 0x0;
|
OutputFormat outputFormat = 0x0;
|
||||||
string addext = "",
|
string addext = "",
|
||||||
author = "",
|
author = "",
|
||||||
category = "",
|
category = "",
|
||||||
@@ -189,19 +189,19 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-cc":
|
case "-cc":
|
||||||
case "--convert-cmp":
|
case "--convert-cmp":
|
||||||
outputFormatFlag |= OutputFormatFlag.ClrMamePro;
|
outputFormat |= OutputFormat.ClrMamePro;
|
||||||
break;
|
break;
|
||||||
case "-cm":
|
case "-cm":
|
||||||
case "--convert-miss":
|
case "--convert-miss":
|
||||||
outputFormatFlag |= OutputFormatFlag.MissFile;
|
outputFormat |= OutputFormat.MissFile;
|
||||||
break;
|
break;
|
||||||
case "-cr":
|
case "-cr":
|
||||||
case "--convert-rc":
|
case "--convert-rc":
|
||||||
outputFormatFlag |= OutputFormatFlag.RomCenter;
|
outputFormat |= OutputFormat.RomCenter;
|
||||||
break;
|
break;
|
||||||
case "-cs":
|
case "-cs":
|
||||||
case "--convert-sd":
|
case "--convert-sd":
|
||||||
outputFormatFlag |= OutputFormatFlag.SabreDat;
|
outputFormat |= OutputFormat.SabreDat;
|
||||||
break;
|
break;
|
||||||
case "-csv":
|
case "-csv":
|
||||||
case "--csv":
|
case "--csv":
|
||||||
@@ -209,7 +209,7 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-cx":
|
case "-cx":
|
||||||
case "--convert-xml":
|
case "--convert-xml":
|
||||||
outputFormatFlag |= OutputFormatFlag.Xml;
|
outputFormat |= OutputFormat.Xml;
|
||||||
break;
|
break;
|
||||||
case "-clean":
|
case "-clean":
|
||||||
case "--clean":
|
case "--clean":
|
||||||
@@ -327,7 +327,7 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-oc":
|
case "-oc":
|
||||||
case "--output-cmp":
|
case "--output-cmp":
|
||||||
outputFormatFlag |= OutputFormatFlag.ClrMamePro;
|
outputFormat |= OutputFormat.ClrMamePro;
|
||||||
break;
|
break;
|
||||||
case "-ol":
|
case "-ol":
|
||||||
case "--offmerge":
|
case "--offmerge":
|
||||||
@@ -335,31 +335,31 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-om":
|
case "-om":
|
||||||
case "--output-miss":
|
case "--output-miss":
|
||||||
outputFormatFlag |= OutputFormatFlag.MissFile;
|
outputFormat |= OutputFormat.MissFile;
|
||||||
break;
|
break;
|
||||||
case "-omd5":
|
case "-omd5":
|
||||||
case "--output-md5":
|
case "--output-md5":
|
||||||
outputFormatFlag |= OutputFormatFlag.RedumpMD5;
|
outputFormat |= OutputFormat.RedumpMD5;
|
||||||
break;
|
break;
|
||||||
case "-or":
|
case "-or":
|
||||||
case "--output-rc":
|
case "--output-rc":
|
||||||
outputFormatFlag |= OutputFormatFlag.RomCenter;
|
outputFormat |= OutputFormat.RomCenter;
|
||||||
break;
|
break;
|
||||||
case "-os":
|
case "-os":
|
||||||
case "--output-sd":
|
case "--output-sd":
|
||||||
outputFormatFlag |= OutputFormatFlag.SabreDat;
|
outputFormat |= OutputFormat.SabreDat;
|
||||||
break;
|
break;
|
||||||
case "-osfv":
|
case "-osfv":
|
||||||
case "--output-sfv":
|
case "--output-sfv":
|
||||||
outputFormatFlag |= OutputFormatFlag.RedumpSFV;
|
outputFormat |= OutputFormat.RedumpSFV;
|
||||||
break;
|
break;
|
||||||
case "-osha1":
|
case "-osha1":
|
||||||
case "--output-sha1":
|
case "--output-sha1":
|
||||||
outputFormatFlag |= OutputFormatFlag.RedumpSHA1;
|
outputFormat |= OutputFormat.RedumpSHA1;
|
||||||
break;
|
break;
|
||||||
case "-ox":
|
case "-ox":
|
||||||
case "--output-xml":
|
case "--output-xml":
|
||||||
outputFormatFlag |= OutputFormatFlag.Xml;
|
outputFormat |= OutputFormat.Xml;
|
||||||
break;
|
break;
|
||||||
case "-q":
|
case "-q":
|
||||||
case "--quotes":
|
case "--quotes":
|
||||||
@@ -623,7 +623,7 @@ namespace SabreTools
|
|||||||
|
|
||||||
// If more than one switch is enabled, show the help screen
|
// If more than one switch is enabled, show the help screen
|
||||||
if (!(add ^ datfromdir ^ datfromdirparallel ^ extsplit ^ generate ^ genall ^ hashsplit ^ import ^ listsrc ^ listsys ^
|
if (!(add ^ datfromdir ^ datfromdirparallel ^ extsplit ^ generate ^ genall ^ hashsplit ^ import ^ listsrc ^ listsys ^
|
||||||
(merge || diffMode != 0 || update || outputFormatFlag != 0 || tsv != null|| trim) ^ offlineMerge ^ rem ^ stats ^ typesplit))
|
(merge || diffMode != 0 || update || outputFormat != 0 || tsv != null|| trim) ^ offlineMerge ^ rem ^ stats ^ typesplit))
|
||||||
{
|
{
|
||||||
_logger.Error("Only one feature switch is allowed at a time");
|
_logger.Error("Only one feature switch is allowed at a time");
|
||||||
Build.Help();
|
Build.Help();
|
||||||
@@ -632,7 +632,7 @@ namespace SabreTools
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If a switch that requires a filename is set and no file is, show the help screen
|
// If a switch that requires a filename is set and no file is, show the help screen
|
||||||
if (inputs.Count == 0 && (update || outputFormatFlag != 0 || tsv != null || extsplit || hashsplit || datfromdir
|
if (inputs.Count == 0 && (update || outputFormat != 0 || tsv != null || extsplit || hashsplit || datfromdir
|
||||||
|| datfromdirparallel || (merge || diffMode != 0) || stats || trim || typesplit))
|
|| datfromdirparallel || (merge || diffMode != 0) || stats || trim || typesplit))
|
||||||
{
|
{
|
||||||
_logger.Error("This feature requires at least one input");
|
_logger.Error("This feature requires at least one input");
|
||||||
@@ -676,10 +676,10 @@ namespace SabreTools
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Convert, update, merge, diff, and filter a DAT or folder of DATs
|
// Convert, update, merge, diff, and filter a DAT or folder of DATs
|
||||||
else if (update || tsv != null || outputFormatFlag != 0 || merge || diffMode != 0)
|
else if (update || tsv != null || outputFormat != 0 || merge || diffMode != 0)
|
||||||
{
|
{
|
||||||
InitUpdate(inputs, filename, name, description, rootdir, category, version, date, author, email, homepage, url, comment, header,
|
InitUpdate(inputs, filename, name, description, rootdir, category, version, date, author, email, homepage, url, comment, header,
|
||||||
superdat, forcemerge, forcend, forcepack, outputFormatFlag, usegame, prefix,
|
superdat, forcemerge, forcend, forcepack, outputFormat, usegame, prefix,
|
||||||
postfix, quotes, repext, addext, datprefix, romba, tsv, merge, diffMode, cascade, inplace, skip, bare, gamename, romname,
|
postfix, quotes, repext, addext, datprefix, romba, tsv, merge, diffMode, cascade, inplace, skip, bare, gamename, romname,
|
||||||
romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, outdir, clean, softlist, dedup, maxParallelism);
|
romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, outdir, clean, softlist, dedup, maxParallelism);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ namespace SabreTools
|
|||||||
_matched.FileName = "fixDat_" + _matched.FileName;
|
_matched.FileName = "fixDat_" + _matched.FileName;
|
||||||
_matched.Name = "fixDat_" + _matched.Name;
|
_matched.Name = "fixDat_" + _matched.Name;
|
||||||
_matched.Description = "fixDat_" + _matched.Description;
|
_matched.Description = "fixDat_" + _matched.Description;
|
||||||
_matched.OutputFormatFlag = OutputFormatFlag.Xml;
|
_matched.OutputFormat = OutputFormat.Xml;
|
||||||
|
|
||||||
// Now that all files are parsed, get only files found in directory
|
// Now that all files are parsed, get only files found in directory
|
||||||
bool found = false;
|
bool found = false;
|
||||||
@@ -476,7 +476,7 @@ namespace SabreTools
|
|||||||
_datdata.FileName = "fixDat_" + _datdata.FileName;
|
_datdata.FileName = "fixDat_" + _datdata.FileName;
|
||||||
_datdata.Name = "fixDat_" + _datdata.Name;
|
_datdata.Name = "fixDat_" + _datdata.Name;
|
||||||
_datdata.Description = "fixDat_" + _datdata.Description;
|
_datdata.Description = "fixDat_" + _datdata.Description;
|
||||||
_datdata.OutputFormatFlag = OutputFormatFlag.Xml;
|
_datdata.OutputFormat = OutputFormat.Xml;
|
||||||
DatTools.WriteDatfile(_datdata, "", _logger);
|
DatTools.WriteDatfile(_datdata, "", _logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user