mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
30 lines
1017 B
C#
30 lines
1017 B
C#
using System;
|
|
|
|
namespace SabreTools.DatFiles.Formats
|
|
{
|
|
/// <summary>
|
|
/// Represents parsing of a hashfile such as an SFV, MD5, or SHA-1 file
|
|
/// </summary>
|
|
internal partial class Hashfile : DatFile
|
|
{
|
|
/// <inheritdoc/>
|
|
public override void ParseFile(string filename, int indexId, bool keep, bool statsOnly = false, bool throwOnError = false)
|
|
{
|
|
try
|
|
{
|
|
// Deserialize the input file
|
|
var hashfile = new Serialization.Files.Hashfile().Deserialize(filename, _hash);
|
|
var metadata = new Serialization.CrossModel.Hashfile().Serialize(hashfile);
|
|
|
|
// Convert to the internal format
|
|
ConvertMetadata(metadata, filename, indexId, statsOnly);
|
|
}
|
|
catch (Exception ex) when (!throwOnError)
|
|
{
|
|
string message = $"'{filename}' - An error occurred during parsing";
|
|
logger.Error(ex, message);
|
|
}
|
|
}
|
|
}
|
|
}
|