Skip to content

Commit 253ee56

Browse files
author
Hiram
committed
modify logic
1 parent fb4ce6c commit 253ee56

File tree

190 files changed

+234
-194942
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

190 files changed

+234
-194942
lines changed

src/HiSocket.Message/HiSocket.Message.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@
5858
<Compile Include="ProtobufMsgRegistInfo.cs" />
5959
<Compile Include="ProtobufSerializer.cs" />
6060
</ItemGroup>
61-
<ItemGroup>
62-
<None Include="packages.config" />
63-
</ItemGroup>
6461
<ItemGroup>
6562
<ProjectReference Include="..\HiSocket.Tcp\HiSocket.Tcp.csproj">
6663
<Project>{0b0fe68d-eb3f-42e0-b151-bbe221cfa10c}</Project>
6764
<Name>HiSocket.Tcp</Name>
6865
</ProjectReference>
6966
</ItemGroup>
67+
<ItemGroup>
68+
<None Include="packages.config" />
69+
</ItemGroup>
7070
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
7171
</Project>
Binary file not shown.
Binary file not shown.
Binary file not shown.

src/HiSocket.Tcp/HiSocket.Tcp.csproj

+2-3
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
<Prefer32Bit>false</Prefer32Bit>
3535
</PropertyGroup>
3636
<ItemGroup>
37-
<Reference Include="HiFramework, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
38-
<HintPath>..\packages\HiFramework.1.0.2\lib\net35\HiFramework.dll</HintPath>
37+
<Reference Include="HiFramework, Version=1.0.6.0, Culture=neutral, processorArchitecture=MSIL">
38+
<HintPath>..\packages\HiFramework.1.0.6\lib\net35\HiFramework.dll</HintPath>
3939
</Reference>
4040
<Reference Include="HiFramework.Assert, Version=1.0.3.0, Culture=neutral, processorArchitecture=MSIL">
4141
<HintPath>..\packages\HiFramework.Assert.1.0.3\lib\net35\HiFramework.Assert.dll</HintPath>
@@ -66,6 +66,5 @@
6666
<ItemGroup>
6767
<None Include="packages.config" />
6868
</ItemGroup>
69-
<ItemGroup />
7069
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
7170
</Project>

src/HiSocket.Tcp/PackageBase.cs

+2-4
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ public abstract class PackageBase : IPackage
1919
/// <param name="onUnpacked"></param>
2020
public void Unpack(byte[] source, Action<byte[]> onUnpacked)
2121
{
22-
using (BlockBuffer<byte> buffer = new BlockBuffer<byte>())
22+
using (BlockBuffer<byte> buffer = new BlockBuffer<byte>(source))
2323
{
24-
buffer.Write(source);
2524
Unpack(buffer, onUnpacked);
2625
}
2726
}
@@ -33,9 +32,8 @@ public void Unpack(byte[] source, Action<byte[]> onUnpacked)
3332
/// <param name="onPacked"></param>
3433
public void Pack(byte[] source, Action<byte[]> onPacked)
3534
{
36-
using (BlockBuffer<byte> buffer = new BlockBuffer<byte>())
35+
using (BlockBuffer<byte> buffer = new BlockBuffer<byte>(source))
3736
{
38-
buffer.Write(source);
3937
Pack(buffer, onPacked);
4038
}
4139
}

src/HiSocket.Tcp/TcpConnection.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public TcpConnection(IPackage package)
4242

4343
void OnSocketReceiveHandler(byte[] bytes)
4444
{
45-
_package.Unpack(bytes, x => { ReceiveEvent(x); });
45+
_package.Unpack(bytes, x => { ReceiveEvent(x); });
4646
}
4747

4848
/// <summary>
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
edbeb0602671ff3a488980efe6bd07b63a7a9444
1+
fbf046935c9043d1db5779316966eefab0e33db4

src/HiSocket.Tcp/obj/Debug/HiSocket.Tcp.csproj.FileListAbsolute.txt

