Exemple #1
0
        public CustomTypeCache GetCache()
        {
            var cache = new CustomTypeCache();

            cache.TryRegisterType(typeof(PeerInfo), 201, SerializePeerInfo, DeserializePeerInfo);
            return(cache);
        }
        public virtual CustomTypeCache GetCustomTypeCache()
        {
            var cache = new CustomTypeCache();

            cache.TryRegisterType(typeof (ExcludedActorInfo), ExcludedActorInfo, SerializeExcludedActorInfo, DeserializeExcludedActorInfo);

            return cache;
        }
Exemple #3
0
        public virtual CustomTypeCache GetCustomTypeCache()
        {
            var cache = new CustomTypeCache();

            cache.TryRegisterType(typeof(ExcludedActorInfo), ExcludedActorInfo, SerializeExcludedActorInfo, DeserializeExcludedActorInfo);

            return(cache);
        }
Exemple #4
0
 /// <summary>
 /// Tries to register a custom type for serialisation.
 /// </summary>
 /// <param name="customType">Type of the custom type.</param>
 /// <param name="typeCode">The type code.</param>
 /// <param name="serializeFunction">The serialize function.</param>
 /// <param name="deserializeFunction">The deserialize function.</param>
 /// <returns>
 /// True if the custom type was successfully registered; otherwise false.
 /// False will be returned if either the type or the type code allready is registered.
 /// </returns>
 public static bool TryRegisterCustomType(Type customType, byte typeCode, Func <object, byte[]> serializeFunction, Func <byte[], object> deserializeFunction)
 {
     return(CustomTypeCache.TryRegisterType(customType, typeCode, serializeFunction, deserializeFunction));
 }