mirror of
https://github.com/SoDOff-Project/sodoff.git
synced 2025-10-11 08:18:49 -07:00

.net 8 deprecated BinaryFormatter serialization apart from that proper deep copies are ~10x faster
53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
using System.Xml.Serialization;
|
|
|
|
namespace sodoff.Schema;
|
|
|
|
[XmlRoot(ElementName = "UserItem", Namespace = "")]
|
|
[Serializable]
|
|
public class UserItemData {
|
|
public UserItemData() {}
|
|
|
|
public UserItemData(UserItemData other) {
|
|
ItemID = other.ItemID;
|
|
ModifiedDate = other.ModifiedDate;
|
|
UserItemAttributes = new PairData(other.UserItemAttributes);
|
|
ItemStats = other.ItemStats.Select(stat => new ItemStat(stat)).ToArray();
|
|
ItemTier = other.ItemTier;
|
|
CreatedDate = other.CreatedDate;
|
|
UserInventoryID = other.UserInventoryID;
|
|
Quantity = other.Quantity;
|
|
Uses = other.Uses;
|
|
Item = new ItemData(other.Item);
|
|
}
|
|
|
|
[XmlElement(ElementName = "iid")]
|
|
public int ItemID { get; set; }
|
|
|
|
[XmlElement(ElementName = "md", IsNullable = true)]
|
|
public DateTime? ModifiedDate { get; set; }
|
|
|
|
[XmlElement(ElementName = "uia", IsNullable = true)]
|
|
public PairData UserItemAttributes { get; set; }
|
|
|
|
[XmlElement(ElementName = "iss", IsNullable = true)]
|
|
public ItemStat[] ItemStats { get; set; }
|
|
|
|
[XmlElement(ElementName = "IT", IsNullable = true)]
|
|
public ItemTier? ItemTier { get; set; }
|
|
|
|
[XmlElement(ElementName = "cd", IsNullable = true)]
|
|
public DateTime? CreatedDate { get; set; }
|
|
|
|
[XmlElement(ElementName = "uiid")]
|
|
public int UserInventoryID;
|
|
|
|
[XmlElement(ElementName = "q")]
|
|
public int Quantity;
|
|
|
|
[XmlElement(ElementName = "u")]
|
|
public int Uses;
|
|
|
|
[XmlElement(ElementName = "i")]
|
|
public ItemData Item;
|
|
}
|