-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ D:\MyGit\github\HiSocket\src\HiSocket.Tcp\obj\Debug\HiSocket.Tcp.csproj.CoreComp
1010
D:\MyGit\github\HiSocket\src\HiSocket.Tcp\obj\Debug\HiSocket.Tcp.csproj.CopyComplete
1111
D:\MyGit\github\HiSocket\src\HiSocket.Tcp\obj\Debug\HiSocket.dll
1212
D:\MyGit\github\HiSocket\src\HiSocket.Tcp\obj\Debug\HiSocket.pdb
13-
D:\MyGit\github\HiSocket\src\HiSocket.Tcp\obj\Debug\HiSocket.Tcp.csprojAssemblyReference.cache
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

src/HiSocket.Tcp/packages.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="HiFramework" version="1.0.2" targetFramework="net35" />
3+
<package id="HiFramework" version="1.0.6" targetFramework="net35" />
44
<package id="HiFramework.Assert" version="1.0.3" targetFramework="net35" />
55
<package id="HiFramework.Core" version="1.0.0" targetFramework="net35" />
66
</packages>

src/HiSocket.Test/HiSocket.Test.csproj

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.props')" />
3+
<Import Project="..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.props')" />
44
<PropertyGroup>
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
66
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -39,20 +39,20 @@
3939
<WarningLevel>4</WarningLevel>
4040
</PropertyGroup>
4141
<ItemGroup>
42-
<Reference Include="HiFramework, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
43-
<HintPath>..\packages\HiFramework.1.0.2\lib\net35\HiFramework.dll</HintPath>
42+
<Reference Include="HiFramework, Version=1.0.6.0, Culture=neutral, processorArchitecture=MSIL">
43+
<HintPath>..\packages\HiFramework.1.0.6\lib\net35\HiFramework.dll</HintPath>
4444
</Reference>
45-
<Reference Include="HiFramework.Assert, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL">
46-
<HintPath>..\packages\HiFramework.Assert.1.0.2\lib\net35\HiFramework.Assert.dll</HintPath>
45+
<Reference Include="HiFramework.Assert, Version=1.0.3.0, Culture=neutral, processorArchitecture=MSIL">
46+
<HintPath>..\packages\HiFramework.Assert.1.0.3\lib\net35\HiFramework.Assert.dll</HintPath>
4747
</Reference>
4848
<Reference Include="HiFramework.Core, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
4949
<HintPath>..\packages\HiFramework.Core.1.0.0\lib\net35\HiFramework.Core.dll</HintPath>
5050
</Reference>
5151
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
52-
<HintPath>..\packages\MSTest.TestFramework.1.1.18\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
52+
<HintPath>..\packages\MSTest.TestFramework.1.4.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
5353
</Reference>
5454
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
55-
<HintPath>..\packages\MSTest.TestFramework.1.1.18\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
55+
<HintPath>..\packages\MSTest.TestFramework.1.4.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
5656
</Reference>
5757
<Reference Include="System" />
5858
<Reference Include="System.Core" />
@@ -84,8 +84,8 @@
8484
<PropertyGroup>
8585
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
8686
</PropertyGroup>
87-
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.props'))" />
88-
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.targets'))" />
87+
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.props'))" />
88+
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.targets'))" />
8989
</Target>
90-
<Import Project="..\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.targets')" />
90+
<Import Project="..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.targets')" />
9191
</Project>

src/HiSocket.Test/Support/Package.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ protected override void Pack(BlockBuffer<byte> bytes, Action<byte[]> onPacked)
1010
{
1111
int length = bytes.WritePosition;
1212
var header = BitConverter.GetBytes(length);
13-
var newBytes = new byte[length + header.Length];
14-
Buffer.BlockCopy(header, 0, newBytes, 0, header.Length);
15-
Buffer.BlockCopy(bytes.Buffer, 0, newBytes, header.Length, length);
16-
onPacked(newBytes);
13+
var newBytes = new BlockBuffer<byte>(length + header.Length);
14+
newBytes.Write(header);
15+
newBytes.Write(bytes.Buffer);
16+
onPacked(newBytes.Buffer);
1717
}
1818

1919
protected override void Unpack(BlockBuffer<byte> bytes, Action<byte[]> onUnpacked)
512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)