Exemplo n.º 1
0
        /// <summary>
        /// Adds a Serializer that can de/serialize objects of the specialized type to the Serializers
        /// </summary>
        /// <param name="type">Type that can be de/serialized</param>
        /// <param name="packetSerializer">The Serializer that can de/serialize objects of type</param>
        public static void AddSerializer(Type type, ASerializer packetSerializer)
        {
            if (CanSerialize(type))
            {
                return;
            }
            object key = BaseSerializer.GetKey(type);

            KeyTypeCache.Add(key, type);
            TypeKeyCache.Add(type, key);
            Serializers.Add(type, packetSerializer);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds a Serializer that can de/serialize objects of the specialized type to the Serializers
        /// </summary>
        /// <param name="type">Type that can be de/serialized</param>
        /// <param name="packetSerializer">The Serializer that can de/serialize objects of type</param>
        public void AddSerializer(Type type, ASerializer packetSerializer)
        {
            if (CanSerialize(type))
            {
                return;
            }

            if (Serializers.ContainsKey(type))
            {
                Console.WriteLine("");
            }

            object key = BaseSerializer.GetKey(type);

            KeyTypeCache.Add(key, type);
            TypeKeyCache.Add(type, key);
            Serializers.Add(type, packetSerializer);
        }