2024-04-16 18:29:40 +00:00
|
|
|
using System.Text.RegularExpressions;
|
2023-08-12 19:08:38 +01:00
|
|
|
using LootDumpProcessor.Storage;
|
|
|
|
|
|
|
|
namespace LootDumpProcessor.Model.Processing;
|
|
|
|
|
|
|
|
public class ParsedDump : IKeyable
|
|
|
|
{
|
2024-04-16 18:29:40 +00:00
|
|
|
private static readonly Regex _hashRegex = new("([^a-zA-Z0-9])");
|
2023-08-12 19:08:38 +01:00
|
|
|
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)
|
2024-04-16 18:29:40 +00:00
|
|
|
return dump.BasicInfo.Equals(BasicInfo);
|
2023-08-12 19:08:38 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
{
|
2024-04-16 18:29:40 +00:00
|
|
|
return BasicInfo.GetHashCode();
|
2023-08-12 19:08:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public IKey GetKey()
|
|
|
|
{
|
|
|
|
var sanitizedHash = _hashRegex.Replace(BasicInfo.FileHash, "");
|
|
|
|
return new SubdivisionedUniqueKey(new[]
|
|
|
|
{ "parsedDumps", BasicInfo.Map, $"{BasicInfo.FileName.Split("\\").Last().Replace(".", "")}-{sanitizedHash}" });
|
|
|
|
}
|
|
|
|
}
|