internal void InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, SoapAttributeInfo attributeInfo, ObjectWriter objectWriter)
{
InternalST.Soap( this, objectInfoId," Constructor 1 ",obj);
this.context = context;
this.obj = obj;
this.serObjectInfoInit = serObjectInfoInit;
this.parentMemberAttributeInfo = attributeInfo;
this.surrogateSelector = surrogateSelector;
this.converter = converter;
ISurrogateSelector surrogateSelectorTemp;
if (RemotingServices.IsTransparentProxy(obj))
objectType = Converter.typeofMarshalByRefObject;
else
objectType = obj.GetType();
if (objectType.IsArray)
{
arrayElemObjectInfo = Serialize(objectType.GetElementType(), surrogateSelector, context, serObjectInfoInit, converter, null);
typeAttributeInfo = GetTypeAttributeInfo();
isArray = true;
InitNoMembers();
return;
}
InternalST.Soap( this, objectInfoId," Constructor 1 trace 2");
typeAttributeInfo = GetTypeAttributeInfo();
objectWriter.ObjectManager.RegisterObject(obj);
if (surrogateSelector != null && (serializationSurrogate = surrogateSelector.GetSurrogate(objectType, context, out surrogateSelectorTemp)) != null)
{
InternalST.Soap( this, objectInfoId," Constructor 1 trace 3");
si = new SerializationInfo(objectType, converter);
if (!objectType.IsPrimitive)
serializationSurrogate.GetObjectData(obj, si, context);
InitSiWrite(objectWriter);
}
else if (obj is ISerializable)
{
if (!objectType.IsSerializable)
{
throw new SerializationException(String.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_NonSerType"),
objectType.FullName, objectType.Module.Assembly.FullName));
}
si = new SerializationInfo(objectType, converter);
((ISerializable)obj).GetObjectData(si, context);
InternalST.Soap( this, objectInfoId," Constructor 1 trace 4 ISerializable "+objectType);
InitSiWrite(objectWriter);
}
else
{
InternalST.Soap(this, objectInfoId," Constructor 1 trace 5");
InitMemberInfo();
}
}