Skip to content

Commit

Permalink
modify logic
Browse files Browse the repository at this point in the history
  • Loading branch information
hiram3512 committed Jul 28, 2019
1 parent fb4ce6c commit 253ee56
Show file tree
Hide file tree
Showing 190 changed files with 234 additions and 194,942 deletions.
6 changes: 3 additions & 3 deletions src/HiSocket.Message/HiSocket.Message.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@
<Compile Include="ProtobufMsgRegistInfo.cs" />
<Compile Include="ProtobufSerializer.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\HiSocket.Tcp\HiSocket.Tcp.csproj">
<Project>{0b0fe68d-eb3f-42e0-b151-bbe221cfa10c}</Project>
<Name>HiSocket.Tcp</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Binary file not shown.
Binary file modified src/HiSocket.Message/obj/Debug/HiSocket.Message.dll
Binary file not shown.
Binary file modified src/HiSocket.Message/obj/Debug/HiSocket.Message.pdb
Binary file not shown.
5 changes: 2 additions & 3 deletions src/HiSocket.Tcp/HiSocket.Tcp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="HiFramework, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HiFramework.1.0.2\lib\net35\HiFramework.dll</HintPath>
<Reference Include="HiFramework, Version=1.0.6.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HiFramework.1.0.6\lib\net35\HiFramework.dll</HintPath>
</Reference>
<Reference Include="HiFramework.Assert, Version=1.0.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HiFramework.Assert.1.0.3\lib\net35\HiFramework.Assert.dll</HintPath>
Expand Down Expand Up @@ -66,6 +66,5 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
6 changes: 2 additions & 4 deletions src/HiSocket.Tcp/PackageBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ public abstract class PackageBase : IPackage
/// <param name="onUnpacked"></param>
public void Unpack(byte[] source, Action<byte[]> onUnpacked)
{
using (BlockBuffer<byte> buffer = new BlockBuffer<byte>())
using (BlockBuffer<byte> buffer = new BlockBuffer<byte>(source))
{
buffer.Write(source);
Unpack(buffer, onUnpacked);
}
}
Expand All @@ -33,9 +32,8 @@ public void Unpack(byte[] source, Action<byte[]> onUnpacked)
/// <param name="onPacked"></param>
public void Pack(byte[] source, Action<byte[]> onPacked)
{
using (BlockBuffer<byte> buffer = new BlockBuffer<byte>())
using (BlockBuffer<byte> buffer = new BlockBuffer<byte>(source))
{
buffer.Write(source);
Pack(buffer, onPacked);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/HiSocket.Tcp/TcpConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public TcpConnection(IPackage package)

void OnSocketReceiveHandler(byte[] bytes)
{
_package.Unpack(bytes, x => { ReceiveEvent(x); });
_package.Unpack(bytes, x => { ReceiveEvent(x); });
}

/// <summary>
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
edbeb0602671ff3a488980efe6bd07b63a7a9444
fbf046935c9043d1db5779316966eefab0e33db4
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ D:\MyGit\github\HiSocket\src\HiSocket.Tcp\obj\Debug\HiSocket.Tcp.csproj.CoreComp
D:\MyGit\github\HiSocket\src\HiSocket.Tcp\obj\Debug\HiSocket.Tcp.csproj.CopyComplete
D:\MyGit\github\HiSocket\src\HiSocket.Tcp\obj\Debug\HiSocket.dll
D:\MyGit\github\HiSocket\src\HiSocket.Tcp\obj\Debug\HiSocket.pdb
D:\MyGit\github\HiSocket\src\HiSocket.Tcp\obj\Debug\HiSocket.Tcp.csprojAssemblyReference.cache
Binary file modified src/HiSocket.Tcp/obj/Debug/HiSocket.dll
Binary file not shown.
Binary file modified src/HiSocket.Tcp/obj/Debug/HiSocket.pdb
Binary file not shown.
2 changes: 1 addition & 1 deletion src/HiSocket.Tcp/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="HiFramework" version="1.0.2" targetFramework="net35" />
<package id="HiFramework" version="1.0.6" targetFramework="net35" />
<package id="HiFramework.Assert" version="1.0.3" targetFramework="net35" />
<package id="HiFramework.Core" version="1.0.0" targetFramework="net35" />
</packages>
20 changes: 10 additions & 10 deletions src/HiSocket.Test/HiSocket.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<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')" />
<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')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand Down Expand Up @@ -39,20 +39,20 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="HiFramework, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HiFramework.1.0.2\lib\net35\HiFramework.dll</HintPath>
<Reference Include="HiFramework, Version=1.0.6.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HiFramework.1.0.6\lib\net35\HiFramework.dll</HintPath>
</Reference>
<Reference Include="HiFramework.Assert, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HiFramework.Assert.1.0.2\lib\net35\HiFramework.Assert.dll</HintPath>
<Reference Include="HiFramework.Assert, Version=1.0.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HiFramework.Assert.1.0.3\lib\net35\HiFramework.Assert.dll</HintPath>
</Reference>
<Reference Include="HiFramework.Core, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HiFramework.Core.1.0.0\lib\net35\HiFramework.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.1.18\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
<HintPath>..\packages\MSTest.TestFramework.1.4.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.1.18\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
<HintPath>..\packages\MSTest.TestFramework.1.4.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down Expand Up @@ -84,8 +84,8 @@
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<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'))" />
<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'))" />
<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'))" />
<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'))" />
</Target>
<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')" />
<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')" />
</Project>
8 changes: 4 additions & 4 deletions src/HiSocket.Test/Support/Package.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ protected override void Pack(BlockBuffer<byte> bytes, Action<byte[]> onPacked)
{
int length = bytes.WritePosition;
var header = BitConverter.GetBytes(length);
var newBytes = new byte[length + header.Length];
Buffer.BlockCopy(header, 0, newBytes, 0, header.Length);
Buffer.BlockCopy(bytes.Buffer, 0, newBytes, header.Length, length);
onPacked(newBytes);
var newBytes = new BlockBuffer<byte>(length + header.Length);
newBytes.Write(header);
newBytes.Write(bytes.Buffer);
onPacked(newBytes.Buffer);
}

protected override void Unpack(BlockBuffer<byte> bytes, Action<byte[]> onUnpacked)
Expand Down
Binary file modified src/HiSocket.Test/bin/Debug/HiFramework.Assert.dll
Binary file not shown.
Binary file modified src/HiSocket.Test/bin/Debug/HiFramework.dll
Binary file not shown.
Binary file modified src/HiSocket.Test/bin/Debug/HiSocket.Message.dll
Binary file not shown.
Binary file modified src/HiSocket.Test/bin/Debug/HiSocket.Message.pdb
Binary file not shown.
Binary file modified src/HiSocket.Test/bin/Debug/HiSocket.Test.dll
Binary file not shown.
Binary file modified src/HiSocket.Test/bin/Debug/HiSocket.Test.pdb
Binary file not shown.
Binary file modified src/HiSocket.Test/bin/Debug/HiSocket.dll
Binary file not shown.
Binary file modified src/HiSocket.Test/bin/Debug/HiSocket.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 253ee56

Please sign in to comment.