using System; namespace SabreTools.DatFiles.Formats { /// /// Represents parsing of a hashfile such as an SFV, MD5, or SHA-1 file /// internal partial class Hashfile : DatFile { /// 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, keep, statsOnly); } catch (Exception ex) when (!throwOnError) { string message = $"'{filename}' - An error occurred during parsing"; logger.Error(ex, message); } } } }