chomp 6e4c7abf73 dump-processor-cleanup (#6)
Co-authored-by: Alex <alex@dm-me-for-questions.com>
Reviewed-on: SPT-AKI/LootDumpProcessor#6
2024-04-16 18:29:40 +00:00

31 lines
936 B
C#

using System.Text.RegularExpressions;
using LootDumpProcessor.Storage;
namespace LootDumpProcessor.Model.Processing;
public class ParsedDump : IKeyable
{
private static readonly Regex _hashRegex = new("([^a-zA-Z0-9])");
public BasicInfo BasicInfo { get; set; }
public PreProcessedLooseLoot LooseLoot { get; set; }
public List<PreProcessedStaticLoot> Containers { get; set; }
public override bool Equals(object? obj)
{
if (obj is ParsedDump dump)
return dump.BasicInfo.Equals(BasicInfo);
return false;
}
public override int GetHashCode()
{
return BasicInfo.GetHashCode();
}
public IKey GetKey()
{
var sanitizedHash = _hashRegex.Replace(BasicInfo.FileHash, "");
return new SubdivisionedUniqueKey(new[]
{ "parsedDumps", BasicInfo.Map, $"{BasicInfo.FileName.Split("\\").Last().Replace(".", "")}-{sanitizedHash}" });
}
}