using FishNet.Documenting; using FishNet.Utility; using System; using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo(UtilityConstants.GENERATED_ASSEMBLY_NAME)] namespace FishNet.Serializing { /// /// Used for write references to generic types. /// /// [APIExclude] public static class GenericWriter { public static Action Write { get; private set; } public static Action WriteAutoPack { get; private set; } /// /// True if this type has a custom writer. /// private static bool _hasCustomSerializer; public static void SetWriteUnpacked(Action value) { /* If a custom serializer has already been set then exit method * to not overwrite serializer. */ if (_hasCustomSerializer) return; //Set has custom serializer if value being used is not a generated method. _hasCustomSerializer = !(value.Method.Name.StartsWith(UtilityConstants.GENERATED_WRITER_PREFIX)); Write = value; } public static void SetWriteAutoPacked(Action value) { WriteAutoPack = value; } } }