2023-07-30 22:06:48 -04:00
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace SabreTools.DatFiles.Formats
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Represents parsing a Logiqx-derived DAT
|
|
|
|
|
/// </summary>
|
|
|
|
|
internal partial class Logiqx : DatFile
|
|
|
|
|
{
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
public override void ParseFile(string filename, int indexId, bool keep, bool statsOnly = false, bool throwOnError = false)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2023-07-30 22:59:04 -04:00
|
|
|
// Deserialize the input file
|
2023-09-11 01:20:21 -04:00
|
|
|
var metadataFile = new Serialization.Files.Logiqx().Deserialize(filename);
|
2024-03-10 00:43:45 -05:00
|
|
|
var metadata = new Serialization.CrossModel.Logiqx().Serialize(metadataFile);
|
2023-07-30 22:06:48 -04:00
|
|
|
|
2024-03-10 00:43:45 -05:00
|
|
|
// Convert to the internal format
|
2024-03-10 22:49:15 -04:00
|
|
|
ConvertMetadata(metadata, filename, indexId, keep, statsOnly);
|
2023-07-30 22:06:48 -04:00
|
|
|
}
|
|
|
|
|
catch (Exception ex) when (!throwOnError)
|
|
|
|
|
{
|
2023-07-30 22:59:04 -04:00
|
|
|
string message = $"'{filename}' - An error occurred during parsing";
|
|
|
|
|
logger.Error(ex, message);
|
2023-07-30 22:06:48 -04:00
|
|
|
}
|
2023-07-30 22:59:04 -04:00
|
|
|
}
|
2023-07-30 22:06:48 -04:00
|
|
|
}
|
|
|
|
|
}
|