internal static BinaryTypeEnum GetBinaryTypeInfo(Type type, WriteObjectInfo objectInfo, string typeName, ObjectWriter objectWriter, out object typeInformation, out int assemId)
{
BinaryTypeEnum primitive;
assemId = 0;
typeInformation = null;
if (object.ReferenceEquals(type, Converter.typeofString))
{
return BinaryTypeEnum.String;
}
if (((objectInfo == null) || ((objectInfo != null) && !objectInfo.isSi)) && object.ReferenceEquals(type, Converter.typeofObject))
{
return BinaryTypeEnum.Object;
}
if (object.ReferenceEquals(type, Converter.typeofStringArray))
{
return BinaryTypeEnum.StringArray;
}
if (object.ReferenceEquals(type, Converter.typeofObjectArray))
{
return BinaryTypeEnum.ObjectArray;
}
if (Converter.IsPrimitiveArray(type, out typeInformation))
{
return BinaryTypeEnum.PrimitiveArray;
}
InternalPrimitiveTypeE ee = objectWriter.ToCode(type);
switch (ee)
{
case InternalPrimitiveTypeE.Invalid:
{
string fullName = null;
if (objectInfo == null)
{
fullName = type.Assembly.FullName;
typeInformation = type.FullName;
}
else
{
fullName = objectInfo.GetAssemblyString();
typeInformation = objectInfo.GetTypeFullName();
}
if (fullName.Equals(Converter.urtAssemblyString))
{
primitive = BinaryTypeEnum.ObjectUrt;
assemId = 0;
return primitive;
}
primitive = BinaryTypeEnum.ObjectUser;
assemId = (int) objectInfo.assemId;
if (assemId == 0)
{
throw new SerializationException(Environment.GetResourceString("Serialization_AssemblyId", new object[] { typeInformation }));
}
return primitive;
}
}
primitive = BinaryTypeEnum.Primitive;
typeInformation = ee;
return primitive;
}