31 lines
936 B
C#
Raw Permalink Normal View History

using System.Text.RegularExpressions;
2023-08-12 19:08:38 +01:00
using LootDumpProcessor.Storage;
namespace LootDumpProcessor.Model.Processing;
public class ParsedDump : IKeyable
{
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)
return dump.BasicInfo.Equals(BasicInfo);
2023-08-12 19:08:38 +01:00
return false;
}
public override int GetHashCode()
{
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}" });
}
}