0
0
mirror of https://github.com/sp-tarkov/loot-dump-processor.git synced 2025-02-13 08:50:44 -05:00
bluextx 465ad95cb5 Refactored code to use System.Text.Json and improved code style
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
2025-01-11 10:52:23 +03:00

44 lines
939 B
C#

using System.Text.Json.Serialization;
using LootDumpProcessor.Utils;
namespace LootDumpProcessor.Model;
public class Item : ICloneable
{
[JsonPropertyName("_id")] public string? Id { get; set; }
[JsonPropertyName("_tpl")] public string? Tpl { get; set; }
public Upd? Upd { get; set; }
public string? ParentId { get; set; }
public string? SlotId { get; set; }
public object? Location { get; set; }
public override bool Equals(object? obj)
{
if (obj is not Item parsed)
return false;
return parsed.Tpl == Tpl && parsed.ParentId == ParentId;
}
public override int GetHashCode() => Tpl?.GetHashCode() + ParentId?.GetHashCode() ?? base.GetHashCode();
public object Clone() => new Item
{
Id = Id,
Tpl = Tpl,
ParentId = ParentId,
SlotId = SlotId,
Location = Location,
Upd = ProcessorUtil.Copy(Upd)
};
}