internal static void TypeFromInfo(BinaryTypeEnum binaryTypeEnum,
Object typeInformation,
ObjectReader objectReader,
BinaryAssemblyInfo assemblyInfo,
out InternalPrimitiveTypeE primitiveTypeEnum,
out String typeString,
out Type type,
out bool isVariant)
{
SerTrace.Log( "BinaryConverter", "TypeFromInfo Entry ",((Enum)binaryTypeEnum).ToString());
isVariant = false;
primitiveTypeEnum = InternalPrimitiveTypeE.Invalid;
typeString = null;
type = null;
switch (binaryTypeEnum)
{
case BinaryTypeEnum.Primitive:
primitiveTypeEnum = (InternalPrimitiveTypeE)typeInformation;
typeString = Converter.ToComType(primitiveTypeEnum);
type = Converter.ToType(primitiveTypeEnum);
break;
case BinaryTypeEnum.String:
//typeString = "System.String";
type = Converter.typeofString;
break;
case BinaryTypeEnum.Object:
//typeString = "System.Object";
type = Converter.typeofObject;
isVariant = true;
break;
case BinaryTypeEnum.ObjectArray:
//typeString = "System.Object[]";
type = Converter.typeofObjectArray;
break;
case BinaryTypeEnum.StringArray:
//typeString = "System.String[]";
type = Converter.typeofStringArray;
break;
case BinaryTypeEnum.PrimitiveArray:
primitiveTypeEnum = (InternalPrimitiveTypeE)typeInformation;
type = Converter.ToArrayType(primitiveTypeEnum);
break;
case BinaryTypeEnum.ObjectUser:
case BinaryTypeEnum.ObjectUrt:
if (typeInformation != null)
{
typeString = typeInformation.ToString();
type = objectReader.GetType(assemblyInfo, typeString);
// Temporary for backward compatibility
if (type == Converter.typeofObject)
isVariant = true;
}
break;
default:
throw new SerializationException(String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Serialization_TypeRead"),((Enum)binaryTypeEnum).ToString()));
}
#if _DEBUG
SerTrace.Log( "BinaryConverter", "TypeFromInfo Exit "
,((Enum)primitiveTypeEnum).ToString(),",typeString ",Util.PString(typeString)
,", type ",Util.PString(type),", isVariant ",isVariant);
#endif
}