Update text and binary formatter helpers to be shared (#2035)

This commit is contained in:
James Newton-King 2018-04-16 15:19:34 +12:00 committed by GitHub
parent b7cea8690a
commit 6eac7049ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 32 additions and 19 deletions

View File

@ -1,9 +1,11 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Buffers;
using System.IO;
using BenchmarkDotNet.Attributes;
using Microsoft.AspNetCore.Internal;
using Microsoft.AspNetCore.SignalR.Internal.Formatters;
namespace Microsoft.AspNetCore.SignalR.Microbenchmarks
{

View File

@ -5,6 +5,11 @@
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\src\Common\BinaryMessageFormatter.cs" Link="BinaryMessageFormatter.cs" />
<Compile Include="..\..\src\Common\BinaryMessageParser.cs" Link="BinaryMessageParser.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Http.Connections.Client\Microsoft.AspNetCore.Http.Connections.Client.csproj" />
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Http.Connections\Microsoft.AspNetCore.Http.Connections.csproj" />

View File

@ -4,9 +4,9 @@
using System;
using System.Buffers;
namespace Microsoft.AspNetCore.SignalR.Internal.Formatters
namespace Microsoft.AspNetCore.Internal
{
public static class BinaryMessageFormatter
internal static class BinaryMessageFormatter
{
public static void WriteLengthPrefix(long length, IBufferWriter<byte> output)
{

View File

@ -4,9 +4,9 @@
using System;
using System.Buffers;
namespace Microsoft.AspNetCore.SignalR.Internal.Formatters
namespace Microsoft.AspNetCore.Internal
{
public static class BinaryMessageParser
internal static class BinaryMessageParser
{
private const int MaxLengthPrefixSize = 5;

View File

@ -4,9 +4,9 @@
using System.Buffers;
using System.IO;
namespace Microsoft.AspNetCore.SignalR.Internal.Formatters
namespace Microsoft.AspNetCore.Internal
{
public static class TextMessageFormatter
internal static class TextMessageFormatter
{
// This record separator is supposed to be used only for JSON payloads where 0x1e character
// will not occur (is not a valid character) and therefore it is safe to not escape it

View File

@ -4,9 +4,9 @@
using System;
using System.Buffers;
namespace Microsoft.AspNetCore.SignalR.Internal.Formatters
namespace Microsoft.AspNetCore.Internal
{
public static class TextMessageParser
internal static class TextMessageParser
{
public static bool TryParseMessage(ref ReadOnlySequence<byte> buffer, out ReadOnlySequence<byte> payload)
{

View File

@ -10,6 +10,8 @@
<ItemGroup>
<Compile Include="..\Common\JsonUtils.cs" Link="Internal\JsonUtils.cs" />
<Compile Include="..\Common\MemoryBufferWriter.cs" Link="Internal\MemoryBufferWriter.cs" />
<Compile Include="..\Common\TextMessageFormatter.cs" Link="Internal\TextMessageFormatter.cs" />
<Compile Include="..\Common\TextMessageParser.cs" Link="Internal\TextMessageParser.cs" />
<Compile Include="..\Common\Utf8BufferTextReader.cs" Link="Internal\Utf8BufferTextReader.cs" />
<Compile Include="..\Common\Utf8BufferTextWriter.cs" Link="Internal\Utf8BufferTextWriter.cs" />
</ItemGroup>

View File

@ -6,7 +6,6 @@ using System.Buffers;
using System.IO;
using Microsoft.AspNetCore.Internal;
using Microsoft.AspNetCore.SignalR.Internal;
using Microsoft.AspNetCore.SignalR.Internal.Formatters;
using Newtonsoft.Json;
namespace Microsoft.AspNetCore.SignalR.Protocol

View File

@ -9,6 +9,8 @@
<ItemGroup>
<Compile Include="..\Common\JsonUtils.cs" Link="Internal\JsonUtils.cs" />
<Compile Include="..\Common\TextMessageFormatter.cs" Link="TextMessageFormatter.cs" />
<Compile Include="..\Common\TextMessageParser.cs" Link="TextMessageParser.cs" />
<Compile Include="..\Common\Utf8BufferTextReader.cs" Link="Utf8BufferTextReader.cs" />
<Compile Include="..\Common\Utf8BufferTextWriter.cs" Link="Utf8BufferTextWriter.cs" />
</ItemGroup>

View File

@ -9,7 +9,6 @@ using System.Runtime.ExceptionServices;
using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Internal;
using Microsoft.AspNetCore.SignalR.Internal;
using Microsoft.AspNetCore.SignalR.Internal.Formatters;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

View File

@ -8,6 +8,8 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Common\BinaryMessageFormatter.cs" Link="BinaryMessageFormatter.cs" />
<Compile Include="..\Common\BinaryMessageParser.cs" Link="BinaryMessageParser.cs" />
<Compile Include="..\Common\MemoryBufferWriter.cs" Link="Internal\MemoryBufferWriter.cs" />
</ItemGroup>

View File

@ -12,7 +12,6 @@ using MessagePack;
using MessagePack.Formatters;
using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Internal;
using Microsoft.AspNetCore.SignalR.Internal.Formatters;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.SignalR.Protocol

View File

@ -6,6 +6,8 @@
<ItemGroup>
<Compile Include="..\..\src\Common\MemoryBufferWriter.cs" Link="MemoryBufferWriter.cs" />
<Compile Include="..\..\src\Common\TextMessageFormatter.cs" Link="TextMessageFormatter.cs" />
<Compile Include="..\..\src\Common\TextMessageParser.cs" Link="TextMessageParser.cs" />
</ItemGroup>
<ItemGroup>

View File

@ -12,7 +12,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Internal;
using Microsoft.AspNetCore.SignalR.Internal.Formatters;
using Microsoft.AspNetCore.SignalR.Protocol;
using Newtonsoft.Json;

View File

@ -9,7 +9,6 @@ using System.Linq;
using System.Text;
using Microsoft.AspNetCore.Internal;
using Microsoft.AspNetCore.SignalR.Internal;
using Microsoft.AspNetCore.SignalR.Internal.Formatters;
using Xunit;
namespace Microsoft.AspNetCore.SignalR.Common.Tests.Internal.Formatters

View File

@ -5,7 +5,7 @@ using System;
using System.Buffers;
using System.Collections.Generic;
using System.Text;
using Microsoft.AspNetCore.SignalR.Internal.Formatters;
using Microsoft.AspNetCore.Internal;
using Xunit;
namespace Microsoft.AspNetCore.SignalR.Common.Tests.Internal.Formatters

View File

@ -4,7 +4,7 @@
using System;
using System.IO;
using System.Text;
using Microsoft.AspNetCore.SignalR.Internal.Formatters;
using Microsoft.AspNetCore.Internal;
using Xunit;
namespace Microsoft.AspNetCore.SignalR.Common.Tests.Internal.Formatters

View File

@ -4,7 +4,7 @@
using System;
using System.Buffers;
using System.Text;
using Microsoft.AspNetCore.SignalR.Internal.Formatters;
using Microsoft.AspNetCore.Internal;
using Xunit;
namespace Microsoft.AspNetCore.SignalR.Common.Tests.Internal.Formatters

View File

@ -8,7 +8,6 @@ using System.IO;
using System.Linq;
using System.Text;
using Microsoft.AspNetCore.Internal;
using Microsoft.AspNetCore.SignalR.Internal.Formatters;
using Microsoft.AspNetCore.SignalR.Protocol;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;

View File

@ -8,7 +8,6 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using Microsoft.AspNetCore.Internal;
using Microsoft.AspNetCore.SignalR.Internal.Formatters;
using Xunit;
namespace Microsoft.AspNetCore.SignalR.Common.Tests.Internal.Protocol

View File

@ -4,6 +4,11 @@
<TargetFrameworks>$(StandardTestTfms)</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\src\Common\BinaryMessageFormatter.cs" Link="BinaryMessageFormatter.cs" />
<Compile Include="..\..\src\Common\BinaryMessageParser.cs" Link="BinaryMessageParser.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="..\xunit.runner.json" Link="xunit.runner.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>