private object CustomDeserialize(BinaryReader reader, Type graphType) {
var ctor = GetSpecialConstructor(graphType);
if (ctor == null)
throw new NotSupportedException(String.Format("The type '{0}' has not the special serialization constructor",
graphType));
var values = new Dictionary<string, object>();
ReadValues(reader, Encoding, values);
var info = new SerializationInfo(graphType, new FormatterConverter());
foreach (var value in values) {
var key = value.Key;
var objValue = value.Value;
Type valueType = typeof (object);
if (objValue != null)
valueType = objValue.GetType();
info.AddValue(key, objValue, valueType);
}
var context = new StreamingContext();
return ctor.Invoke(new object[] {info, context});
}