mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[ALL] Rename OutputFormat => DatFormat
This commit is contained in:
@@ -51,9 +51,9 @@ namespace SabreTools.Helper.Tools
|
||||
/// Get what type of DAT the input file is
|
||||
/// </summary>
|
||||
/// <param name="filename">Name of the file to be parsed</param>
|
||||
/// <returns>The OutputFormat corresponding to the DAT</returns>
|
||||
/// <returns>The DatFormat corresponding to the DAT</returns>
|
||||
/// <remarks>There is currently no differentiation between XML and SabreDAT here</remarks>
|
||||
public static OutputFormat GetOutputFormat(string filename, Logger logger)
|
||||
public static DatFormat GetDatFormat(string filename, Logger logger)
|
||||
{
|
||||
// Limit the output formats based on extension
|
||||
string ext = Path.GetExtension(filename).ToLowerInvariant();
|
||||
@@ -79,15 +79,15 @@ namespace SabreTools.Helper.Tools
|
||||
// Some formats only require the extension to know
|
||||
if (ext == "md5")
|
||||
{
|
||||
return OutputFormat.RedumpMD5;
|
||||
return DatFormat.RedumpMD5;
|
||||
}
|
||||
if (ext == "sfv")
|
||||
{
|
||||
return OutputFormat.RedumpSFV;
|
||||
return DatFormat.RedumpSFV;
|
||||
}
|
||||
if (ext == "sha1")
|
||||
{
|
||||
return OutputFormat.RedumpSHA1;
|
||||
return DatFormat.RedumpSHA1;
|
||||
}
|
||||
|
||||
// For everything else, we need to read it
|
||||
@@ -104,49 +104,49 @@ namespace SabreTools.Helper.Tools
|
||||
{
|
||||
if (second.StartsWith("<!doctype datafile"))
|
||||
{
|
||||
return OutputFormat.Logiqx;
|
||||
return DatFormat.Logiqx;
|
||||
}
|
||||
else if (second.StartsWith("<!doctype softwarelist"))
|
||||
{
|
||||
return OutputFormat.SoftwareList;
|
||||
return DatFormat.SoftwareList;
|
||||
}
|
||||
else if (second.StartsWith("<!doctype sabredat"))
|
||||
{
|
||||
return OutputFormat.SabreDat;
|
||||
return DatFormat.SabreDat;
|
||||
}
|
||||
else if (second.StartsWith("<dat") && !second.StartsWith("<datafile"))
|
||||
{
|
||||
return OutputFormat.OfflineList;
|
||||
return DatFormat.OfflineList;
|
||||
}
|
||||
// Older and non-compliant DATs
|
||||
else
|
||||
{
|
||||
return OutputFormat.Logiqx;
|
||||
return DatFormat.Logiqx;
|
||||
}
|
||||
}
|
||||
|
||||
// If we have an INI-based DAT
|
||||
else if (first.Contains("[") && first.Contains("]"))
|
||||
{
|
||||
return OutputFormat.RomCenter;
|
||||
return DatFormat.RomCenter;
|
||||
}
|
||||
|
||||
// If we have a CMP-based DAT
|
||||
else if (first.Contains("clrmamepro"))
|
||||
{
|
||||
return OutputFormat.ClrMamePro;
|
||||
return DatFormat.ClrMamePro;
|
||||
}
|
||||
else if (first.Contains("romvault"))
|
||||
{
|
||||
return OutputFormat.ClrMamePro;
|
||||
return DatFormat.ClrMamePro;
|
||||
}
|
||||
else if (first.Contains("doscenter"))
|
||||
{
|
||||
return OutputFormat.DOSCenter;
|
||||
return DatFormat.DOSCenter;
|
||||
}
|
||||
else
|
||||
{
|
||||
return OutputFormat.ClrMamePro;
|
||||
return DatFormat.ClrMamePro;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
|
||||
@@ -25,10 +25,10 @@ namespace SabreTools.Helper.Tools
|
||||
/// <param name="datdata">DAT information</param>
|
||||
/// <param name="overwrite">True if we ignore existing files (default), false otherwise</param>
|
||||
/// <returns>Dictionary of output formats mapped to file names</returns>
|
||||
public static Dictionary<OutputFormat, string> CreateOutfileNames(string outDir, DatFile datdata, bool overwrite = true)
|
||||
public static Dictionary<DatFormat, string> CreateOutfileNames(string outDir, DatFile datdata, bool overwrite = true)
|
||||
{
|
||||
// Create the output dictionary
|
||||
Dictionary<OutputFormat, string> outfileNames = new Dictionary<OutputFormat, string>();
|
||||
Dictionary<DatFormat, string> outfileNames = new Dictionary<DatFormat, string>();
|
||||
|
||||
// Double check the outDir for the end delim
|
||||
if (!outDir.EndsWith(Path.DirectorySeparatorChar.ToString()))
|
||||
@@ -39,117 +39,117 @@ namespace SabreTools.Helper.Tools
|
||||
// Get the extensions from the output type
|
||||
|
||||
// ClrMamePro
|
||||
if ((datdata.OutputFormat & OutputFormat.ClrMamePro) != 0)
|
||||
if ((datdata.DatFormat & DatFormat.ClrMamePro) != 0)
|
||||
{
|
||||
outfileNames.Add(OutputFormat.ClrMamePro, CreateOutfileNamesHelper(outDir, ".dat", datdata, overwrite));
|
||||
outfileNames.Add(DatFormat.ClrMamePro, CreateOutfileNamesHelper(outDir, ".dat", datdata, overwrite));
|
||||
};
|
||||
|
||||
// CSV
|
||||
if ((datdata.OutputFormat & OutputFormat.CSV) != 0)
|
||||
if ((datdata.DatFormat & DatFormat.CSV) != 0)
|
||||
{
|
||||
outfileNames.Add(OutputFormat.CSV, CreateOutfileNamesHelper(outDir, ".csv", datdata, overwrite));
|
||||
outfileNames.Add(DatFormat.CSV, CreateOutfileNamesHelper(outDir, ".csv", datdata, overwrite));
|
||||
};
|
||||
|
||||
// DOSCenter
|
||||
if ((datdata.OutputFormat & OutputFormat.DOSCenter) != 0
|
||||
&& (datdata.OutputFormat & OutputFormat.ClrMamePro) == 0
|
||||
&& (datdata.OutputFormat & OutputFormat.RomCenter) == 0)
|
||||
if ((datdata.DatFormat & DatFormat.DOSCenter) != 0
|
||||
&& (datdata.DatFormat & DatFormat.ClrMamePro) == 0
|
||||
&& (datdata.DatFormat & DatFormat.RomCenter) == 0)
|
||||
{
|
||||
outfileNames.Add(OutputFormat.DOSCenter, CreateOutfileNamesHelper(outDir, ".dat", datdata, overwrite));
|
||||
outfileNames.Add(DatFormat.DOSCenter, CreateOutfileNamesHelper(outDir, ".dat", datdata, overwrite));
|
||||
};
|
||||
if ((datdata.OutputFormat & OutputFormat.DOSCenter) != 0
|
||||
&& ((datdata.OutputFormat & OutputFormat.ClrMamePro) != 0
|
||||
|| (datdata.OutputFormat & OutputFormat.RomCenter) != 0))
|
||||
if ((datdata.DatFormat & DatFormat.DOSCenter) != 0
|
||||
&& ((datdata.DatFormat & DatFormat.ClrMamePro) != 0
|
||||
|| (datdata.DatFormat & DatFormat.RomCenter) != 0))
|
||||
{
|
||||
outfileNames.Add(OutputFormat.DOSCenter, CreateOutfileNamesHelper(outDir, ".dc.dat", datdata, overwrite));
|
||||
outfileNames.Add(DatFormat.DOSCenter, CreateOutfileNamesHelper(outDir, ".dc.dat", datdata, overwrite));
|
||||
};
|
||||
|
||||
// Logiqx XML
|
||||
if ((datdata.OutputFormat & OutputFormat.Logiqx) != 0)
|
||||
if ((datdata.DatFormat & DatFormat.Logiqx) != 0)
|
||||
{
|
||||
outfileNames.Add(OutputFormat.Logiqx, CreateOutfileNamesHelper(outDir, ".xml", datdata, overwrite));
|
||||
outfileNames.Add(DatFormat.Logiqx, CreateOutfileNamesHelper(outDir, ".xml", datdata, overwrite));
|
||||
};
|
||||
|
||||
// Missfile
|
||||
if ((datdata.OutputFormat & OutputFormat.MissFile) != 0)
|
||||
if ((datdata.DatFormat & DatFormat.MissFile) != 0)
|
||||
{
|
||||
outfileNames.Add(OutputFormat.MissFile, CreateOutfileNamesHelper(outDir, ".txt", datdata, overwrite));
|
||||
outfileNames.Add(DatFormat.MissFile, CreateOutfileNamesHelper(outDir, ".txt", datdata, overwrite));
|
||||
};
|
||||
|
||||
// OfflineList
|
||||
if (((datdata.OutputFormat & OutputFormat.OfflineList) != 0)
|
||||
&& (datdata.OutputFormat & OutputFormat.Logiqx) == 0
|
||||
&& (datdata.OutputFormat & OutputFormat.SabreDat) == 0
|
||||
&& (datdata.OutputFormat & OutputFormat.SoftwareList) == 0)
|
||||
if (((datdata.DatFormat & DatFormat.OfflineList) != 0)
|
||||
&& (datdata.DatFormat & DatFormat.Logiqx) == 0
|
||||
&& (datdata.DatFormat & DatFormat.SabreDat) == 0
|
||||
&& (datdata.DatFormat & DatFormat.SoftwareList) == 0)
|
||||
{
|
||||
outfileNames.Add(OutputFormat.OfflineList, CreateOutfileNamesHelper(outDir, ".xml", datdata, overwrite));
|
||||
outfileNames.Add(DatFormat.OfflineList, CreateOutfileNamesHelper(outDir, ".xml", datdata, overwrite));
|
||||
}
|
||||
if (((datdata.OutputFormat & OutputFormat.OfflineList) != 0
|
||||
&& ((datdata.OutputFormat & OutputFormat.Logiqx) != 0
|
||||
|| (datdata.OutputFormat & OutputFormat.SabreDat) != 0
|
||||
|| (datdata.OutputFormat & OutputFormat.SoftwareList) != 0)))
|
||||
if (((datdata.DatFormat & DatFormat.OfflineList) != 0
|
||||
&& ((datdata.DatFormat & DatFormat.Logiqx) != 0
|
||||
|| (datdata.DatFormat & DatFormat.SabreDat) != 0
|
||||
|| (datdata.DatFormat & DatFormat.SoftwareList) != 0)))
|
||||
{
|
||||
outfileNames.Add(OutputFormat.OfflineList, CreateOutfileNamesHelper(outDir, ".ol.xml", datdata, overwrite));
|
||||
outfileNames.Add(DatFormat.OfflineList, CreateOutfileNamesHelper(outDir, ".ol.xml", datdata, overwrite));
|
||||
}
|
||||
|
||||
// Redump MD5
|
||||
if ((datdata.OutputFormat & OutputFormat.RedumpMD5) != 0)
|
||||
if ((datdata.DatFormat & DatFormat.RedumpMD5) != 0)
|
||||
{
|
||||
outfileNames.Add(OutputFormat.RedumpMD5, CreateOutfileNamesHelper(outDir, ".md5", datdata, overwrite));
|
||||
outfileNames.Add(DatFormat.RedumpMD5, CreateOutfileNamesHelper(outDir, ".md5", datdata, overwrite));
|
||||
};
|
||||
|
||||
// Redump SFV
|
||||
if ((datdata.OutputFormat & OutputFormat.RedumpSFV) != 0)
|
||||
if ((datdata.DatFormat & DatFormat.RedumpSFV) != 0)
|
||||
{
|
||||
outfileNames.Add(OutputFormat.RedumpSFV, CreateOutfileNamesHelper(outDir, ".sfv", datdata, overwrite));
|
||||
outfileNames.Add(DatFormat.RedumpSFV, CreateOutfileNamesHelper(outDir, ".sfv", datdata, overwrite));
|
||||
};
|
||||
|
||||
// Redump SHA-1
|
||||
if ((datdata.OutputFormat & OutputFormat.RedumpSHA1) != 0)
|
||||
if ((datdata.DatFormat & DatFormat.RedumpSHA1) != 0)
|
||||
{
|
||||
outfileNames.Add(OutputFormat.RedumpSHA1, CreateOutfileNamesHelper(outDir, ".sha1", datdata, overwrite));
|
||||
outfileNames.Add(DatFormat.RedumpSHA1, CreateOutfileNamesHelper(outDir, ".sha1", datdata, overwrite));
|
||||
};
|
||||
|
||||
// RomCenter
|
||||
if ((datdata.OutputFormat & OutputFormat.RomCenter) != 0
|
||||
&& (datdata.OutputFormat & OutputFormat.ClrMamePro) == 0)
|
||||
if ((datdata.DatFormat & DatFormat.RomCenter) != 0
|
||||
&& (datdata.DatFormat & DatFormat.ClrMamePro) == 0)
|
||||
{
|
||||
outfileNames.Add(OutputFormat.RomCenter, CreateOutfileNamesHelper(outDir, ".dat", datdata, overwrite));
|
||||
outfileNames.Add(DatFormat.RomCenter, CreateOutfileNamesHelper(outDir, ".dat", datdata, overwrite));
|
||||
};
|
||||
if ((datdata.OutputFormat & OutputFormat.RomCenter) != 0
|
||||
&& (datdata.OutputFormat & OutputFormat.ClrMamePro) != 0)
|
||||
if ((datdata.DatFormat & DatFormat.RomCenter) != 0
|
||||
&& (datdata.DatFormat & DatFormat.ClrMamePro) != 0)
|
||||
{
|
||||
outfileNames.Add(OutputFormat.RomCenter, CreateOutfileNamesHelper(outDir, ".rc.dat", datdata, overwrite));
|
||||
outfileNames.Add(DatFormat.RomCenter, CreateOutfileNamesHelper(outDir, ".rc.dat", datdata, overwrite));
|
||||
};
|
||||
|
||||
// SabreDAT
|
||||
if ((datdata.OutputFormat & OutputFormat.SabreDat) != 0 && (datdata.OutputFormat & OutputFormat.Logiqx) == 0)
|
||||
if ((datdata.DatFormat & DatFormat.SabreDat) != 0 && (datdata.DatFormat & DatFormat.Logiqx) == 0)
|
||||
{
|
||||
outfileNames.Add(OutputFormat.SabreDat, CreateOutfileNamesHelper(outDir, ".xml", datdata, overwrite));
|
||||
outfileNames.Add(DatFormat.SabreDat, CreateOutfileNamesHelper(outDir, ".xml", datdata, overwrite));
|
||||
};
|
||||
if ((datdata.OutputFormat & OutputFormat.SabreDat) != 0 && (datdata.OutputFormat & OutputFormat.Logiqx) != 0)
|
||||
if ((datdata.DatFormat & DatFormat.SabreDat) != 0 && (datdata.DatFormat & DatFormat.Logiqx) != 0)
|
||||
{
|
||||
outfileNames.Add(OutputFormat.SabreDat, CreateOutfileNamesHelper(outDir, ".sd.xml", datdata, overwrite));
|
||||
outfileNames.Add(DatFormat.SabreDat, CreateOutfileNamesHelper(outDir, ".sd.xml", datdata, overwrite));
|
||||
};
|
||||
|
||||
// Software List
|
||||
if ((datdata.OutputFormat & OutputFormat.SoftwareList) != 0
|
||||
&& (datdata.OutputFormat & OutputFormat.Logiqx) == 0
|
||||
&& (datdata.OutputFormat & OutputFormat.SabreDat) == 0)
|
||||
if ((datdata.DatFormat & DatFormat.SoftwareList) != 0
|
||||
&& (datdata.DatFormat & DatFormat.Logiqx) == 0
|
||||
&& (datdata.DatFormat & DatFormat.SabreDat) == 0)
|
||||
{
|
||||
outfileNames.Add(OutputFormat.SoftwareList, CreateOutfileNamesHelper(outDir, ".xml", datdata, overwrite));
|
||||
outfileNames.Add(DatFormat.SoftwareList, CreateOutfileNamesHelper(outDir, ".xml", datdata, overwrite));
|
||||
}
|
||||
if ((datdata.OutputFormat & OutputFormat.SoftwareList) != 0
|
||||
&& ((datdata.OutputFormat & OutputFormat.Logiqx) != 0
|
||||
|| (datdata.OutputFormat & OutputFormat.SabreDat) != 0))
|
||||
if ((datdata.DatFormat & DatFormat.SoftwareList) != 0
|
||||
&& ((datdata.DatFormat & DatFormat.Logiqx) != 0
|
||||
|| (datdata.DatFormat & DatFormat.SabreDat) != 0))
|
||||
{
|
||||
outfileNames.Add(OutputFormat.SoftwareList, CreateOutfileNamesHelper(outDir, ".sl.xml", datdata, overwrite));
|
||||
outfileNames.Add(DatFormat.SoftwareList, CreateOutfileNamesHelper(outDir, ".sl.xml", datdata, overwrite));
|
||||
}
|
||||
|
||||
// TSV
|
||||
if ((datdata.OutputFormat & OutputFormat.TSV) != 0)
|
||||
if ((datdata.DatFormat & DatFormat.TSV) != 0)
|
||||
{
|
||||
outfileNames.Add(OutputFormat.TSV, CreateOutfileNamesHelper(outDir, ".tsv", datdata, overwrite));
|
||||
outfileNames.Add(DatFormat.TSV, CreateOutfileNamesHelper(outDir, ".tsv", datdata, overwrite));
|
||||
};
|
||||
|
||||
return outfileNames;
|
||||
|
||||
Reference in New Issue
Block a user