mirror of
https://github.com/sp-tarkov/loot-dump-processor.git
synced 2025-02-13 09:50:44 -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
33 lines
979 B
C#
33 lines
979 B
C#
using System.Text.Json.Serialization;
|
|
using LootDumpProcessor.Utils;
|
|
|
|
namespace LootDumpProcessor.Storage.Collections;
|
|
|
|
public class SubdivisionedKeyableDictionary<K, V> : Dictionary<K, V>, IKeyable
|
|
{
|
|
[JsonPropertyName("__id__")] public string __ID { get; set; } = KeyGenerator.GetNextKey();
|
|
|
|
public string? Extras
|
|
{
|
|
get => ExtraSubdivisions == null ? null : string.Join(",", ExtraSubdivisions);
|
|
set => ExtraSubdivisions = value?.Split(",");
|
|
}
|
|
|
|
[JsonIgnore] private string[]? ExtraSubdivisions { get; set; }
|
|
|
|
public IKey GetKey()
|
|
{
|
|
if (ExtraSubdivisions != null)
|
|
{
|
|
var subdivisions = new List<string>
|
|
{
|
|
"dictionaries"
|
|
};
|
|
subdivisions.AddRange(ExtraSubdivisions);
|
|
subdivisions.Add(__ID);
|
|
return new SubdivisionedUniqueKey(subdivisions.ToArray());
|
|
}
|
|
|
|
return new SubdivisionedUniqueKey(["dictionaries", __ID]);
|
|
}
|
|
} |