using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace IPA.Config.Stores.Attributes { /// /// Causes a field or property in an object being wrapped by to be /// ignored during serialization and deserialization. /// [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = true)] public sealed class IgnoreAttribute : Attribute { } /// /// Indicates that a field or property in an object being wrapped by /// that would otherwise be nullable (i.e. a reference type or a type) should never be null, and the /// member will be ignored if the deserialized value is . /// [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = true)] public sealed class NonNullableAttribute : Attribute { } /// /// Specifies a name for the serialized field or property in an object being wrapped by /// that is different from the member name itself. /// /// /// /// When serializing the following object, we might get the JSON that follows. /// /// public class PluginConfig /// { /// public virtual bool BooleanField { get; set; } = true; /// } /// /// /// { /// "BooleanField": true /// } /// /// /// /// However, if we were to add a to that field, we would get the following. /// /// public class PluginConfig /// { /// [SerializedName("bool")] /// public virtual bool BooleanField { get; set; } = true; /// } /// /// /// { /// "bool": true /// } /// /// /// [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = true)] public sealed class SerializedNameAttribute : Attribute { /// /// Gets the name to replace the member name with. /// public string Name { get; private set; } /// /// Creates a new with the given . /// /// the value to assign to public SerializedNameAttribute(string name) { Name = name; } } }