support uInt32

This commit is contained in:
nzdev
2020-07-03 16:56:08 +12:00
parent 9b827df11a
commit 40184c0c3c

View File

@@ -10,6 +10,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource
private const char PrefixString = 'S';
private const char PrefixInt32 = 'I';
private const char PrefixUInt16 = 'H';
private const char PrefixUInt32 = 'J';
private const char PrefixLong = 'L';
private const char PrefixFloat = 'F';
private const char PrefixDouble = 'B';
@@ -68,6 +69,8 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource
return PrimitiveSerializer.Int32.ReadFrom(stream);
case PrefixUInt16:
return PrimitiveSerializer.UInt16.ReadFrom(stream);
case PrefixUInt32:
return PrimitiveSerializer.UInt32.ReadFrom(stream);
case PrefixByte:
return PrimitiveSerializer.Byte.ReadFrom(stream);
case PrefixLong:
@@ -129,6 +132,11 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource
PrimitiveSerializer.Char.WriteTo(PrefixDateTime, stream);
PrimitiveSerializer.DateTime.WriteTo(dateValue, stream);
}
else if (value is uint uInt32Value)
{
PrimitiveSerializer.Char.WriteTo(PrefixUInt32, stream);
PrimitiveSerializer.UInt32.WriteTo(uInt32Value, stream);
}
else
throw new NotSupportedException("Value type " + value.GetType().FullName + " cannot be serialized.");
}