private static TypedSerializationFormatter.TypeBinder CreateBinder()
 {
     TypedSerializationFormatter.TypeBinder result = null;
     try
     {
         int    tickCount              = Environment.TickCount;
         Type[] serializableTypes      = SerializationTypeBinder.GetSerializableTypes();
         Type[] genericTypeDefinitions = SerializationTypeBinder.GetGenericTypeDefinitions(serializableTypes);
         result = new TypedSerializationFormatter.TypeBinder(serializableTypes, SerializationTypeBinder.safeBaseClasses, genericTypeDefinitions, new TypedSerializationFormatter.TypeEncounteredDelegate(TypedSerializationFormatter.WriteTypeEvent), true);
         SerializationTypeBinder.WriteEventLog(EventLogEntryType.Information, "SerializationTypeBinder create TypeBinder succeeded in {0} ms with {1} serializable types and {2} generic types.", new object[]
         {
             Environment.TickCount - tickCount,
             serializableTypes.Length,
             genericTypeDefinitions.Length
         });
     }
     catch (Exception ex)
     {
         SerializationTypeBinder.InitializationException = ex;
         SerializationTypeBinder.WriteEventLog(EventLogEntryType.Error, "SerializationTypeBinder create TypeBinder failed: {0}.", new object[]
         {
             ex.ToString()
         });
     }
     return(result);
 }
Example #2
0
 private static TypedSerializationFormatter.TypeBinder ConstructBinder()
 {
     TypedSerializationFormatter.TypeBinder result = null;
     try
     {
         int    tickCount              = Environment.TickCount;
         Type[] serializableTypes      = DxBinarySerializationUtil.GetSerializableTypes();
         Type[] genericTypeDefinitions = DxBinarySerializationUtil.GetGenericTypeDefinitions(serializableTypes);
         result = new TypedSerializationFormatter.TypeBinder(serializableTypes, DxBinarySerializationUtil.safeBaseClasses, genericTypeDefinitions, new TypedSerializationFormatter.TypeEncounteredDelegate(DxBinarySerializationUtil.WriteTypeEvent), true);
         DxBinarySerializationUtil.LogErr("SerializationTypeBinder create TypeBinder succeeded in {0} ms with {1} serializable types and {2} generic types.", new object[]
         {
             Environment.TickCount - tickCount,
             serializableTypes.Length,
             genericTypeDefinitions.Length
         });
     }
     catch (Exception ex)
     {
         DxBinarySerializationUtil.LogErr("SerializationTypeBinder create TypeBinder failed: {0}.", new object[]
         {
             ex.ToString()
         });
     }
     return(result);
 }