mirror of
https://github.com/sp-tarkov/loot-dump-processor.git
synced 2025-02-13 07:10:45 -05:00
The changes include: - Replaced Newtonsoft.Json with System.Text.Json for serialization - Removed redundant JsonProperty attributes and simplified model classes - Converted static fields to constants where appropriate - Improved code formatting and readability - Simplified method bodies and expressions - Removed unused imports and cleaned up namespaces
30 lines
937 B
C#
30 lines
937 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 IReadOnlyList<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() => BasicInfo.GetHashCode();
|
|
|
|
public IKey GetKey()
|
|
{
|
|
var sanitizedHash = _hashRegex.Replace(BasicInfo.FileHash, "");
|
|
return new SubdivisionedUniqueKey(new[]
|
|
{
|
|
"parsedDumps", BasicInfo.Map, $"{BasicInfo.FileName.Split("\\").Last().Replace(".", "")}-{sanitizedHash}"
|
|
});
|
|
}
|
|
} |