Serialization update

pull/1/head
unknown 5 years ago
parent 3134b5a16e
commit 8e59fa2755

@ -14,6 +14,12 @@ namespace ZeroLevel.Services.Serialization
: IBinaryReader
{
private readonly Stream _stream;
private bool _reverseByteOrder = false;
public void ReverseByteOrder(bool use_reverse_byte_order)
{
_reverseByteOrder = use_reverse_byte_order;
}
public MemoryStreamReader(byte[] data)
{
@ -136,6 +142,16 @@ namespace ZeroLevel.Services.Serialization
var readedCount = _stream.Read(buffer, 0, count);
if (count != readedCount)
throw new InvalidOperationException($"The stream returned less data ({count} bytes) than expected ({readedCount} bytes)");
if (_reverseByteOrder)
{
byte b;
for (int i = 0; i < (count >> 1); i++)
{
b = buffer[i];
buffer[i] = buffer[count - i];
buffer[count - i] = b;
}
}
return buffer;
}

@ -5,15 +5,15 @@
<Description>Infrastructure layer library</Description>
<Authors>ogoun</Authors>
<Company>ogoun</Company>
<AssemblyVersion>2.0.2.0</AssemblyVersion>
<PackageReleaseNotes>Fix IExClient contract</PackageReleaseNotes>
<AssemblyVersion>2.0.3.0</AssemblyVersion>
<PackageReleaseNotes>Update serialization</PackageReleaseNotes>
<PackageProjectUrl>https://github.com/ogoun/Zero/wiki</PackageProjectUrl>
<Copyright>Copyright Ogoun 2019</Copyright>
<PackageLicenseUrl>https://opensource.org/licenses/MIT</PackageLicenseUrl>
<PackageIconUrl>https://raw.githubusercontent.com/ogoun/Zero/master/zero.png</PackageIconUrl>
<RepositoryUrl>https://github.com/ogoun/Zero</RepositoryUrl>
<RepositoryType>GitHub</RepositoryType>
<Version>2.0.2</Version>
<Version>2.0.3</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

Loading…
Cancel
Save

Powered by TurnKey Linux.