diff --git a/SabreTools.DatFiles/DatFileTool.cs b/SabreTools.DatFiles/DatFileTool.cs
index c2d19477..558422f6 100644
--- a/SabreTools.DatFiles/DatFileTool.cs
+++ b/SabreTools.DatFiles/DatFileTool.cs
@@ -31,6 +31,21 @@ namespace SabreTools.DatFiles
#region Creation
+ ///
+ /// Create a generic DatFile to be used
+ ///
+ /// A default Logiqx DatFile
+ public static DatFile CreateDatFile()
+ => CreateDatFile(DatFormat.Logiqx, baseDat: null, quotes: true);
+
+ ///
+ /// Create a specific type of DatFile to be used based on a format
+ ///
+ /// Format of the DAT to be created
+ /// DatFile of the specific internal type
+ public static DatFile CreateDatFile(DatFormat datFormat)
+ => CreateDatFile(datFormat, baseDat: null, quotes: true);
+
///
/// Create a specific type of DatFile to be used based on a format and a base DAT
///
@@ -38,7 +53,7 @@ namespace SabreTools.DatFiles
/// DatFile containing the information to use in specific operations
/// For relevant types, assume the usage of quotes
/// DatFile of the specific internal type that corresponds to the inputs
- 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
{
diff --git a/SabreTools.DatFiles/Parser.cs b/SabreTools.DatFiles/Parser.cs
index f513d466..4b753382 100644
--- a/SabreTools.DatFiles/Parser.cs
+++ b/SabreTools.DatFiles/Parser.cs
@@ -112,8 +112,8 @@ namespace SabreTools.DatFiles
// Now parse the correct type of DAT
try
{
- var parsingDatFile = DatFileTool.CreateDatFile(currentPathFormat, datFile, quotes);
- parsingDatFile?.ParseFile(currentPath, indexId, keep, statsOnly: statsOnly, throwOnError: throwOnError);
+ DatFile parsingDatFile = DatFileTool.CreateDatFile(currentPathFormat, datFile, quotes);
+ parsingDatFile.ParseFile(currentPath, indexId, keep, statsOnly: statsOnly, throwOnError: throwOnError);
}
catch (Exception ex) when (!throwOnError)
{
diff --git a/SabreTools.DatTools/Writer.cs b/SabreTools.DatTools/Writer.cs
index d2dfb986..cd7730ca 100644
--- a/SabreTools.DatTools/Writer.cs
+++ b/SabreTools.DatTools/Writer.cs
@@ -90,7 +90,8 @@ namespace SabreTools.DatTools
string outfile = outfiles[datFormat];
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)
{