using System;
using System.Reflection;
namespace FullSerializer {
// Global configuration options.
public static class fsGlobalConfig {
///
/// Should deserialization be case sensitive? If this is false and the JSON has multiple members with the
/// same keys only separated by case, then this results in undefined behavior.
///
public static bool IsCaseSensitive = true;
///
/// If exceptions are allowed internally, then additional date formats can be deserialized.
/// Note that the Full Serializer public API will *not* throw exceptions with this enabled;
/// errors will still be returned in a fsResult instance.
///
public static bool AllowInternalExceptions = true;
///
/// This string will be used to prefix fields used internally by FullSerializer.
///
public static string InternalFieldPrefix = "$";
}
///
/// Enables some top-level customization of Full Serializer.
///
public class fsConfig {
///
/// The attributes that will force a field or property to be serialized.
///
public Type[] SerializeAttributes = {
#if !NO_UNITY
typeof(UnityEngine.SerializeField),
#endif
typeof(fsPropertyAttribute)
};
///
/// The attributes that will force a field or property to *not* be serialized.
///
public Type[] IgnoreSerializeAttributes = { typeof(NonSerializedAttribute), typeof(fsIgnoreAttribute) };
///
/// The default member serialization.
///
public fsMemberSerialization DefaultMemberSerialization = fsMemberSerialization.Default;
///
/// Convert a C# field/property name into the key used for the JSON object. For example, you could
/// force all JSON names to lowercase with:
///
/// fsConfig.GetJsonNameFromMemberName = (name, info) => name.ToLower();
///
/// This will only be used when the name is not explicitly specified with fsProperty.
///
public Func GetJsonNameFromMemberName = (name, info) => name;
///
/// If false, then *all* property serialization support will be disabled - even properties
/// explicitly annotated with fsProperty or any other opt-in annotation.
///
/// Setting this to false means that SerializeNonAutoProperties and
/// SerializeNonPublicSetProperties will be completely ignored.
///
public bool EnablePropertySerialization = true;
///
/// Should the default serialization behaviour include non-auto properties?
///
public bool SerializeNonAutoProperties = false;
///
/// Should the default serialization behaviour include properties with non-public setters?
///
public bool SerializeNonPublicSetProperties = true;
///
/// If not null, this string format will be used for DateTime instead of the default one.
///
public string CustomDateTimeFormatString = null;
///
/// Int64 and UInt64 will be serialized and deserialized as string for compatibility
///
public bool Serialize64BitIntegerAsString = false;
///
/// Enums are serialized using their names by default. Setting this to true will serialize them as integers instead.
///
public bool SerializeEnumsAsInteger = false;
}
}