Fixed C# SizedByteArray copying leading bytes of ByteBuffer.

Tested: on Windows.

Change-Id: I946dacf799eae835ec041ea759622f74b0384937
parent 1263e978
......@@ -359,9 +359,9 @@ namespace FlatBuffers
// Utility function for copying a byte array that starts at 0.
public byte[] SizedByteArray()
{
var newArray = new byte[_bb.Data.Length];
var newArray = new byte[_bb.Data.Length - _bb.position()];
Buffer.BlockCopy(_bb.Data, _bb.position(), newArray, 0,
_bb.Data.Length);
_bb.Data.Length - _bb.position());
return newArray;
}
......
......@@ -41,9 +41,6 @@
<Compile Include="Struct.cs" />
<Compile Include="Table.cs" />
</ItemGroup>
<ItemGroup>
<None Include="FlatBuffers.1.0.0.nuspec" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
......
......@@ -38,6 +38,21 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\net\FlatBuffers\ByteBuffer.cs">
<Link>FlatBuffers\ByteBuffer.cs</Link>
</Compile>
<Compile Include="..\..\net\FlatBuffers\FlatBufferBuilder.cs">
<Link>FlatBuffers\FlatBufferBuilder.cs</Link>
</Compile>
<Compile Include="..\..\net\FlatBuffers\FlatBufferConstants.cs">
<Link>FlatBuffers\FlatBufferConstants.cs</Link>
</Compile>
<Compile Include="..\..\net\FlatBuffers\Struct.cs">
<Link>FlatBuffers\Struct.cs</Link>
</Compile>
<Compile Include="..\..\net\FlatBuffers\Table.cs">
<Link>FlatBuffers\Table.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\Any.cs">
<Link>MyGame\Example\Any.cs</Link>
</Compile>
......@@ -47,6 +62,9 @@
<Compile Include="..\MyGame\Example\Monster.cs">
<Link>MyGame\Example\Monster.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\Stat.cs">
<Link>MyGame\Example\Stat.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\Test.cs">
<Link>MyGame\Example\Test.cs</Link>
</Compile>
......@@ -55,17 +73,10 @@
</Compile>
<Compile Include="Assert.cs" />
<Compile Include="ByteBufferTests.cs" />
<Compile Include="MyGame\Example\Stat.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="FlatBuffersExampleTests.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\net\FlatBuffers\FlatBuffers.csproj">
<Project>{28C00774-1E73-4A75-AD8F-844CD21A064D}</Project>
<Name>FlatBuffers</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="..\monsterdata_test.mon">
<Link>Resources\monsterdata_test.mon</Link>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment