mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Split CreateDatFile overload for clarity of use
This commit is contained in:
@@ -28,13 +28,19 @@ namespace SabreTools.DatFiles
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a generic DatFile to be used
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Empty, default DatFile implementation</returns>
|
||||||
|
public static DatFile CreateDatFile() => CreateDatFile(DatFormat.Logiqx, baseDat: null);
|
||||||
|
|
||||||
/// <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>
|
||||||
/// <param name="datFormat">Format of the DAT to be created, default is <see cref="DatFormat.Logiqx"/> </param>
|
/// <param name="datFormat">Format of the DAT to be created</param>
|
||||||
/// <param name="baseDat">DatFile containing the information to use in specific operations, default is null</param>
|
/// <param name="baseDat">DatFile containing the information to use in specific operations</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 = DatFormat.Logiqx, DatFile? baseDat = null)
|
public static DatFile CreateDatFile(DatFormat datFormat, DatFile? baseDat)
|
||||||
{
|
{
|
||||||
return datFormat switch
|
return datFormat switch
|
||||||
{
|
{
|
||||||
@@ -80,7 +86,7 @@ namespace SabreTools.DatFiles
|
|||||||
public static DatFile CreateDatFile(DatHeader datHeader, DatModifiers datModifiers)
|
public static DatFile CreateDatFile(DatHeader datHeader, DatModifiers datModifiers)
|
||||||
{
|
{
|
||||||
DatFormat format = datHeader.GetFieldValue<DatFormat>(DatHeader.DatFormatKey);
|
DatFormat format = datHeader.GetFieldValue<DatFormat>(DatHeader.DatFormatKey);
|
||||||
DatFile datFile = CreateDatFile(format);
|
DatFile datFile = CreateDatFile(format, baseDat: null);
|
||||||
datFile.SetHeader(datHeader);
|
datFile.SetHeader(datHeader);
|
||||||
datFile.SetModifiers(datModifiers);
|
datFile.SetModifiers(datModifiers);
|
||||||
return datFile;
|
return datFile;
|
||||||
|
|||||||
Reference in New Issue
Block a user