mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[ALL] Update way output formats are handled
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",
|
||||||
OutputFormat = OutputFormat.Xml,
|
OutputFormatFlag = OutputFormatFlag.Xml,
|
||||||
Files = new Dictionary<string, List<Rom>>(),
|
Files = new Dictionary<string, List<Rom>>(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -101,23 +101,6 @@
|
|||||||
Unzip,
|
Unzip,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Determines the DAT output format
|
|
||||||
/// </summary>
|
|
||||||
public enum OutputFormat
|
|
||||||
{
|
|
||||||
None = 0,
|
|
||||||
Xml,
|
|
||||||
ClrMamePro,
|
|
||||||
RomCenter,
|
|
||||||
DOSCenter,
|
|
||||||
MissFile,
|
|
||||||
SabreDat,
|
|
||||||
RedumpMD5,
|
|
||||||
RedumpSHA1,
|
|
||||||
RedumpSFV,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines the level to scan archives at
|
/// Determines the level to scan archives at
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -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 OutputFormat OutputFormat;
|
public OutputFormatFlag OutputFormatFlag;
|
||||||
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 OutputFormat OutputFormat;
|
public OutputFormatFlag OutputFormatFlag;
|
||||||
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,
|
||||||
OutputFormat = this.OutputFormat,
|
OutputFormatFlag = this.OutputFormatFlag,
|
||||||
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,
|
||||||
OutputFormat = this.OutputFormat,
|
OutputFormatFlag = this.OutputFormatFlag,
|
||||||
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.CreateOutfileName(Environment.CurrentDirectory, _datdata));
|
FileStream fs = File.Create(Style.CreateOutfileNames(Environment.CurrentDirectory, _datdata)[_datdata.OutputFormatFlag]);
|
||||||
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, _logger);
|
DatTools.WriteHeader(sw, _datdata.OutputFormatFlag, _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.OutputFormat != OutputFormat.SabreDat && _datdata.OutputFormat != OutputFormat.MissFile)
|
if ((_datdata.OutputFormatFlag & OutputFormatFlag.SabreDat) == 0 && (_datdata.OutputFormatFlag & OutputFormatFlag.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, rom, new List<string>(), new List<string>(), lastparent, _datdata, 0, out last, _logger);
|
DatTools.WriteEndGame(sw, _datdata.OutputFormatFlag, 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, rom, new List<string>(), lastparent, _datdata, 0, last, _logger);
|
DatTools.WriteStartGame(sw, _datdata.OutputFormatFlag, rom, new List<string>(), lastparent, 0, last, _logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write out the rom data
|
// Write out the rom data
|
||||||
if (_datdata.OutputFormat != OutputFormat.SabreDat && _datdata.OutputFormat != OutputFormat.MissFile)
|
if ((_datdata.OutputFormatFlag & OutputFormatFlag.SabreDat) == 0 && (_datdata.OutputFormatFlag & OutputFormatFlag.MissFile) == 0)
|
||||||
{
|
{
|
||||||
DatTools.WriteRomData(sw, rom, lastparent, _datdata, 0, _logger);
|
DatTools.WriteRomData(sw, _datdata.OutputFormatFlag, 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, 0, _logger);
|
DatTools.WriteFooter(sw, _datdata.OutputFormatFlag, _datdata, 0, _logger);
|
||||||
sw.Close();
|
sw.Close();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -369,9 +369,9 @@ namespace SabreTools
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DatTools.WriteStartGame(sw, rom, new List<string>(), "", _datdata, 0, 0, _logger);
|
DatTools.WriteStartGame(sw, _datdata.OutputFormatFlag, rom, new List<string>(), "", 0, 0, _logger);
|
||||||
DatTools.WriteRomData(sw, rom, "", _datdata, 0, _logger);
|
DatTools.WriteRomData(sw, _datdata.OutputFormatFlag, rom, "", _datdata, 0, _logger);
|
||||||
DatTools.WriteEndGame(sw, rom, new List<string>(), new List<string>(), "", _datdata, 0, out last, _logger);
|
DatTools.WriteEndGame(sw, _datdata.OutputFormatFlag, 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, rom, new List<string>(), new List<string>(), lastparent, datdata, 0, out last, _logger);
|
DatTools.WriteEndGame(sw, datdata.OutputFormatFlag, 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, rom, new List<string>(), lastparent, datdata, 0, last, _logger);
|
DatTools.WriteStartGame(sw, datdata.OutputFormatFlag, rom, new List<string>(), lastparent, 0, last, _logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write out the rom data
|
// Write out the rom data
|
||||||
DatTools.WriteRomData(sw, rom, lastparent, datdata, 0, _logger);
|
DatTools.WriteRomData(sw, datdata.OutputFormatFlag, 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,
|
||||||
OutputFormat = (_old ? OutputFormat.ClrMamePro : OutputFormat.Xml),
|
OutputFormatFlag = (_old ? OutputFormatFlag.ClrMamePro : OutputFormatFlag.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,
|
||||||
OutputFormat = (_old ? OutputFormat.ClrMamePro : OutputFormat.Xml),
|
OutputFormatFlag = (_old ? OutputFormatFlag.ClrMamePro : OutputFormatFlag.Xml),
|
||||||
MergeRoms = true,
|
MergeRoms = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ namespace SabreTools
|
|||||||
Category = "",
|
Category = "",
|
||||||
Author = "SabreTools",
|
Author = "SabreTools",
|
||||||
ForcePacking = ForcePacking.None,
|
ForcePacking = ForcePacking.None,
|
||||||
OutputFormat = OutputFormat.Xml,
|
OutputFormatFlag = OutputFormatFlag.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,
|
||||||
OutputFormat = OutputFormat.Xml,
|
OutputFormatFlag = OutputFormatFlag.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,
|
||||||
OutputFormat = OutputFormat.Xml,
|
OutputFormatFlag = OutputFormatFlag.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,
|
||||||
OutputFormat = OutputFormat.Xml,
|
OutputFormatFlag = OutputFormatFlag.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,
|
||||||
OutputFormat = OutputFormat.Xml,
|
OutputFormatFlag = OutputFormatFlag.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,
|
||||||
OutputFormat = OutputFormat.Xml,
|
OutputFormatFlag = OutputFormatFlag.Xml,
|
||||||
MergeRoms = true,
|
MergeRoms = true,
|
||||||
Files = have,
|
Files = have,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -21,15 +21,15 @@ namespace SabreTools.Helper
|
|||||||
/// Get what type of DAT the input file is
|
/// Get what type of DAT the input file is
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filename">Name of the file to be parsed</param>
|
/// <param name="filename">Name of the file to be parsed</param>
|
||||||
/// <returns>The OutputFormat corresponding to the DAT</returns>
|
/// <returns>The OutputFormatFlagcorresponding to the DAT</returns>
|
||||||
/// <remarks>There is currently no differentiation between XML and SabreDAT here</remarks>
|
/// <remarks>There is currently no differentiation between XML and SabreDAT here</remarks>
|
||||||
public static OutputFormat GetOutputFormat(string filename, Logger logger)
|
public static OutputFormatFlag GetOutputFormat(string filename, Logger logger)
|
||||||
{
|
{
|
||||||
// Limit the output formats based on extension
|
// Limit the output formats based on extension
|
||||||
string ext = Path.GetExtension(filename).ToLowerInvariant();
|
string ext = Path.GetExtension(filename).ToLowerInvariant();
|
||||||
if (ext != ".dat" && ext != ".xml")
|
if (ext != ".dat" && ext != ".xml")
|
||||||
{
|
{
|
||||||
return OutputFormat.None;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the input file, if possible
|
// Read the input file, if possible
|
||||||
@@ -39,7 +39,7 @@ namespace SabreTools.Helper
|
|||||||
if (!File.Exists(filename))
|
if (!File.Exists(filename))
|
||||||
{
|
{
|
||||||
logger.Warning("File '" + filename + "' could not read from!");
|
logger.Warning("File '" + filename + "' could not read from!");
|
||||||
return OutputFormat.None;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -50,20 +50,20 @@ namespace SabreTools.Helper
|
|||||||
sr.Dispose();
|
sr.Dispose();
|
||||||
if (first.Contains("<") && first.Contains(">"))
|
if (first.Contains("<") && first.Contains(">"))
|
||||||
{
|
{
|
||||||
return OutputFormat.Xml;
|
return OutputFormatFlag.Xml;
|
||||||
}
|
}
|
||||||
else if (first.Contains("[") && first.Contains("]"))
|
else if (first.Contains("[") && first.Contains("]"))
|
||||||
{
|
{
|
||||||
return OutputFormat.RomCenter;
|
return OutputFormatFlag.RomCenter;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return OutputFormat.ClrMamePro;
|
return OutputFormatFlag.ClrMamePro;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
return OutputFormat.None;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,7 +175,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.OutputFormat = (datdata.OutputFormat == OutputFormat.None ? GetOutputFormat(filename, logger) : datdata.OutputFormat);
|
datdata.OutputFormatFlag = (datdata.OutputFormatFlag == 0 ? GetOutputFormat(filename, logger) : datdata.OutputFormatFlag);
|
||||||
|
|
||||||
// Make sure there's a dictionary to read to
|
// Make sure there's a dictionary to read to
|
||||||
if (datdata.Files == null)
|
if (datdata.Files == null)
|
||||||
@@ -186,12 +186,12 @@ namespace SabreTools.Helper
|
|||||||
// Now parse the correct type of DAT
|
// Now parse the correct type of DAT
|
||||||
switch (GetOutputFormat(filename, logger))
|
switch (GetOutputFormat(filename, logger))
|
||||||
{
|
{
|
||||||
case OutputFormat.ClrMamePro:
|
case OutputFormatFlag.ClrMamePro:
|
||||||
return ParseCMP(filename, sysid, srcid, datdata, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, logger, keep, clean);
|
return ParseCMP(filename, sysid, srcid, datdata, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, logger, keep, clean);
|
||||||
case OutputFormat.RomCenter:
|
case OutputFormatFlag.RomCenter:
|
||||||
return ParseRC(filename, sysid, srcid, datdata, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, logger, clean);
|
return ParseRC(filename, sysid, srcid, datdata, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, logger, clean);
|
||||||
case OutputFormat.SabreDat:
|
case OutputFormatFlag.SabreDat:
|
||||||
case OutputFormat.Xml:
|
case OutputFormatFlag.Xml:
|
||||||
return ParseXML(filename, sysid, srcid, datdata, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, logger, keep, clean, softlist);
|
return ParseXML(filename, sysid, srcid, datdata, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, logger, keep, clean, softlist);
|
||||||
default:
|
default:
|
||||||
return datdata;
|
return datdata;
|
||||||
@@ -1779,7 +1779,7 @@ namespace SabreTools.Helper
|
|||||||
root, logger, true, clean, softlist, keepext:(innerDatdata.XSV != null));
|
root, logger, true, clean, softlist, keepext:(innerDatdata.XSV != null));
|
||||||
|
|
||||||
// If the extension matches, append ".new" to the filename
|
// If the extension matches, append ".new" to the filename
|
||||||
string extension = (innerDatdata.OutputFormat == OutputFormat.Xml || innerDatdata.OutputFormat == OutputFormat.SabreDat ? ".xml" : ".dat");
|
string extension = ((innerDatdata.OutputFormatFlag & OutputFormatFlag.Xml) != 0 || (innerDatdata.OutputFormatFlag & OutputFormatFlag.SabreDat) != 0 ? ".xml" : ".dat");
|
||||||
if (outputDirectory == "" && Path.GetExtension(inputFileName) == extension)
|
if (outputDirectory == "" && Path.GetExtension(inputFileName) == extension)
|
||||||
{
|
{
|
||||||
innerDatdata.FileName += ".new";
|
innerDatdata.FileName += ".new";
|
||||||
@@ -1804,7 +1804,7 @@ namespace SabreTools.Helper
|
|||||||
slt, seq, crc, md5, sha1, nodump, trim, single, root, logger, true, clean, keepext:(datdata.XSV != null));
|
slt, seq, crc, md5, sha1, nodump, trim, single, root, logger, true, clean, keepext:(datdata.XSV != null));
|
||||||
|
|
||||||
// If the extension matches, append ".new" to the filename
|
// If the extension matches, append ".new" to the filename
|
||||||
string extension = (innerDatdata.OutputFormat == OutputFormat.Xml || innerDatdata.OutputFormat == OutputFormat.SabreDat ? ".xml" : ".dat");
|
string extension = ((innerDatdata.OutputFormatFlag & OutputFormatFlag.Xml) != 0 || (innerDatdata.OutputFormatFlag & OutputFormatFlag.SabreDat) != 0 ? ".xml" : ".dat");
|
||||||
if (outputDirectory == "" && Path.GetExtension(file) == extension)
|
if (outputDirectory == "" && Path.GetExtension(file) == extension)
|
||||||
{
|
{
|
||||||
innerDatdata.FileName += ".new";
|
innerDatdata.FileName += ".new";
|
||||||
@@ -1856,7 +1856,7 @@ namespace SabreTools.Helper
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
userData = new Dat
|
userData = new Dat
|
||||||
{
|
{
|
||||||
OutputFormat = (inputDat.OutputFormat != OutputFormat.None ? inputDat.OutputFormat : OutputFormat.None),
|
OutputFormatFlag = (inputDat.OutputFormatFlag != 0 ? inputDat.OutputFormatFlag : 0),
|
||||||
Files = new Dictionary<string, List<Rom>>(),
|
Files = new Dictionary<string, List<Rom>>(),
|
||||||
MergeRoms = inputDat.MergeRoms,
|
MergeRoms = inputDat.MergeRoms,
|
||||||
};
|
};
|
||||||
@@ -1876,7 +1876,7 @@ namespace SabreTools.Helper
|
|||||||
Dictionary<string, List<Rom>> temp = userData.Files;
|
Dictionary<string, List<Rom>> temp = userData.Files;
|
||||||
userData = new Dat
|
userData = new Dat
|
||||||
{
|
{
|
||||||
OutputFormat = (inputDat.OutputFormat != OutputFormat.None ? inputDat.OutputFormat : OutputFormat.None),
|
OutputFormatFlag = (inputDat.OutputFormatFlag != 0 ? inputDat.OutputFormatFlag : 0),
|
||||||
Files = temp,
|
Files = temp,
|
||||||
MergeRoms = inputDat.MergeRoms,
|
MergeRoms = inputDat.MergeRoms,
|
||||||
};
|
};
|
||||||
@@ -2424,6 +2424,7 @@ namespace SabreTools.Helper
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inputFileNames">Names of the input files and/or folders</param>
|
/// <param name="inputFileNames">Names of the input files and/or folders</param>
|
||||||
/// <param name="datdata">User specified inputs contained in a DatData object</param>
|
/// <param name="datdata">User specified inputs contained in a DatData object</param>
|
||||||
|
/// <param name="outputFormatFlag">Non-zero flag for output format, zero otherwise for default</param>
|
||||||
/// <param name="outputDirectory">Optional param for output directory</param>
|
/// <param name="outputDirectory">Optional param for output directory</param>
|
||||||
/// <param name="merge">True if input files should be merged into a single file, false otherwise</param>
|
/// <param name="merge">True if input files should be merged into a single file, false otherwise</param>
|
||||||
/// <param name="diff">Non-zero flag for diffing mode, zero otherwise</param>
|
/// <param name="diff">Non-zero flag for diffing mode, zero otherwise</param>
|
||||||
@@ -2448,9 +2449,10 @@ namespace SabreTools.Helper
|
|||||||
/// <param name="root">String representing root directory to compare against for length calculation</param>
|
/// <param name="root">String representing root directory to compare against for length calculation</param>
|
||||||
/// <param name="maxDegreeOfParallelism">Integer representing the maximum amount of parallelization to be used</param>
|
/// <param name="maxDegreeOfParallelism">Integer representing the maximum amount of parallelization to be used</param>
|
||||||
/// <param name="logger">Logging object for console and file output</param>
|
/// <param name="logger">Logging object for console and file output</param>
|
||||||
public static void UpdateParallel(List<string> inputFileNames, Dat datdata, string outputDirectory, bool merge, DiffMode diff, bool? cascade, bool inplace,
|
public static void UpdateParallel(List<string> inputFileNames, Dat datdata, OutputFormatFlag outputFormatFlag, string outputDirectory, bool merge,
|
||||||
bool skip, bool bare, bool clean, bool softlist, string gamename, string romname, string romtype, long sgt, long slt, long seq, string crc,
|
DiffMode diff, bool? cascade, bool inplace, bool skip, bool bare, bool clean, bool softlist, string gamename, string romname, string romtype,
|
||||||
string md5, string sha1, bool? nodump, bool trim, bool single, string root, int maxDegreeOfParallelism, Logger logger)
|
long sgt, long slt, long seq, string crc, string md5, string sha1, bool? nodump, bool trim, bool single, string root, int maxDegreeOfParallelism,
|
||||||
|
Logger logger)
|
||||||
{
|
{
|
||||||
// If we're in merging or diffing mode, use the full list of inputs
|
// If we're in merging or diffing mode, use the full list of inputs
|
||||||
if (merge || diff != 0)
|
if (merge || diff != 0)
|
||||||
@@ -2544,7 +2546,7 @@ namespace SabreTools.Helper
|
|||||||
root, logger, true, clean, softlist, keepext: (innerDatdata.XSV != null));
|
root, logger, true, clean, softlist, keepext: (innerDatdata.XSV != null));
|
||||||
|
|
||||||
// If the extension matches, append ".new" to the filename
|
// If the extension matches, append ".new" to the filename
|
||||||
string extension = (innerDatdata.OutputFormat == OutputFormat.Xml || innerDatdata.OutputFormat == OutputFormat.SabreDat ? ".xml" : ".dat");
|
string extension = ((innerDatdata.OutputFormatFlag & OutputFormatFlag.Xml) != 0 || (innerDatdata.OutputFormatFlag & OutputFormatFlag.SabreDat) != 0 ? ".xml" : ".dat");
|
||||||
if (outputDirectory == "" && Path.GetExtension(inputFileName) == extension)
|
if (outputDirectory == "" && Path.GetExtension(inputFileName) == extension)
|
||||||
{
|
{
|
||||||
innerDatdata.FileName += ".new";
|
innerDatdata.FileName += ".new";
|
||||||
@@ -2571,7 +2573,7 @@ namespace SabreTools.Helper
|
|||||||
slt, seq, crc, md5, sha1, nodump, trim, single, root, logger, true, clean, keepext: (datdata.XSV != null));
|
slt, seq, crc, md5, sha1, nodump, trim, single, root, logger, true, clean, keepext: (datdata.XSV != null));
|
||||||
|
|
||||||
// If the extension matches, append ".new" to the filename
|
// If the extension matches, append ".new" to the filename
|
||||||
string extension = (innerDatdata.OutputFormat == OutputFormat.Xml || innerDatdata.OutputFormat == OutputFormat.SabreDat ? ".xml" : ".dat");
|
string extension = ((innerDatdata.OutputFormatFlag & OutputFormatFlag.Xml) != 0 || (innerDatdata.OutputFormatFlag & OutputFormatFlag.SabreDat) != 0 ? ".xml" : ".dat");
|
||||||
if (outputDirectory == "" && Path.GetExtension(file) == extension)
|
if (outputDirectory == "" && Path.GetExtension(file) == extension)
|
||||||
{
|
{
|
||||||
innerDatdata.FileName += ".new";
|
innerDatdata.FileName += ".new";
|
||||||
@@ -2623,7 +2625,7 @@ namespace SabreTools.Helper
|
|||||||
|
|
||||||
userData = new Dat
|
userData = new Dat
|
||||||
{
|
{
|
||||||
OutputFormat = (inputDat.OutputFormat != OutputFormat.None ? inputDat.OutputFormat : OutputFormat.None),
|
OutputFormatFlag = (inputDat.OutputFormatFlag != 0 ? inputDat.OutputFormatFlag: 0),
|
||||||
Files = new Dictionary<string, List<Rom>>(),
|
Files = new Dictionary<string, List<Rom>>(),
|
||||||
MergeRoms = inputDat.MergeRoms,
|
MergeRoms = inputDat.MergeRoms,
|
||||||
};
|
};
|
||||||
@@ -2634,7 +2636,7 @@ namespace SabreTools.Helper
|
|||||||
logger.User("Adding DAT: " + input.Split('¬')[0]);
|
logger.User("Adding DAT: " + input.Split('¬')[0]);
|
||||||
datHeaders[i] = new Dat
|
datHeaders[i] = new Dat
|
||||||
{
|
{
|
||||||
OutputFormat = (inputDat.OutputFormat != OutputFormat.None ? inputDat.OutputFormat : OutputFormat.None),
|
OutputFormatFlag = (inputDat.OutputFormatFlag != 0 ? inputDat.OutputFormatFlag: 0),
|
||||||
Files = new Dictionary<string, List<Rom>>(),
|
Files = new Dictionary<string, List<Rom>>(),
|
||||||
MergeRoms = inputDat.MergeRoms,
|
MergeRoms = inputDat.MergeRoms,
|
||||||
};
|
};
|
||||||
@@ -2709,9 +2711,9 @@ namespace SabreTools.Helper
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the DAT has no output format, default to XML
|
// If the DAT has no output format, default to XML
|
||||||
if (datdata.OutputFormat == OutputFormat.None)
|
if (datdata.OutputFormatFlag == 0)
|
||||||
{
|
{
|
||||||
datdata.OutputFormat = OutputFormat.Xml;
|
datdata.OutputFormatFlag = OutputFormatFlag.Xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure that the three essential fields are filled in
|
// Make sure that the three essential fields are filled in
|
||||||
@@ -2758,87 +2760,91 @@ namespace SabreTools.Helper
|
|||||||
SortedDictionary<string, List<Rom>> sortable = BucketByGame(datdata.Files, datdata.MergeRoms, norename, logger);
|
SortedDictionary<string, List<Rom>> sortable = BucketByGame(datdata.Files, datdata.MergeRoms, norename, logger);
|
||||||
|
|
||||||
// Get the outfile name
|
// Get the outfile name
|
||||||
string outfile = Style.CreateOutfileName(outDir, datdata);
|
Dictionary<OutputFormatFlag, string> outfiles = Style.CreateOutfileNames(outDir, datdata);
|
||||||
|
|
||||||
logger.User("Opening file for writing: " + outfile);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FileStream fs = File.Create(outfile);
|
foreach (OutputFormatFlag outputFormatFlag in outfiles.Keys)
|
||||||
StreamWriter sw = new StreamWriter(fs, Encoding.UTF8);
|
|
||||||
|
|
||||||
// Write out the header
|
|
||||||
WriteHeader(sw, datdata, logger);
|
|
||||||
|
|
||||||
// Write out each of the machines and roms
|
|
||||||
int depth = 2, last = -1;
|
|
||||||
string lastgame = null;
|
|
||||||
List<string> splitpath = new List<string>();
|
|
||||||
|
|
||||||
// Get a properly sorted set of keys
|
|
||||||
List<string> keys = sortable.Keys.ToList();
|
|
||||||
keys.Sort(Style.CompareNumeric);
|
|
||||||
|
|
||||||
foreach (string key in keys)
|
|
||||||
{
|
{
|
||||||
List<Rom> roms = sortable[key];
|
string outfile = outfiles[outputFormatFlag];
|
||||||
|
|
||||||
for (int index = 0; index < roms.Count; index++)
|
logger.User("Opening file for writing: " + outfile);
|
||||||
|
FileStream fs = File.Create(outfile);
|
||||||
|
StreamWriter sw = new StreamWriter(fs, Encoding.UTF8);
|
||||||
|
|
||||||
|
// Write out the header
|
||||||
|
WriteHeader(sw, outputFormatFlag, datdata, logger);
|
||||||
|
|
||||||
|
// Write out each of the machines and roms
|
||||||
|
int depth = 2, last = -1;
|
||||||
|
string lastgame = null;
|
||||||
|
List<string> splitpath = new List<string>();
|
||||||
|
|
||||||
|
// Get a properly sorted set of keys
|
||||||
|
List<string> keys = sortable.Keys.ToList();
|
||||||
|
keys.Sort(Style.CompareNumeric);
|
||||||
|
|
||||||
|
foreach (string key in keys)
|
||||||
{
|
{
|
||||||
Rom rom = roms[index];
|
List<Rom> roms = sortable[key];
|
||||||
List<string> newsplit = rom.Machine.Name.Split('\\').ToList();
|
|
||||||
|
|
||||||
// If we have a different game and we're not at the start of the list, output the end of last item
|
for (int index = 0; index < roms.Count; index++)
|
||||||
if (lastgame != null && lastgame.ToLowerInvariant() != rom.Machine.Name.ToLowerInvariant())
|
|
||||||
{
|
{
|
||||||
depth = WriteEndGame(sw, rom, splitpath, newsplit, lastgame, datdata, depth, out last, logger);
|
Rom rom = roms[index];
|
||||||
}
|
List<string> newsplit = rom.Machine.Name.Split('\\').ToList();
|
||||||
|
|
||||||
// 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 (lastgame == null || lastgame.ToLowerInvariant() != rom.Machine.Name.ToLowerInvariant())
|
if (lastgame != null && lastgame.ToLowerInvariant() != rom.Machine.Name.ToLowerInvariant())
|
||||||
{
|
|
||||||
depth = WriteStartGame(sw, rom, newsplit, lastgame, datdata, depth, last, logger);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we have a "null" game (created by DATFromDir or something similar), log it to file
|
|
||||||
if (rom.HashData.Size == -1 && rom.HashData.CRC == "null" && rom.HashData.MD5 == "null" && rom.HashData.SHA1 == "null")
|
|
||||||
{
|
|
||||||
logger.Log("Empty folder found: " + rom.Machine.Name);
|
|
||||||
|
|
||||||
// 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.Name = (rom.Name == "null" ? "-" : rom.Name);
|
depth = WriteEndGame(sw, outputFormatFlag, rom, splitpath, newsplit, lastgame, depth, out last, logger);
|
||||||
rom.HashData.Size = Constants.SizeZero;
|
|
||||||
rom.HashData.CRC = Constants.CRCZero;
|
|
||||||
rom.HashData.MD5 = Constants.MD5Zero;
|
|
||||||
rom.HashData.SHA1 = Constants.SHA1Zero;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, set the new path and such, write out, and continue
|
// If we have a new game, output the beginning of the new item
|
||||||
else
|
if (lastgame == null || lastgame.ToLowerInvariant() != rom.Machine.Name.ToLowerInvariant())
|
||||||
{
|
{
|
||||||
splitpath = newsplit;
|
depth = WriteStartGame(sw, outputFormatFlag, rom, newsplit, lastgame, depth, last, logger);
|
||||||
lastgame = rom.Machine.Name;
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we have a "null" game (created by DATFromDir or something similar), log it to file
|
||||||
|
if (rom.HashData.Size == -1 && rom.HashData.CRC == "null" && rom.HashData.MD5 == "null" && rom.HashData.SHA1 == "null")
|
||||||
|
{
|
||||||
|
logger.Log("Empty folder found: " + rom.Machine.Name);
|
||||||
|
|
||||||
|
// If we're in a mode that doesn't allow for actual empty folders, add the blank info
|
||||||
|
if (outputFormatFlag != OutputFormatFlag.SabreDat && outputFormatFlag != OutputFormatFlag.MissFile)
|
||||||
|
{
|
||||||
|
rom.Name = (rom.Name == "null" ? "-" : rom.Name);
|
||||||
|
rom.HashData.Size = Constants.SizeZero;
|
||||||
|
rom.HashData.CRC = Constants.CRCZero;
|
||||||
|
rom.HashData.MD5 = Constants.MD5Zero;
|
||||||
|
rom.HashData.SHA1 = Constants.SHA1Zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise, set the new path and such, write out, and continue
|
||||||
|
else
|
||||||
|
{
|
||||||
|
splitpath = newsplit;
|
||||||
|
lastgame = rom.Machine.Name;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now, output the rom data
|
||||||
|
WriteRomData(sw, outputFormatFlag, rom, lastgame, datdata, depth, logger, ignoreblanks);
|
||||||
|
|
||||||
|
// Set the new data to compare against
|
||||||
|
splitpath = newsplit;
|
||||||
|
lastgame = rom.Machine.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now, output the rom data
|
|
||||||
WriteRomData(sw, rom, lastgame, datdata, depth, logger, ignoreblanks);
|
|
||||||
|
|
||||||
// Set the new data to compare against
|
|
||||||
splitpath = newsplit;
|
|
||||||
lastgame = rom.Machine.Name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Write the file footer out
|
||||||
|
WriteFooter(sw, outputFormatFlag, datdata, depth, logger);
|
||||||
|
|
||||||
|
logger.Log("File written!" + Environment.NewLine);
|
||||||
|
sw.Close();
|
||||||
|
fs.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write the file footer out
|
|
||||||
WriteFooter(sw, datdata, depth, logger);
|
|
||||||
|
|
||||||
logger.Log("File written!" + Environment.NewLine);
|
|
||||||
sw.Close();
|
|
||||||
fs.Close();
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -2853,17 +2859,18 @@ namespace SabreTools.Helper
|
|||||||
/// Write out DAT header using the supplied StreamWriter
|
/// Write out DAT header using the supplied StreamWriter
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sw">StreamWriter to output to</param>
|
/// <param name="sw">StreamWriter to output to</param>
|
||||||
|
/// <param name="outputFormatFlag">Output format to write to</param>
|
||||||
/// <param name="datdata">DatData object representing DAT information</param>
|
/// <param name="datdata">DatData object representing DAT information</param>
|
||||||
/// <param name="logger">Logger object for file and console output</param>
|
/// <param name="logger">Logger object for file and console output</param>
|
||||||
/// <returns>True if the data was written, false on error</returns>
|
/// <returns>True if the data was written, false on error</returns>
|
||||||
public static bool WriteHeader(StreamWriter sw, Dat datdata, Logger logger)
|
public static bool WriteHeader(StreamWriter sw, OutputFormatFlag outputFormatFlag, Dat datdata, Logger logger)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string header = "";
|
string header = "";
|
||||||
switch (datdata.OutputFormat)
|
switch (outputFormatFlag)
|
||||||
{
|
{
|
||||||
case OutputFormat.ClrMamePro:
|
case OutputFormatFlag.ClrMamePro:
|
||||||
header = "clrmamepro (\n" +
|
header = "clrmamepro (\n" +
|
||||||
"\tname \"" + datdata.Name + "\"\n" +
|
"\tname \"" + datdata.Name + "\"\n" +
|
||||||
"\tdescription \"" + datdata.Description + "\"\n" +
|
"\tdescription \"" + datdata.Description + "\"\n" +
|
||||||
@@ -2878,7 +2885,7 @@ namespace SabreTools.Helper
|
|||||||
(datdata.ForcePacking == ForcePacking.Unzip ? "\tforcezipping no\n" : "") +
|
(datdata.ForcePacking == ForcePacking.Unzip ? "\tforcezipping no\n" : "") +
|
||||||
")\n";
|
")\n";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.MissFile:
|
case OutputFormatFlag.MissFile:
|
||||||
if (datdata.XSV == true)
|
if (datdata.XSV == true)
|
||||||
{
|
{
|
||||||
header = "\"File Name\"\t\"Internal Name\"\t\"Description\"\t\"Game Name\"\t\"Game Description\"\t\"Type\"\t\"" +
|
header = "\"File Name\"\t\"Internal Name\"\t\"Description\"\t\"Game Name\"\t\"Game Description\"\t\"Type\"\t\"" +
|
||||||
@@ -2890,7 +2897,7 @@ namespace SabreTools.Helper
|
|||||||
"Rom Name\",\"Disk Name\",\"Size\",\"CRC\",\"MD5\",\"SHA1\",\"Nodump\"\n";
|
"Rom Name\",\"Disk Name\",\"Size\",\"CRC\",\"MD5\",\"SHA1\",\"Nodump\"\n";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OutputFormat.RomCenter:
|
case OutputFormatFlag.RomCenter:
|
||||||
header = "[CREDITS]\n" +
|
header = "[CREDITS]\n" +
|
||||||
"author=" + datdata.Author + "\n" +
|
"author=" + datdata.Author + "\n" +
|
||||||
"version=" + datdata.Version + "\n" +
|
"version=" + datdata.Version + "\n" +
|
||||||
@@ -2904,7 +2911,7 @@ namespace SabreTools.Helper
|
|||||||
"version=" + datdata.Description + "\n" +
|
"version=" + datdata.Description + "\n" +
|
||||||
"[GAMES]\n";
|
"[GAMES]\n";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.SabreDat:
|
case OutputFormatFlag.SabreDat:
|
||||||
header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
|
header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
|
||||||
"<!DOCTYPE datafile PUBLIC \"-//Logiqx//DTD ROM Management Datafile//EN\" \"http://www.logiqx.com/Dats/datafile.dtd\">\n\n" +
|
"<!DOCTYPE datafile PUBLIC \"-//Logiqx//DTD ROM Management Datafile//EN\" \"http://www.logiqx.com/Dats/datafile.dtd\">\n\n" +
|
||||||
"<datafile>\n" +
|
"<datafile>\n" +
|
||||||
@@ -2925,7 +2932,7 @@ namespace SabreTools.Helper
|
|||||||
"\t</header>\n" +
|
"\t</header>\n" +
|
||||||
"\t<data>\n";
|
"\t<data>\n";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.Xml:
|
case OutputFormatFlag.Xml:
|
||||||
header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
|
header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
|
||||||
"<!DOCTYPE datafile PUBLIC \"-//Logiqx//DTD ROM Management Datafile//EN\" \"http://www.logiqx.com/Dats/datafile.dtd\">\n\n" +
|
"<!DOCTYPE datafile PUBLIC \"-//Logiqx//DTD ROM Management Datafile//EN\" \"http://www.logiqx.com/Dats/datafile.dtd\">\n\n" +
|
||||||
"<datafile>\n" +
|
"<datafile>\n" +
|
||||||
@@ -2963,15 +2970,15 @@ namespace SabreTools.Helper
|
|||||||
/// Write out Game start using the supplied StreamWriter
|
/// Write out Game start using the supplied StreamWriter
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sw">StreamWriter to output to</param>
|
/// <param name="sw">StreamWriter to output to</param>
|
||||||
|
/// <param name="outputFormatFlag">Output format to write to</param>
|
||||||
/// <param name="rom">RomData object to be output</param>
|
/// <param name="rom">RomData object to be output</param>
|
||||||
/// <param name="newsplit">Split path representing the parent game (SabreDAT only)</param>
|
/// <param name="newsplit">Split path representing the parent game (SabreDAT only)</param>
|
||||||
/// <param name="lastgame">The name of the last game to be output</param>
|
/// <param name="lastgame">The name of the last game to be output</param>
|
||||||
/// <param name="datdata">DatData object representing DAT information</param>
|
|
||||||
/// <param name="depth">Current depth to output file at (SabreDAT only)</param>
|
/// <param name="depth">Current depth to output file at (SabreDAT only)</param>
|
||||||
/// <param name="last">Last known depth to cycle back from (SabreDAT only)</param>
|
/// <param name="last">Last known depth to cycle back from (SabreDAT only)</param>
|
||||||
/// <param name="logger">Logger object for file and console output</param>
|
/// <param name="logger">Logger object for file and console output</param>
|
||||||
/// <returns>The new depth of the tag</returns>
|
/// <returns>The new depth of the tag</returns>
|
||||||
public static int WriteStartGame(StreamWriter sw, Rom rom, List<string> newsplit, string lastgame, Dat datdata, int depth, int last, Logger logger)
|
public static int WriteStartGame(StreamWriter sw, OutputFormatFlag outputFormatFlag, Rom rom, List<string> newsplit, string lastgame, int depth, int last, Logger logger)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -2982,13 +2989,13 @@ namespace SabreTools.Helper
|
|||||||
}
|
}
|
||||||
|
|
||||||
string state = "";
|
string state = "";
|
||||||
switch (datdata.OutputFormat)
|
switch (outputFormatFlag)
|
||||||
{
|
{
|
||||||
case OutputFormat.ClrMamePro:
|
case OutputFormatFlag.ClrMamePro:
|
||||||
state += "game (\n\tname \"" + rom.Machine.Name + "\"\n" +
|
state += "game (\n\tname \"" + rom.Machine.Name + "\"\n" +
|
||||||
"\tdescription \"" + (String.IsNullOrEmpty(rom.Machine.Description) ? rom.Machine.Name : rom.Machine.Description) + "\"\n";
|
"\tdescription \"" + (String.IsNullOrEmpty(rom.Machine.Description) ? rom.Machine.Name : rom.Machine.Description) + "\"\n";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.SabreDat:
|
case OutputFormatFlag.SabreDat:
|
||||||
for (int i = (last == -1 ? 0 : last); i < newsplit.Count; i++)
|
for (int i = (last == -1 ? 0 : last); i < newsplit.Count; i++)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < depth - last + i - (lastgame == null ? 1 : 0); j++)
|
for (int j = 0; j < depth - last + i - (lastgame == null ? 1 : 0); j++)
|
||||||
@@ -3000,7 +3007,7 @@ namespace SabreTools.Helper
|
|||||||
}
|
}
|
||||||
depth = depth - (last == -1 ? 0 : last) + newsplit.Count;
|
depth = depth - (last == -1 ? 0 : last) + newsplit.Count;
|
||||||
break;
|
break;
|
||||||
case OutputFormat.Xml:
|
case OutputFormatFlag.Xml:
|
||||||
state += "\t<machine name=\"" + HttpUtility.HtmlEncode(rom.Machine.Name) + "\">\n" +
|
state += "\t<machine name=\"" + HttpUtility.HtmlEncode(rom.Machine.Name) + "\">\n" +
|
||||||
"\t\t<description>" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.Machine.Description) ? rom.Machine.Name : rom.Machine.Description)) + "</description>\n";
|
"\t\t<description>" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.Machine.Description) ? rom.Machine.Name : rom.Machine.Description)) + "</description>\n";
|
||||||
break;
|
break;
|
||||||
@@ -3021,16 +3028,16 @@ namespace SabreTools.Helper
|
|||||||
/// Write out Game start using the supplied StreamWriter
|
/// Write out Game start using the supplied StreamWriter
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sw">StreamWriter to output to</param>
|
/// <param name="sw">StreamWriter to output to</param>
|
||||||
|
/// <param name="outputFormatFlag">Output format to write to</param>
|
||||||
/// <param name="rom">RomData object to be output</param>
|
/// <param name="rom">RomData object to be output</param>
|
||||||
/// <param name="splitpath">Split path representing last kwown parent game (SabreDAT only)</param>
|
/// <param name="splitpath">Split path representing last kwown parent game (SabreDAT only)</param>
|
||||||
/// <param name="newsplit">Split path representing the parent game (SabreDAT only)</param>
|
/// <param name="newsplit">Split path representing the parent game (SabreDAT only)</param>
|
||||||
/// <param name="lastgame">The name of the last game to be output</param>
|
/// <param name="lastgame">The name of the last game to be output</param>
|
||||||
/// <param name="datdata">DatData object representing DAT information</param>
|
|
||||||
/// <param name="depth">Current depth to output file at (SabreDAT only)</param>
|
/// <param name="depth">Current depth to output file at (SabreDAT only)</param>
|
||||||
/// <param name="last">Last known depth to cycle back from (SabreDAT only)</param>
|
/// <param name="last">Last known depth to cycle back from (SabreDAT only)</param>
|
||||||
/// <param name="logger">Logger object for file and console output</param>
|
/// <param name="logger">Logger object for file and console output</param>
|
||||||
/// <returns>The new depth of the tag</returns>
|
/// <returns>The new depth of the tag</returns>
|
||||||
public static int WriteEndGame(StreamWriter sw, Rom rom, List<string> splitpath, List<string> newsplit, string lastgame, Dat datdata, int depth, out int last, Logger logger)
|
public static int WriteEndGame(StreamWriter sw, OutputFormatFlag outputFormatFlag, Rom rom, List<string> splitpath, List<string> newsplit, string lastgame, int depth, out int last, Logger logger)
|
||||||
{
|
{
|
||||||
last = 0;
|
last = 0;
|
||||||
|
|
||||||
@@ -3038,12 +3045,12 @@ namespace SabreTools.Helper
|
|||||||
{
|
{
|
||||||
string state = "";
|
string state = "";
|
||||||
|
|
||||||
switch (datdata.OutputFormat)
|
switch (outputFormatFlag)
|
||||||
{
|
{
|
||||||
case OutputFormat.ClrMamePro:
|
case OutputFormatFlag.ClrMamePro:
|
||||||
state += ")\n";
|
state += ")\n";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.SabreDat:
|
case OutputFormatFlag.SabreDat:
|
||||||
if (splitpath != null)
|
if (splitpath != null)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < newsplit.Count && i < splitpath.Count; i++)
|
for (int i = 0; i < newsplit.Count && i < splitpath.Count; i++)
|
||||||
@@ -3073,7 +3080,7 @@ namespace SabreTools.Helper
|
|||||||
depth = 2 + last;
|
depth = 2 + last;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OutputFormat.Xml:
|
case OutputFormatFlag.Xml:
|
||||||
state += "\t</machine>\n";
|
state += "\t</machine>\n";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -3093,6 +3100,7 @@ namespace SabreTools.Helper
|
|||||||
/// Write out RomData using the supplied StreamWriter
|
/// Write out RomData using the supplied StreamWriter
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sw">StreamWriter to output to</param>
|
/// <param name="sw">StreamWriter to output to</param>
|
||||||
|
/// <param name="outputFormatFlag">Output format to write to</param>
|
||||||
/// <param name="rom">RomData object to be output</param>
|
/// <param name="rom">RomData object to be output</param>
|
||||||
/// <param name="lastgame">The name of the last game to be output</param>
|
/// <param name="lastgame">The name of the last game to be output</param>
|
||||||
/// <param name="datdata">DatData object representing DAT information</param>
|
/// <param name="datdata">DatData object representing DAT information</param>
|
||||||
@@ -3100,7 +3108,7 @@ namespace SabreTools.Helper
|
|||||||
/// <param name="logger">Logger object for file and console output</param>
|
/// <param name="logger">Logger object for file and console output</param>
|
||||||
/// <param name="ignoreblanks">True if blank roms should be skipped on output, false otherwise (default)</param>
|
/// <param name="ignoreblanks">True if blank roms should be skipped on output, false otherwise (default)</param>
|
||||||
/// <returns>True if the data was written, false on error</returns>
|
/// <returns>True if the data was written, false on error</returns>
|
||||||
public static bool WriteRomData(StreamWriter sw, Rom rom, string lastgame, Dat datdata, int depth, Logger logger, bool ignoreblanks = false)
|
public static bool WriteRomData(StreamWriter sw, OutputFormatFlag outputFormatFlag, Rom rom, string lastgame, Dat datdata, int depth, Logger logger, bool ignoreblanks = false)
|
||||||
{
|
{
|
||||||
// If we are in ignore blanks mode AND we have a blank (0-size) rom, skip
|
// If we are in ignore blanks mode AND we have a blank (0-size) rom, skip
|
||||||
if (ignoreblanks && (rom.HashData.Size == 0 || rom.HashData.Size == -1))
|
if (ignoreblanks && (rom.HashData.Size == 0 || rom.HashData.Size == -1))
|
||||||
@@ -3111,9 +3119,9 @@ namespace SabreTools.Helper
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
string state = "";
|
string state = "";
|
||||||
switch (datdata.OutputFormat)
|
switch (outputFormatFlag)
|
||||||
{
|
{
|
||||||
case OutputFormat.ClrMamePro:
|
case OutputFormatFlag.ClrMamePro:
|
||||||
state += "\t" + rom.Type.ToString().ToLowerInvariant() + " ( name \"" + rom.Name + "\"" +
|
state += "\t" + rom.Type.ToString().ToLowerInvariant() + " ( name \"" + rom.Name + "\"" +
|
||||||
(rom.HashData.Size != -1 ? " size " + rom.HashData.Size : "") +
|
(rom.HashData.Size != -1 ? " size " + rom.HashData.Size : "") +
|
||||||
(!String.IsNullOrEmpty(rom.HashData.CRC) ? " crc " + rom.HashData.CRC.ToLowerInvariant() : "") +
|
(!String.IsNullOrEmpty(rom.HashData.CRC) ? " crc " + rom.HashData.CRC.ToLowerInvariant() : "") +
|
||||||
@@ -3123,7 +3131,7 @@ namespace SabreTools.Helper
|
|||||||
(rom.Nodump ? " flags nodump" : "") +
|
(rom.Nodump ? " flags nodump" : "") +
|
||||||
" )\n";
|
" )\n";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.MissFile:
|
case OutputFormatFlag.MissFile:
|
||||||
string pre = datdata.Prefix + (datdata.Quotes ? "\"" : "");
|
string pre = datdata.Prefix + (datdata.Quotes ? "\"" : "");
|
||||||
string post = (datdata.Quotes ? "\"" : "") + datdata.Postfix;
|
string post = (datdata.Quotes ? "\"" : "") + datdata.Postfix;
|
||||||
|
|
||||||
@@ -3188,23 +3196,23 @@ namespace SabreTools.Helper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OutputFormat.RedumpMD5:
|
case OutputFormatFlag.RedumpMD5:
|
||||||
state += rom.HashData.MD5 + " *" + rom.Name + "\n";
|
state += rom.HashData.MD5 + " *" + rom.Name + "\n";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.RedumpSFV:
|
case OutputFormatFlag.RedumpSFV:
|
||||||
state += rom.Name + " " + rom.HashData.CRC + "\n";
|
state += rom.Name + " " + rom.HashData.CRC + "\n";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.RedumpSHA1:
|
case OutputFormatFlag.RedumpSHA1:
|
||||||
state += rom.HashData.SHA1 + " *" + rom.Name + "\n";
|
state += rom.HashData.SHA1 + " *" + rom.Name + "\n";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.RomCenter:
|
case OutputFormatFlag.RomCenter:
|
||||||
state += "¬¬¬" + HttpUtility.HtmlEncode(rom.Machine) +
|
state += "¬¬¬" + HttpUtility.HtmlEncode(rom.Machine) +
|
||||||
"¬" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.Machine.Description) ? rom.Machine.Name : rom.Machine.Description)) +
|
"¬" + HttpUtility.HtmlEncode((String.IsNullOrEmpty(rom.Machine.Description) ? rom.Machine.Name : rom.Machine.Description)) +
|
||||||
"¬" + HttpUtility.HtmlEncode(rom.Name) +
|
"¬" + HttpUtility.HtmlEncode(rom.Name) +
|
||||||
"¬" + rom.HashData.CRC.ToLowerInvariant() +
|
"¬" + rom.HashData.CRC.ToLowerInvariant() +
|
||||||
"¬" + (rom.HashData.Size != -1 ? rom.HashData.Size.ToString() : "") + "¬¬¬\n";
|
"¬" + (rom.HashData.Size != -1 ? rom.HashData.Size.ToString() : "") + "¬¬¬\n";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.SabreDat:
|
case OutputFormatFlag.SabreDat:
|
||||||
string prefix = "";
|
string prefix = "";
|
||||||
for (int i = 0; i < depth; i++)
|
for (int i = 0; i < depth; i++)
|
||||||
{
|
{
|
||||||
@@ -3224,7 +3232,7 @@ namespace SabreTools.Helper
|
|||||||
prefix + "</file>\n" :
|
prefix + "</file>\n" :
|
||||||
"/>\n");
|
"/>\n");
|
||||||
break;
|
break;
|
||||||
case OutputFormat.Xml:
|
case OutputFormatFlag.Xml:
|
||||||
state += "\t\t<" + rom.Type.ToString().ToLowerInvariant() + " name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\"" +
|
state += "\t\t<" + rom.Type.ToString().ToLowerInvariant() + " name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\"" +
|
||||||
(rom.HashData.Size != -1 ? " size=\"" + rom.HashData.Size + "\"" : "") +
|
(rom.HashData.Size != -1 ? " size=\"" + rom.HashData.Size + "\"" : "") +
|
||||||
(!String.IsNullOrEmpty(rom.HashData.CRC) ? " crc=\"" + rom.HashData.CRC.ToLowerInvariant() + "\"" : "") +
|
(!String.IsNullOrEmpty(rom.HashData.CRC) ? " crc=\"" + rom.HashData.CRC.ToLowerInvariant() + "\"" : "") +
|
||||||
@@ -3255,7 +3263,7 @@ namespace SabreTools.Helper
|
|||||||
/// <param name="depth">Current depth to output file at (SabreDAT only)</param>
|
/// <param name="depth">Current depth to output file at (SabreDAT only)</param>
|
||||||
/// <param name="logger">Logger object for file and console output</param>
|
/// <param name="logger">Logger object for file and console output</param>
|
||||||
/// <returns>True if the data was written, false on error</returns>
|
/// <returns>True if the data was written, false on error</returns>
|
||||||
public static bool WriteFooter(StreamWriter sw, Dat datdata, int depth, Logger logger)
|
public static bool WriteFooter(StreamWriter sw, OutputFormatFlag outputFormatFlag, Dat datdata, int depth, Logger logger)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -3264,12 +3272,12 @@ namespace SabreTools.Helper
|
|||||||
// If we have roms, output the full footer
|
// If we have roms, output the full footer
|
||||||
if (datdata.Files != null && datdata.Files.Count > 0)
|
if (datdata.Files != null && datdata.Files.Count > 0)
|
||||||
{
|
{
|
||||||
switch (datdata.OutputFormat)
|
switch (outputFormatFlag)
|
||||||
{
|
{
|
||||||
case OutputFormat.ClrMamePro:
|
case OutputFormatFlag.ClrMamePro:
|
||||||
footer = ")";
|
footer = ")";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.SabreDat:
|
case OutputFormatFlag.SabreDat:
|
||||||
for (int i = depth - 1; i >= 2; i--)
|
for (int i = depth - 1; i >= 2; i--)
|
||||||
{
|
{
|
||||||
// Print out the number of tabs and the end folder
|
// Print out the number of tabs and the end folder
|
||||||
@@ -3281,7 +3289,7 @@ namespace SabreTools.Helper
|
|||||||
}
|
}
|
||||||
footer += "\t</data>\n</datafile>";
|
footer += "\t</data>\n</datafile>";
|
||||||
break;
|
break;
|
||||||
case OutputFormat.Xml:
|
case OutputFormatFlag.Xml:
|
||||||
footer = "\t</machine>\n</datafile>";
|
footer = "\t</machine>\n</datafile>";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -3290,10 +3298,10 @@ namespace SabreTools.Helper
|
|||||||
// Otherwise, output the abbreviated form
|
// Otherwise, output the abbreviated form
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (datdata.OutputFormat)
|
switch (outputFormatFlag)
|
||||||
{
|
{
|
||||||
case OutputFormat.SabreDat:
|
case OutputFormatFlag.SabreDat:
|
||||||
case OutputFormat.Xml:
|
case OutputFormatFlag.Xml:
|
||||||
footer = "</datafile>";
|
footer = "</datafile>";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -3343,8 +3351,8 @@ namespace SabreTools.Helper
|
|||||||
string newExtBString = string.Join(",", newExtB);
|
string newExtBString = string.Join(",", newExtB);
|
||||||
|
|
||||||
// Get the file format
|
// Get the file format
|
||||||
OutputFormat outputFormat = GetOutputFormat(filename, logger);
|
OutputFormatFlag outputFormatFlag = GetOutputFormat(filename, logger);
|
||||||
if (outputFormat == OutputFormat.None)
|
if (outputFormatFlag == 0)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -3368,7 +3376,7 @@ namespace SabreTools.Helper
|
|||||||
Url = datdata.Url,
|
Url = datdata.Url,
|
||||||
Comment = datdata.Comment,
|
Comment = datdata.Comment,
|
||||||
Files = new Dictionary<string, List<Rom>>(),
|
Files = new Dictionary<string, List<Rom>>(),
|
||||||
OutputFormat = outputFormat,
|
OutputFormatFlag = outputFormatFlag,
|
||||||
};
|
};
|
||||||
Dat datdataB = new Dat
|
Dat datdataB = new Dat
|
||||||
{
|
{
|
||||||
@@ -3384,7 +3392,7 @@ namespace SabreTools.Helper
|
|||||||
Url = datdata.Url,
|
Url = datdata.Url,
|
||||||
Comment = datdata.Comment,
|
Comment = datdata.Comment,
|
||||||
Files = new Dictionary<string, List<Rom>>(),
|
Files = new Dictionary<string, List<Rom>>(),
|
||||||
OutputFormat = outputFormat,
|
OutputFormatFlag = outputFormatFlag,
|
||||||
};
|
};
|
||||||
|
|
||||||
// If roms is empty, return false
|
// If roms is empty, return false
|
||||||
@@ -3481,8 +3489,8 @@ namespace SabreTools.Helper
|
|||||||
basepath = (basepath.EndsWith(Path.DirectorySeparatorChar.ToString()) ? basepath : basepath + Path.DirectorySeparatorChar);
|
basepath = (basepath.EndsWith(Path.DirectorySeparatorChar.ToString()) ? basepath : basepath + Path.DirectorySeparatorChar);
|
||||||
|
|
||||||
// Get the file format
|
// Get the file format
|
||||||
OutputFormat outputFormat = GetOutputFormat(filename, logger);
|
OutputFormatFlag outputFormatFlag = GetOutputFormat(filename, logger);
|
||||||
if (outputFormat == OutputFormat.None)
|
if (outputFormatFlag == 0)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -3511,7 +3519,7 @@ namespace SabreTools.Helper
|
|||||||
ForceMerging = datdata.ForceMerging,
|
ForceMerging = datdata.ForceMerging,
|
||||||
ForceNodump = datdata.ForceNodump,
|
ForceNodump = datdata.ForceNodump,
|
||||||
ForcePacking = datdata.ForcePacking,
|
ForcePacking = datdata.ForcePacking,
|
||||||
OutputFormat = outputFormat,
|
OutputFormatFlag = outputFormatFlag,
|
||||||
MergeRoms = datdata.MergeRoms,
|
MergeRoms = datdata.MergeRoms,
|
||||||
Files = new Dictionary<string, List<Rom>>(),
|
Files = new Dictionary<string, List<Rom>>(),
|
||||||
};
|
};
|
||||||
@@ -3533,7 +3541,7 @@ namespace SabreTools.Helper
|
|||||||
ForceMerging = datdata.ForceMerging,
|
ForceMerging = datdata.ForceMerging,
|
||||||
ForceNodump = datdata.ForceNodump,
|
ForceNodump = datdata.ForceNodump,
|
||||||
ForcePacking = datdata.ForcePacking,
|
ForcePacking = datdata.ForcePacking,
|
||||||
OutputFormat = outputFormat,
|
OutputFormatFlag = outputFormatFlag,
|
||||||
MergeRoms = datdata.MergeRoms,
|
MergeRoms = datdata.MergeRoms,
|
||||||
Files = new Dictionary<string, List<Rom>>(),
|
Files = new Dictionary<string, List<Rom>>(),
|
||||||
};
|
};
|
||||||
@@ -3555,7 +3563,7 @@ namespace SabreTools.Helper
|
|||||||
ForceMerging = datdata.ForceMerging,
|
ForceMerging = datdata.ForceMerging,
|
||||||
ForceNodump = datdata.ForceNodump,
|
ForceNodump = datdata.ForceNodump,
|
||||||
ForcePacking = datdata.ForcePacking,
|
ForcePacking = datdata.ForcePacking,
|
||||||
OutputFormat = outputFormat,
|
OutputFormatFlag = outputFormatFlag,
|
||||||
MergeRoms = datdata.MergeRoms,
|
MergeRoms = datdata.MergeRoms,
|
||||||
Files = new Dictionary<string, List<Rom>>(),
|
Files = new Dictionary<string, List<Rom>>(),
|
||||||
};
|
};
|
||||||
@@ -3577,7 +3585,7 @@ namespace SabreTools.Helper
|
|||||||
ForceMerging = datdata.ForceMerging,
|
ForceMerging = datdata.ForceMerging,
|
||||||
ForceNodump = datdata.ForceNodump,
|
ForceNodump = datdata.ForceNodump,
|
||||||
ForcePacking = datdata.ForcePacking,
|
ForcePacking = datdata.ForcePacking,
|
||||||
OutputFormat = outputFormat,
|
OutputFormatFlag = outputFormatFlag,
|
||||||
MergeRoms = datdata.MergeRoms,
|
MergeRoms = datdata.MergeRoms,
|
||||||
Files = new Dictionary<string, List<Rom>>(),
|
Files = new Dictionary<string, List<Rom>>(),
|
||||||
};
|
};
|
||||||
@@ -3695,8 +3703,8 @@ namespace SabreTools.Helper
|
|||||||
basepath = (basepath.EndsWith(Path.DirectorySeparatorChar.ToString()) ? basepath : basepath + Path.DirectorySeparatorChar);
|
basepath = (basepath.EndsWith(Path.DirectorySeparatorChar.ToString()) ? basepath : basepath + Path.DirectorySeparatorChar);
|
||||||
|
|
||||||
// Get the file format
|
// Get the file format
|
||||||
OutputFormat outputFormat = GetOutputFormat(filename, logger);
|
OutputFormatFlag outputFormatFlag = GetOutputFormat(filename, logger);
|
||||||
if (outputFormat == OutputFormat.None)
|
if (outputFormatFlag == 0)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -3725,7 +3733,7 @@ namespace SabreTools.Helper
|
|||||||
ForceMerging = datdata.ForceMerging,
|
ForceMerging = datdata.ForceMerging,
|
||||||
ForceNodump = datdata.ForceNodump,
|
ForceNodump = datdata.ForceNodump,
|
||||||
ForcePacking = datdata.ForcePacking,
|
ForcePacking = datdata.ForcePacking,
|
||||||
OutputFormat = outputFormat,
|
OutputFormatFlag = outputFormatFlag,
|
||||||
MergeRoms = datdata.MergeRoms,
|
MergeRoms = datdata.MergeRoms,
|
||||||
Files = new Dictionary<string, List<Rom>>(),
|
Files = new Dictionary<string, List<Rom>>(),
|
||||||
};
|
};
|
||||||
@@ -3747,7 +3755,7 @@ namespace SabreTools.Helper
|
|||||||
ForceMerging = datdata.ForceMerging,
|
ForceMerging = datdata.ForceMerging,
|
||||||
ForceNodump = datdata.ForceNodump,
|
ForceNodump = datdata.ForceNodump,
|
||||||
ForcePacking = datdata.ForcePacking,
|
ForcePacking = datdata.ForcePacking,
|
||||||
OutputFormat = outputFormat,
|
OutputFormatFlag = outputFormatFlag,
|
||||||
MergeRoms = datdata.MergeRoms,
|
MergeRoms = datdata.MergeRoms,
|
||||||
Files = new Dictionary<string, List<Rom>>(),
|
Files = new Dictionary<string, List<Rom>>(),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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.OutputFormat = (datdata.OutputFormat == OutputFormat.None ? DatTools.GetOutputFormat(filename, logger) : datdata.OutputFormat);
|
datdata.OutputFormatFlag = (datdata.OutputFormatFlag == 0 ? DatTools.GetOutputFormat(filename, logger) : datdata.OutputFormatFlag);
|
||||||
|
|
||||||
// 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 OutputFormat.ClrMamePro:
|
case OutputFormatFlag.ClrMamePro:
|
||||||
return ParseCMP(filename, sysid, srcid, datdata, logger, keep, clean);
|
return ParseCMP(filename, sysid, srcid, datdata, logger, keep, clean);
|
||||||
case OutputFormat.RomCenter:
|
case OutputFormatFlag.RomCenter:
|
||||||
return ParseRC(filename, sysid, srcid, datdata, logger, clean);
|
return ParseRC(filename, sysid, srcid, datdata, logger, clean);
|
||||||
case OutputFormat.SabreDat:
|
case OutputFormatFlag.SabreDat:
|
||||||
case OutputFormat.Xml:
|
case OutputFormatFlag.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;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -151,49 +152,74 @@ namespace SabreTools.Helper
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="outDir">Output directory</param>
|
/// <param name="outDir">Output directory</param>
|
||||||
/// <param name="datdata">DAT information</param>
|
/// <param name="datdata">DAT information</param>
|
||||||
/// <returns>String representing the proper name</returns>
|
/// <returns>Dictionary of output formats mapped to file names</returns>
|
||||||
public static string CreateOutfileName(string outDir, Dat datdata)
|
public static Dictionary<OutputFormatFlag, string> CreateOutfileNames(string outDir, Dat datdata)
|
||||||
{
|
{
|
||||||
|
// Create the output dictionary
|
||||||
|
Dictionary<OutputFormatFlag, string> outfileNames = new Dictionary<OutputFormatFlag, 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()))
|
||||||
{
|
{
|
||||||
outDir += Path.DirectorySeparatorChar;
|
outDir += Path.DirectorySeparatorChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the extension from the output type
|
// Get the extensions from the output type
|
||||||
string extension = "";
|
if ((datdata.OutputFormatFlag & OutputFormatFlag.Xml) != 0)
|
||||||
switch(datdata.OutputFormat)
|
|
||||||
{
|
{
|
||||||
case OutputFormat.ClrMamePro:
|
outfileNames.Add(OutputFormatFlag.Xml, CreateOutfileNamesHelper(outDir, ".xml", datdata));
|
||||||
case OutputFormat.DOSCenter:
|
};
|
||||||
case OutputFormat.RomCenter:
|
if ((datdata.OutputFormatFlag & OutputFormatFlag.ClrMamePro) != 0)
|
||||||
extension = ".dat";
|
{
|
||||||
break;
|
outfileNames.Add(OutputFormatFlag.ClrMamePro, CreateOutfileNamesHelper(outDir, ".dat", datdata));
|
||||||
case OutputFormat.MissFile:
|
};
|
||||||
extension = ".txt";
|
if ((datdata.OutputFormatFlag & OutputFormatFlag.RomCenter) != 0)
|
||||||
break;
|
{
|
||||||
case OutputFormat.SabreDat:
|
outfileNames.Add(OutputFormatFlag.RomCenter, CreateOutfileNamesHelper(outDir, ".rc.dat", datdata));
|
||||||
case OutputFormat.Xml:
|
};
|
||||||
extension = ".xml";
|
if ((datdata.OutputFormatFlag & OutputFormatFlag.DOSCenter) != 0)
|
||||||
break;
|
{
|
||||||
case OutputFormat.RedumpMD5:
|
outfileNames.Add(OutputFormatFlag.DOSCenter, CreateOutfileNamesHelper(outDir, ".dc.dat", datdata));
|
||||||
extension = ".md5";
|
};
|
||||||
break;
|
if ((datdata.OutputFormatFlag & OutputFormatFlag.MissFile) != 0)
|
||||||
case OutputFormat.RedumpSFV:
|
{
|
||||||
extension = ".sfv";
|
outfileNames.Add(OutputFormatFlag.MissFile, CreateOutfileNamesHelper(outDir, ".txt", datdata));
|
||||||
break;
|
};
|
||||||
case OutputFormat.RedumpSHA1:
|
if ((datdata.OutputFormatFlag & OutputFormatFlag.SabreDat) != 0)
|
||||||
extension = ".sha1";
|
{
|
||||||
break;
|
outfileNames.Add(OutputFormatFlag.SabreDat, CreateOutfileNamesHelper(outDir, ".sd.xml", datdata));
|
||||||
}
|
};
|
||||||
|
if ((datdata.OutputFormatFlag & OutputFormatFlag.RedumpMD5) != 0)
|
||||||
|
{
|
||||||
|
outfileNames.Add(OutputFormatFlag.RedumpMD5, CreateOutfileNamesHelper(outDir, ".md5", datdata));
|
||||||
|
};
|
||||||
|
if ((datdata.OutputFormatFlag & OutputFormatFlag.RedumpSHA1) != 0)
|
||||||
|
{
|
||||||
|
outfileNames.Add(OutputFormatFlag.RedumpSHA1, CreateOutfileNamesHelper(outDir, ".sha1", datdata));
|
||||||
|
};
|
||||||
|
if ((datdata.OutputFormatFlag & OutputFormatFlag.RedumpSFV) != 0)
|
||||||
|
{
|
||||||
|
outfileNames.Add(OutputFormatFlag.RedumpSFV, CreateOutfileNamesHelper(outDir, ".sfv", datdata));
|
||||||
|
};
|
||||||
|
|
||||||
|
return outfileNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Help generating the outfile name
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="outDir">Output directory</param>
|
||||||
|
/// <param name="extension">Extension to use for the file</param>
|
||||||
|
/// <param name="datdata">DAT information</param>
|
||||||
|
/// <returns>String containing the new filename</returns>
|
||||||
|
private static string CreateOutfileNamesHelper(string outDir, string extension, Dat datdata)
|
||||||
|
{
|
||||||
string filename = (String.IsNullOrEmpty(datdata.FileName) ? datdata.Description : datdata.FileName);
|
string filename = (String.IsNullOrEmpty(datdata.FileName) ? datdata.Description : datdata.FileName);
|
||||||
string outfile = outDir + filename + extension;
|
string outfile = outDir + filename + extension;
|
||||||
outfile = (outfile.Contains(Path.DirectorySeparatorChar.ToString() + Path.DirectorySeparatorChar.ToString()) ?
|
outfile = (outfile.Contains(Path.DirectorySeparatorChar.ToString() + Path.DirectorySeparatorChar.ToString()) ?
|
||||||
outfile.Replace(Path.DirectorySeparatorChar.ToString() + Path.DirectorySeparatorChar.ToString(), Path.DirectorySeparatorChar.ToString()) :
|
outfile.Replace(Path.DirectorySeparatorChar.ToString() + Path.DirectorySeparatorChar.ToString(), Path.DirectorySeparatorChar.ToString()) :
|
||||||
outfile);
|
outfile);
|
||||||
|
|
||||||
Console.WriteLine(outfile);
|
|
||||||
|
|
||||||
return outfile;
|
return outfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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</param>
|
/// <param name="outputFormatFlag">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>
|
||||||
@@ -303,6 +303,7 @@ namespace SabreTools
|
|||||||
ForceNodump = fn,
|
ForceNodump = fn,
|
||||||
ForcePacking = fp,
|
ForcePacking = fp,
|
||||||
MergeRoms = dedup,
|
MergeRoms = dedup,
|
||||||
|
OutputFormatFlag = outputFormatFlag,
|
||||||
|
|
||||||
UseGame = usegame,
|
UseGame = usegame,
|
||||||
Prefix = prefix,
|
Prefix = prefix,
|
||||||
@@ -315,59 +316,8 @@ namespace SabreTools
|
|||||||
XSV = tsv,
|
XSV = tsv,
|
||||||
};
|
};
|
||||||
|
|
||||||
if ((outputFormatFlag & OutputFormatFlag.ClrMamePro) != 0)
|
DatTools.UpdateParallel(inputs, userInputDat, outputFormatFlag, outdir, merge, diffMode, cascade, inplace, skip, bare, clean, softlist,
|
||||||
{
|
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, maxDegreeOfParallelism, _logger);
|
||||||
userInputDat.OutputFormat = OutputFormat.ClrMamePro;
|
|
||||||
DatTools.UpdateParallel(inputs, userInputDat, outdir, merge, diffMode, cascade, inplace, skip, bare, clean, softlist,
|
|
||||||
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, maxDegreeOfParallelism, _logger);
|
|
||||||
}
|
|
||||||
if ((outputFormatFlag & OutputFormatFlag.MissFile) != 0 || tsv != null)
|
|
||||||
{
|
|
||||||
userInputDat.OutputFormat = OutputFormat.MissFile;
|
|
||||||
DatTools.UpdateParallel(inputs, userInputDat, outdir, merge, diffMode, cascade, inplace, skip, bare, clean, softlist,
|
|
||||||
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, maxDegreeOfParallelism, _logger);
|
|
||||||
}
|
|
||||||
if ((outputFormatFlag & OutputFormatFlag.RedumpMD5) != 0)
|
|
||||||
{
|
|
||||||
userInputDat.OutputFormat = OutputFormat.RedumpMD5;
|
|
||||||
DatTools.UpdateParallel(inputs, userInputDat, outdir, merge, diffMode, cascade, inplace, skip, bare, clean, softlist,
|
|
||||||
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, maxDegreeOfParallelism, _logger);
|
|
||||||
}
|
|
||||||
if ((outputFormatFlag & OutputFormatFlag.RedumpSFV) != 0)
|
|
||||||
{
|
|
||||||
userInputDat.OutputFormat = OutputFormat.RedumpSFV;
|
|
||||||
DatTools.UpdateParallel(inputs, userInputDat, outdir, merge, diffMode, cascade, inplace, skip, bare, clean, softlist,
|
|
||||||
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, maxDegreeOfParallelism, _logger);
|
|
||||||
}
|
|
||||||
if ((outputFormatFlag & OutputFormatFlag.RedumpSHA1) != 0)
|
|
||||||
{
|
|
||||||
userInputDat.OutputFormat = OutputFormat.RedumpSHA1;
|
|
||||||
DatTools.UpdateParallel(inputs, userInputDat, outdir, merge, diffMode, cascade, inplace, skip, bare, clean, softlist,
|
|
||||||
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, maxDegreeOfParallelism, _logger);
|
|
||||||
}
|
|
||||||
if ((outputFormatFlag & OutputFormatFlag.RomCenter) != 0)
|
|
||||||
{
|
|
||||||
userInputDat.OutputFormat = OutputFormat.RomCenter;
|
|
||||||
DatTools.UpdateParallel(inputs, userInputDat, outdir, merge, diffMode, cascade, inplace, skip, bare, clean, softlist,
|
|
||||||
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, maxDegreeOfParallelism, _logger);
|
|
||||||
}
|
|
||||||
if ((outputFormatFlag & OutputFormatFlag.SabreDat) != 0)
|
|
||||||
{
|
|
||||||
userInputDat.OutputFormat = OutputFormat.SabreDat;
|
|
||||||
DatTools.UpdateParallel(inputs, userInputDat, outdir, merge, diffMode, cascade, inplace, skip, bare, clean, softlist,
|
|
||||||
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, maxDegreeOfParallelism, _logger);
|
|
||||||
}
|
|
||||||
if ((outputFormatFlag & OutputFormatFlag.Xml) != 0)
|
|
||||||
{
|
|
||||||
userInputDat.OutputFormat = OutputFormat.Xml;
|
|
||||||
DatTools.UpdateParallel(inputs, userInputDat, outdir, merge, diffMode, cascade, inplace, skip, bare, clean, softlist,
|
|
||||||
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, maxDegreeOfParallelism, _logger);
|
|
||||||
}
|
|
||||||
if (outputFormatFlag == 0 && tsv == null)
|
|
||||||
{
|
|
||||||
DatTools.UpdateParallel(inputs, userInputDat, outdir, merge, diffMode, cascade, inplace, skip, bare, clean, softlist,
|
|
||||||
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, nodump, trim, single, root, maxDegreeOfParallelism, _logger);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -419,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),
|
||||||
OutputFormat = (old ? OutputFormat.ClrMamePro : OutputFormat.Xml),
|
OutputFormatFlag = (old ? OutputFormatFlag.ClrMamePro : OutputFormatFlag.Xml),
|
||||||
Romba = romba,
|
Romba = romba,
|
||||||
Type = (superdat ? "SuperDAT" : ""),
|
Type = (superdat ? "SuperDAT" : ""),
|
||||||
Files = new Dictionary<string, List<Rom>>(),
|
Files = new Dictionary<string, List<Rom>>(),
|
||||||
@@ -487,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),
|
||||||
OutputFormat = (old ? OutputFormat.ClrMamePro : OutputFormat.Xml),
|
OutputFormatFlag = (old ? OutputFormatFlag.ClrMamePro : OutputFormatFlag.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 = "";
|
||||||
OutputFormat outputFormat = OutputFormat.Xml;
|
OutputFormatFlag outputFormatFlag = OutputFormatFlag.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: " + (outputFormat.ToString()) + @"
|
3) Current output type: " + (outputFormatFlag.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":
|
||||||
outputFormat = OutputFormat.Xml;
|
outputFormatFlag = OutputFormatFlag.Xml;
|
||||||
break;
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
outputFormat = OutputFormat.ClrMamePro;
|
outputFormatFlag = OutputFormatFlag.ClrMamePro;
|
||||||
break;
|
break;
|
||||||
case "3":
|
case "3":
|
||||||
outputFormat = OutputFormat.RomCenter;
|
outputFormatFlag = OutputFormatFlag.RomCenter;
|
||||||
break;
|
break;
|
||||||
case "4":
|
case "4":
|
||||||
outputFormat = OutputFormat.SabreDat;
|
outputFormatFlag = OutputFormatFlag.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, "", "", "",
|
||||||
(outputFormat == OutputFormat.ClrMamePro), (outputFormat == OutputFormat.MissFile), (outputFormat == OutputFormat.RomCenter),
|
(outputFormatFlag == OutputFormatFlag.ClrMamePro), (outputFormatFlag == OutputFormatFlag.MissFile), (outputFormatFlag == OutputFormatFlag.RomCenter),
|
||||||
(outputFormat == OutputFormat.SabreDat), (outputFormat == OutputFormat.Xml), false, "", "", false, "", "", false, false, false,
|
(outputFormatFlag == OutputFormatFlag.SabreDat), (outputFormatFlag == OutputFormatFlag.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 = "";
|
||||||
outputFormat = OutputFormat.Xml;
|
outputFormatFlag = OutputFormatFlag.Xml;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.OutputFormat = OutputFormat.Xml;
|
_matched.OutputFormatFlag = OutputFormatFlag.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.OutputFormat = OutputFormat.Xml;
|
_datdata.OutputFormatFlag = OutputFormatFlag.Xml;
|
||||||
DatTools.WriteDatfile(_datdata, "", _logger);
|
DatTools.WriteDatfile(_datdata, "", _logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user