void StoreDescriptor(ITypeDescriptor descriptor, AbstractBufferedWriter writer)
{
if (descriptor is ListTypeDescriptor)
{
writer.WriteUInt8((byte)TypeCategory.List);
}
else if (descriptor is DictionaryTypeDescriptor)
{
writer.WriteUInt8((byte)TypeCategory.Dictionary);
}
else if (descriptor is ObjectTypeDescriptor)
{
writer.WriteUInt8((byte)TypeCategory.Class);
}
else if (descriptor is EnumTypeDescriptor)
{
writer.WriteUInt8((byte)TypeCategory.Enum);
}
else
{
throw new ArgumentOutOfRangeException();
}
((IPersistTypeDescriptor)descriptor).Persist(writer, (w, d) =>
{
SerializerTypeInfo result;
if (!_typeOrDescriptor2Info.TryGetValue(d, out result))
if (!_typeOrDescriptor2InfoNew.TryGetValue(d, out result))
throw new BTDBException("Invalid state unknown descriptor " + d.Name);
w.WriteVInt32(result.Id);
});
}