e79aa3c0ed
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
46 lines
1.6 KiB
C#
46 lines
1.6 KiB
C#
//-----------------------------------------------------------------------------
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
//-----------------------------------------------------------------------------
|
|
|
|
namespace System.Activities.DurableInstancing
|
|
{
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.IO.Compression;
|
|
using System.Xml.Linq;
|
|
|
|
sealed class GZipObjectSerializer : DefaultObjectSerializer
|
|
{
|
|
protected override Dictionary<XName, object> DeserializePropertyBag(Stream stream)
|
|
{
|
|
using (GZipStream gzip = new GZipStream(stream, CompressionMode.Decompress, true))
|
|
{
|
|
return base.DeserializePropertyBag(gzip);
|
|
}
|
|
}
|
|
protected override object DeserializeValue(Stream stream)
|
|
{
|
|
using (GZipStream gzip = new GZipStream(stream, CompressionMode.Decompress, true))
|
|
{
|
|
return base.DeserializeValue(gzip);
|
|
}
|
|
}
|
|
|
|
protected override void SerializePropertyBag(Stream stream, Dictionary<XName, object> propertyBag)
|
|
{
|
|
using (GZipStream gzip = new GZipStream(stream, CompressionLevel.Fastest, true))
|
|
{
|
|
base.SerializePropertyBag(gzip, propertyBag);
|
|
}
|
|
}
|
|
|
|
protected override void SerializeValue(Stream stream, object value)
|
|
{
|
|
using (GZipStream gzip = new GZipStream(stream, CompressionLevel.Fastest, true))
|
|
{
|
|
base.SerializeValue(gzip, value);
|
|
}
|
|
}
|
|
}
|
|
}
|