using System; using System.Collections.Generic; using System.Reflection; using System.Threading.Tasks; using JetBrains.Annotations; using NetSerializer; using Robust.Shared.Network; using Robust.Shared.Network.Messages; using Robust.Shared.Serialization.Markdown; using Robust.Shared.Serialization.Markdown.Mapping; using YamlDotNet.RepresentationModel; namespace Robust.Shared.Serialization { [PublicAPI] internal interface IRobustMappedStringSerializer { bool Locked { get; } /// /// The type serializer to register with NetSerializer. /// ITypeSerializer TypeSerializer { get; } /// /// Starts the handshake from the server end of the given channel, /// sending a . /// /// The network channel to perform the handshake over. /// /// Locks the string mapping if this is the first time the server is /// performing the handshake. /// /// /// Task Handshake(INetChannel channel); /// /// The hash of the string mapping. /// /// /// Thrown if the mapping is not locked. /// ReadOnlySpan MappedStringsHash { get; } bool EnableCaching { get; set; } /// /// Add a string to the constant mapping. /// /// /// If the string has multiple detectable subcomponents, such as a /// filepath, it may result in more than one string being added to /// the mapping. As string parts are commonly sent as subsets or /// scoped names, this increases the likelyhood of a successful /// string mapping. /// /// /// true if the string was added to the mapping for the first /// time, false otherwise. /// /// /// Thrown if the string is not normalized (). /// void AddString(string str); /// /// Add the constant strings from an to the /// mapping. /// /// The assembly from which to collect constant strings. void AddStrings(Assembly asm); /// /// Add strings from the given to the mapping. /// /// /// Strings are taken from YAML anchors, tags, and leaf nodes. /// /// The YAML to collect strings from. void AddStrings(YamlStream yaml); void AddStrings(DataNode dataNode); /// /// Add strings from the given enumeration to the mapping. /// /// The strings to add. void AddStrings(IEnumerable strings); /// /// See . /// event Action? ClientHandshakeComplete; /// /// Lock the string mapping so that no new strings may be added, /// and generate the strings package that can be sent to clients. /// void LockStrings(); void Initialize(); (byte[] mapHash, byte[] package) GeneratePackage(); void SetPackage(byte[] hash, byte[] package); } }