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