mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Create overloads for CreateDatFile
This commit is contained in:
@@ -31,6 +31,21 @@ namespace SabreTools.DatFiles
|
|||||||
|
|
||||||
#region Creation
|
#region Creation
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a generic DatFile to be used
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A default Logiqx DatFile</returns>
|
||||||
|
public static DatFile CreateDatFile()
|
||||||
|
=> CreateDatFile(DatFormat.Logiqx, baseDat: null, quotes: true);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a specific type of DatFile to be used based on a format
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="datFormat">Format of the DAT to be created</param>
|
||||||
|
/// <returns>DatFile of the specific internal type</returns>
|
||||||
|
public static DatFile CreateDatFile(DatFormat datFormat)
|
||||||
|
=> CreateDatFile(datFormat, baseDat: null, quotes: true);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a specific type of DatFile to be used based on a format and a base DAT
|
/// Create a specific type of DatFile to be used based on a format and a base DAT
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -38,7 +53,7 @@ namespace SabreTools.DatFiles
|
|||||||
/// <param name="baseDat">DatFile containing the information to use in specific operations</param>
|
/// <param name="baseDat">DatFile containing the information to use in specific operations</param>
|
||||||
/// <param name="quotes">For relevant types, assume the usage of quotes</param>
|
/// <param name="quotes">For relevant types, assume the usage of quotes</param>
|
||||||
/// <returns>DatFile of the specific internal type that corresponds to the inputs</returns>
|
/// <returns>DatFile of the specific internal type that corresponds to the inputs</returns>
|
||||||
public static DatFile CreateDatFile(DatFormat? datFormat = null, DatFile? baseDat = null, bool quotes = true)
|
public static DatFile CreateDatFile(DatFormat datFormat, DatFile? baseDat, bool quotes)
|
||||||
{
|
{
|
||||||
return datFormat switch
|
return datFormat switch
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -112,8 +112,8 @@ namespace SabreTools.DatFiles
|
|||||||
// Now parse the correct type of DAT
|
// Now parse the correct type of DAT
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var parsingDatFile = DatFileTool.CreateDatFile(currentPathFormat, datFile, quotes);
|
DatFile parsingDatFile = DatFileTool.CreateDatFile(currentPathFormat, datFile, quotes);
|
||||||
parsingDatFile?.ParseFile(currentPath, indexId, keep, statsOnly: statsOnly, throwOnError: throwOnError);
|
parsingDatFile.ParseFile(currentPath, indexId, keep, statsOnly: statsOnly, throwOnError: throwOnError);
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -90,7 +90,8 @@ namespace SabreTools.DatTools
|
|||||||
string outfile = outfiles[datFormat];
|
string outfile = outfiles[datFormat];
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DatFileTool.CreateDatFile(datFormat, datFile, quotes)?.WriteToFile(outfile, ignoreblanks, throwOnError);
|
DatFile writingDatFile = DatFileTool.CreateDatFile(currentPathFormat, datFile, quotes);
|
||||||
|
writingDatFile.WriteToFile(outfile, ignoreblanks, throwOnError);
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user