using StardewValley; using StardustCore.Objects.Tools.SerializationInformation; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace StardustCore.Serialization { /// /// A class that handles saving/loading custom objects to and from the world. /// public class SerializerDataNode { /// /// A function that handles loading an object back into it's Item form. /// /// The path to the file. /// public delegate Item ParsingFunction(string path); /// /// A function that handles saving an item. /// /// public delegate void SerializingFunction(Item item); /// /// A function that handles saving an item from/to a container. /// /// /// public delegate void SerializingToContainerFunction(Item item, string s); /// /// A function that handles saving.loading items into the world. /// /// public delegate void WorldParsingFunction(Item obj); /// /// Saves an object to an inventory. /// public SerializingFunction serialize; /// /// Saves an object to a container /// public SerializingToContainerFunction serializeToContainer; /// /// Loads in an object. /// public ParsingFunction parse; /// /// Loads in an object to the game world. /// public WorldParsingFunction worldObj; /// /// Constructor. /// /// A function to be ran to save this object. /// A function to be ran to load this object. /// A function to be ran to load this object to the world. /// A function to be ran to save/load objects to storage containers such as chests. public SerializerDataNode(SerializingFunction serializeFunction, ParsingFunction parsingFunction, WorldParsingFunction worldObjectParsingFunction, SerializingToContainerFunction containerSerializationFunction) { serialize = serializeFunction; parse = parsingFunction; worldObj = worldObjectParsingFunction; serializeToContainer = containerSerializationFunction; } } }