forked from BigfootDev/flatbuffers
Target .NET Standard 2.1, .NET 6, .NET 8 only (#8184)
* Target .NET Standard 2.1, .NET 6, .NET 8 only * Remove mono usage * Fix bat name ref * Up deps * Up deps * Reinstate build-windows * Fix name --------- Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
40
.github/workflows/build.yml
vendored
40
.github/workflows/build.yml
vendored
@@ -106,7 +106,7 @@ jobs:
|
||||
exclude:
|
||||
# Clang++15 10.3.0 stdlibc++ doesn't fully support std 23
|
||||
- cxx: clang++-15
|
||||
std: 23
|
||||
std: 23
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
@@ -186,34 +186,6 @@ jobs:
|
||||
shell: bash
|
||||
run: echo "hashes=$(sha256sum Windows.flatc.binary.zip | base64 -w0)" >> $GITHUB_OUTPUT
|
||||
|
||||
build-windows-2017:
|
||||
name: Build Windows 2017
|
||||
runs-on: windows-2019
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v1.1
|
||||
- name: cmake
|
||||
run: cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=Release -DFLATBUFFERS_STRICT_MODE=ON .
|
||||
- name: build tool version 15 (VS 2017)
|
||||
run: msbuild.exe FlatBuffers.sln /p:Configuration=Release /p:Platform=x64 /p:VisualStudioVersion=15.0
|
||||
- name: test
|
||||
run: Release\flattests.exe
|
||||
|
||||
build-windows-2015:
|
||||
name: Build Windows 2015
|
||||
runs-on: windows-2019
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v1.1
|
||||
- name: cmake
|
||||
run: cmake -G "Visual Studio 14 2015" -A x64 -DCMAKE_BUILD_TYPE=Release -DFLATBUFFERS_STRICT_MODE=ON .
|
||||
- name: build tool version 14 (VS 2015)
|
||||
run: msbuild.exe FlatBuffers.sln /p:Configuration=Release /p:Platform=x64 /p:VisualStudioVersion=14.0
|
||||
- name: test
|
||||
run: Release\flattests.exe
|
||||
|
||||
build-dotnet-windows:
|
||||
name: Build .NET Windows
|
||||
runs-on: windows-2022-64core
|
||||
@@ -230,17 +202,17 @@ jobs:
|
||||
- name: Setup .NET Core SDK
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: '3.1.x'
|
||||
dotnet-version: '8.0.x'
|
||||
- name: Build
|
||||
run: |
|
||||
cd tests\FlatBuffers.Test
|
||||
dotnet new sln --force --name FlatBuffers.Core.Test
|
||||
dotnet sln FlatBuffers.Core.Test.sln add FlatBuffers.Core.Test.csproj
|
||||
dotnet build -c Release ${{matrix.configuration}} -o out FlatBuffers.Core.Test.sln
|
||||
dotnet new sln --force --name FlatBuffers.Test
|
||||
dotnet sln FlatBuffers.Test.sln add FlatBuffers.Test.csproj
|
||||
dotnet build -c Release ${{matrix.configuration}} -o out FlatBuffers.Test.sln
|
||||
- name: Run
|
||||
run: |
|
||||
cd tests\FlatBuffers.Test
|
||||
out\FlatBuffers.Core.Test.exe
|
||||
out\FlatBuffers.Test.exe
|
||||
|
||||
build-mac-intel:
|
||||
permissions:
|
||||
|
||||
3
.github/workflows/release.yml
vendored
3
.github/workflows/release.yml
vendored
@@ -60,8 +60,7 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: '6.0.x'
|
||||
|
||||
dotnet-version: '8.0.x'
|
||||
- name: Build
|
||||
run: |
|
||||
dotnet build Google.FlatBuffers.csproj -c Release
|
||||
|
||||
@@ -24,17 +24,14 @@ FlatBuffers).
|
||||
## Building the FlatBuffers C# library
|
||||
|
||||
The `FlatBuffers.csproj` project contains multitargeting for .NET Standard 2.1,
|
||||
.NET Standard 2.0, and .NET Framework 4.6 (Unity 2017). Support for .NET
|
||||
Framework 3.5 (Unity 5) is provided by the `FlatBuffers.net35.csproj` project.
|
||||
In most cases (including Unity 2018 and newer), .NET Standard 2.0 is
|
||||
recommended.
|
||||
.NET 6 and .NET 8.
|
||||
|
||||
You can build for a specific framework target when using the cross-platform
|
||||
[.NET Core SDK](https://dotnet.microsoft.com/download) by adding the `-f`
|
||||
command line option:
|
||||
|
||||
~~~{.sh}
|
||||
dotnet build -f netstandard2.0 "FlatBuffers.csproj"
|
||||
dotnet build -f netstandard2.1 "FlatBuffers.csproj"
|
||||
~~~
|
||||
|
||||
The `FlatBuffers.csproj` project also provides support for defining various
|
||||
@@ -142,10 +139,10 @@ To use it:
|
||||
`ByKey` only works if the vector has been sorted, it will
|
||||
likely not find elements if it hasn't been sorted.
|
||||
|
||||
## Buffer verification
|
||||
## Buffer verification
|
||||
|
||||
As mentioned in [C++ Usage](@ref flatbuffers_guide_use_cpp) buffer
|
||||
accessor functions do not verify buffer offsets at run-time.
|
||||
accessor functions do not verify buffer offsets at run-time.
|
||||
If it is necessary, you can optionally use a buffer verifier before you
|
||||
access the data. This verifier will check all offsets, all sizes of
|
||||
fields, and null termination of strings to ensure that when a buffer
|
||||
@@ -158,17 +155,17 @@ e.g. `Monster.VerifyMonster`. This can be called as shown:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
if `ok` is true, the buffer is safe to read.
|
||||
|
||||
For a more detailed control of verification `MonsterVerify.Verify`
|
||||
for `Monster` type can be used:
|
||||
For a more detailed control of verification `MonsterVerify.Verify`
|
||||
for `Monster` type can be used:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cs}
|
||||
# Sequence of calls
|
||||
FlatBuffers.Verifier verifier = new FlatBuffers.Verifier(buf);
|
||||
var ok = verifier.VerifyBuffer("MONS", false, MonsterVerify.Verify);
|
||||
|
||||
# Or single line call
|
||||
|
||||
# Or single line call
|
||||
var ok = new FlatBuffers.Verifier(bb).setStringCheck(true).\
|
||||
VerifyBuffer("MONS", false, MonsterVerify.Verify);
|
||||
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
if `ok` is true, the buffer is safe to read.
|
||||
|
||||
@@ -181,7 +178,7 @@ Verifier supports options that can be set using appropriate fluent methods:
|
||||
* SetMaxTables - total amount of tables the verifier may encounter. Default: 64
|
||||
* SetAlignmentCheck - check content alignment. Default: True
|
||||
* SetStringCheck - check if strings contain termination '0' character. Default: true
|
||||
|
||||
|
||||
|
||||
## Text parsing
|
||||
|
||||
|
||||
@@ -43,11 +43,11 @@ using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1)
|
||||
#if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
|
||||
using System.Buffers.Binary;
|
||||
#endif
|
||||
|
||||
#if ENABLE_SPAN_T && !UNSAFE_BYTEBUFFER && !NETSTANDARD2_1
|
||||
#if ENABLE_SPAN_T && !UNSAFE_BYTEBUFFER
|
||||
#warning ENABLE_SPAN_T requires UNSAFE_BYTEBUFFER to also be defined
|
||||
#endif
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Google.FlatBuffers
|
||||
{
|
||||
public abstract class ByteBufferAllocator
|
||||
{
|
||||
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1)
|
||||
#if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
|
||||
public abstract Span<byte> Span { get; }
|
||||
public abstract ReadOnlySpan<byte> ReadOnlySpan { get; }
|
||||
public abstract Memory<byte> Memory { get; }
|
||||
@@ -103,7 +103,7 @@ namespace Google.FlatBuffers
|
||||
InitBuffer();
|
||||
}
|
||||
|
||||
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1)
|
||||
#if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
|
||||
public override Span<byte> Span => _buffer;
|
||||
public override ReadOnlySpan<byte> ReadOnlySpan => _buffer;
|
||||
public override Memory<byte> Memory => _buffer;
|
||||
@@ -237,7 +237,7 @@ namespace Google.FlatBuffers
|
||||
return SizeOf<T>() * x.Count;
|
||||
}
|
||||
|
||||
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1)
|
||||
#if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
|
||||
public static int ArraySize<T>(Span<T> x)
|
||||
{
|
||||
return SizeOf<T>() * x.Length;
|
||||
@@ -246,7 +246,7 @@ namespace Google.FlatBuffers
|
||||
|
||||
// Get a portion of the buffer casted into an array of type T, given
|
||||
// the buffer position and length.
|
||||
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1)
|
||||
#if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
|
||||
public T[] ToArray<T>(int pos, int len)
|
||||
where T : struct
|
||||
{
|
||||
@@ -274,7 +274,7 @@ namespace Google.FlatBuffers
|
||||
return ToArray<byte>(0, Length);
|
||||
}
|
||||
|
||||
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1)
|
||||
#if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
|
||||
public ReadOnlyMemory<byte> ToReadOnlyMemory(int pos, int len)
|
||||
{
|
||||
return _buffer.ReadOnlyMemory.Slice(pos, len);
|
||||
@@ -337,7 +337,7 @@ namespace Google.FlatBuffers
|
||||
((input & 0xFF00000000000000UL) >> 56));
|
||||
}
|
||||
|
||||
#if !UNSAFE_BYTEBUFFER && (!ENABLE_SPAN_T || !NETSTANDARD2_1)
|
||||
#if !UNSAFE_BYTEBUFFER && !ENABLE_SPAN_T
|
||||
// Helper functions for the safe (but slower) version.
|
||||
protected void WriteLittleEndian(int offset, int count, ulong data)
|
||||
{
|
||||
@@ -377,7 +377,7 @@ namespace Google.FlatBuffers
|
||||
}
|
||||
return r;
|
||||
}
|
||||
#elif ENABLE_SPAN_T && NETSTANDARD2_1
|
||||
#elif ENABLE_SPAN_T
|
||||
protected void WriteLittleEndian(int offset, int count, ulong data)
|
||||
{
|
||||
if (BitConverter.IsLittleEndian)
|
||||
@@ -427,7 +427,7 @@ namespace Google.FlatBuffers
|
||||
#endif
|
||||
}
|
||||
|
||||
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1)
|
||||
#if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
|
||||
|
||||
public void PutSbyte(int offset, sbyte value)
|
||||
{
|
||||
@@ -487,7 +487,7 @@ namespace Google.FlatBuffers
|
||||
}
|
||||
}
|
||||
}
|
||||
#elif ENABLE_SPAN_T && NETSTANDARD2_1
|
||||
#elif ENABLE_SPAN_T
|
||||
public void PutStringUTF8(int offset, string value)
|
||||
{
|
||||
AssertOffsetAndLength(offset, value.Length);
|
||||
@@ -652,7 +652,7 @@ namespace Google.FlatBuffers
|
||||
// that contains it.
|
||||
ConversionUnion union;
|
||||
union.intValue = 0;
|
||||
union.floatValue = value;
|
||||
union.floatValue = value;
|
||||
WriteLittleEndian(offset, sizeof(float), (ulong)union.intValue);
|
||||
}
|
||||
|
||||
@@ -664,7 +664,7 @@ namespace Google.FlatBuffers
|
||||
|
||||
#endif // UNSAFE_BYTEBUFFER
|
||||
|
||||
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1)
|
||||
#if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
|
||||
public sbyte GetSbyte(int index)
|
||||
{
|
||||
AssertOffsetAndLength(index, sizeof(sbyte));
|
||||
@@ -698,7 +698,7 @@ namespace Google.FlatBuffers
|
||||
return Encoding.UTF8.GetString(buffer, len);
|
||||
}
|
||||
}
|
||||
#elif ENABLE_SPAN_T && NETSTANDARD2_1
|
||||
#elif ENABLE_SPAN_T
|
||||
public string GetStringUTF8(int startPos, int len)
|
||||
{
|
||||
return Encoding.UTF8.GetString(_buffer.Span.Slice(startPos, len));
|
||||
@@ -765,7 +765,7 @@ namespace Google.FlatBuffers
|
||||
#if ENABLE_SPAN_T // && UNSAFE_BYTEBUFFER
|
||||
ReadOnlySpan<byte> span = _buffer.ReadOnlySpan.Slice(offset);
|
||||
return BinaryPrimitives.ReadUInt64LittleEndian(span);
|
||||
#else
|
||||
#else
|
||||
fixed (byte* ptr = _buffer.Buffer)
|
||||
{
|
||||
return BitConverter.IsLittleEndian
|
||||
@@ -885,16 +885,16 @@ namespace Google.FlatBuffers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copies an array segment of type T into this buffer, ending at the
|
||||
/// given offset into this buffer. The starting offset is calculated
|
||||
/// Copies an array segment of type T into this buffer, ending at the
|
||||
/// given offset into this buffer. The starting offset is calculated
|
||||
/// based on the count of the array segment and is the value returned.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the input data (must be a struct)
|
||||
/// </typeparam>
|
||||
/// <param name="offset">The offset into this buffer where the copy
|
||||
/// <param name="offset">The offset into this buffer where the copy
|
||||
/// will end</param>
|
||||
/// <param name="x">The array segment to copy data from</param>
|
||||
/// <returns>The 'start' location of this buffer now, after the copy
|
||||
/// <returns>The 'start' location of this buffer now, after the copy
|
||||
/// completed</returns>
|
||||
public int Put<T>(int offset, ArraySegment<T> x)
|
||||
where T : struct
|
||||
@@ -921,7 +921,7 @@ namespace Google.FlatBuffers
|
||||
offset -= numBytes;
|
||||
AssertOffsetAndLength(offset, numBytes);
|
||||
// if we are LE, just do a block copy
|
||||
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1)
|
||||
#if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
|
||||
MemoryMarshal.Cast<T, byte>(x).CopyTo(_buffer.Span.Slice(offset, numBytes));
|
||||
#else
|
||||
var srcOffset = ByteBuffer.SizeOf<T>() * x.Offset;
|
||||
@@ -942,17 +942,17 @@ namespace Google.FlatBuffers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copies an array segment of type T into this buffer, ending at the
|
||||
/// given offset into this buffer. The starting offset is calculated
|
||||
/// Copies an array segment of type T into this buffer, ending at the
|
||||
/// given offset into this buffer. The starting offset is calculated
|
||||
/// based on the count of the array segment and is the value returned.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the input data (must be a struct)
|
||||
/// </typeparam>
|
||||
/// <param name="offset">The offset into this buffer where the copy
|
||||
/// <param name="offset">The offset into this buffer where the copy
|
||||
/// will end</param>
|
||||
/// <param name="ptr">The pointer to copy data from</param>
|
||||
/// <param name="sizeInBytes">The number of bytes to copy</param>
|
||||
/// <returns>The 'start' location of this buffer now, after the copy
|
||||
/// <returns>The 'start' location of this buffer now, after the copy
|
||||
/// completed</returns>
|
||||
public int Put<T>(int offset, IntPtr ptr, int sizeInBytes)
|
||||
where T : struct
|
||||
@@ -980,7 +980,7 @@ namespace Google.FlatBuffers
|
||||
// if we are LE, just do a block copy
|
||||
#if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
|
||||
unsafe
|
||||
{
|
||||
{
|
||||
var span = new Span<byte>(ptr.ToPointer(), sizeInBytes);
|
||||
span.CopyTo(_buffer.Span.Slice(offset, sizeInBytes));
|
||||
}
|
||||
@@ -1001,7 +1001,7 @@ namespace Google.FlatBuffers
|
||||
return offset;
|
||||
}
|
||||
|
||||
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1)
|
||||
#if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
|
||||
public int Put<T>(int offset, Span<T> x)
|
||||
where T : struct
|
||||
{
|
||||
|
||||
@@ -235,7 +235,7 @@ namespace Google.FlatBuffers
|
||||
_space = _bb.Put<T>(_space, ptr, sizeInBytes);
|
||||
}
|
||||
|
||||
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1)
|
||||
#if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
|
||||
/// <summary>
|
||||
/// Puts a span of type T into this builder at the
|
||||
/// current offset
|
||||
@@ -399,7 +399,7 @@ namespace Google.FlatBuffers
|
||||
Put<T>(ptr, sizeInBytes);
|
||||
}
|
||||
|
||||
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1)
|
||||
#if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
|
||||
/// <summary>
|
||||
/// Add a span of type T to the buffer (aligns the data and grows if necessary).
|
||||
/// </summary>
|
||||
@@ -533,10 +533,10 @@ namespace Google.FlatBuffers
|
||||
/// </summary>
|
||||
/// <param name="o">The index into the vtable</param>
|
||||
/// <param name="x">The nullable boolean value to put into the buffer. If it doesn't have a value
|
||||
/// it will skip writing to the buffer.</param>
|
||||
/// it will skip writing to the buffer.</param>
|
||||
public void AddBool(int o, bool? x) { if (x.HasValue) { AddBool(x.Value); Slot(o); } }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Adds a SByte to the Table at index `o` in its vtable using the value `x` and default `d`
|
||||
/// </summary>
|
||||
@@ -551,7 +551,7 @@ namespace Google.FlatBuffers
|
||||
/// </summary>
|
||||
/// <param name="o">The index into the vtable</param>
|
||||
/// <param name="x">The nullable sbyte value to put into the buffer. If it doesn't have a value
|
||||
/// it will skip writing to the buffer.</param>
|
||||
/// it will skip writing to the buffer.</param>
|
||||
public void AddSbyte(int o, sbyte? x) { if (x.HasValue) { AddSbyte(x.Value); Slot(o); } }
|
||||
|
||||
/// <summary>
|
||||
@@ -568,7 +568,7 @@ namespace Google.FlatBuffers
|
||||
/// </summary>
|
||||
/// <param name="o">The index into the vtable</param>
|
||||
/// <param name="x">The nullable byte value to put into the buffer. If it doesn't have a value
|
||||
/// it will skip writing to the buffer.</param>
|
||||
/// it will skip writing to the buffer.</param>
|
||||
public void AddByte(int o, byte? x) { if (x.HasValue) { AddByte(x.Value); Slot(o); } }
|
||||
|
||||
/// <summary>
|
||||
@@ -585,7 +585,7 @@ namespace Google.FlatBuffers
|
||||
/// </summary>
|
||||
/// <param name="o">The index into the vtable</param>
|
||||
/// <param name="x">The nullable int16 value to put into the buffer. If it doesn't have a value
|
||||
/// it will skip writing to the buffer.</param>
|
||||
/// it will skip writing to the buffer.</param>
|
||||
public void AddShort(int o, short? x) { if (x.HasValue) { AddShort(x.Value); Slot(o); } }
|
||||
|
||||
/// <summary>
|
||||
@@ -602,7 +602,7 @@ namespace Google.FlatBuffers
|
||||
/// </summary>
|
||||
/// <param name="o">The index into the vtable</param>
|
||||
/// <param name="x">The nullable uint16 value to put into the buffer. If it doesn't have a value
|
||||
/// it will skip writing to the buffer.</param>
|
||||
/// it will skip writing to the buffer.</param>
|
||||
public void AddUshort(int o, ushort? x) { if (x.HasValue) { AddUshort(x.Value); Slot(o); } }
|
||||
|
||||
/// <summary>
|
||||
@@ -619,7 +619,7 @@ namespace Google.FlatBuffers
|
||||
/// </summary>
|
||||
/// <param name="o">The index into the vtable</param>
|
||||
/// <param name="x">The nullable int32 value to put into the buffer. If it doesn't have a value
|
||||
/// it will skip writing to the buffer.</param>
|
||||
/// it will skip writing to the buffer.</param>
|
||||
public void AddInt(int o, int? x) { if (x.HasValue) { AddInt(x.Value); Slot(o); } }
|
||||
|
||||
/// <summary>
|
||||
@@ -636,7 +636,7 @@ namespace Google.FlatBuffers
|
||||
/// </summary>
|
||||
/// <param name="o">The index into the vtable</param>
|
||||
/// <param name="x">The nullable uint32 value to put into the buffer. If it doesn't have a value
|
||||
/// it will skip writing to the buffer.</param>
|
||||
/// it will skip writing to the buffer.</param>
|
||||
public void AddUint(int o, uint? x) { if (x.HasValue) { AddUint(x.Value); Slot(o); } }
|
||||
|
||||
/// <summary>
|
||||
@@ -653,7 +653,7 @@ namespace Google.FlatBuffers
|
||||
/// </summary>
|
||||
/// <param name="o">The index into the vtable</param>
|
||||
/// <param name="x">The nullable int64 value to put into the buffer. If it doesn't have a value
|
||||
/// it will skip writing to the buffer.</param>
|
||||
/// it will skip writing to the buffer.</param>
|
||||
public void AddLong(int o, long? x) { if (x.HasValue) { AddLong(x.Value); Slot(o); } }
|
||||
|
||||
/// <summary>
|
||||
@@ -670,7 +670,7 @@ namespace Google.FlatBuffers
|
||||
/// </summary>
|
||||
/// <param name="o">The index into the vtable</param>
|
||||
/// <param name="x">The nullable int64 value to put into the buffer. If it doesn't have a value
|
||||
/// it will skip writing to the buffer.</param>
|
||||
/// it will skip writing to the buffer.</param>
|
||||
public void AddUlong(int o, ulong? x) { if (x.HasValue) { AddUlong(x.Value); Slot(o); } }
|
||||
|
||||
/// <summary>
|
||||
@@ -687,7 +687,7 @@ namespace Google.FlatBuffers
|
||||
/// </summary>
|
||||
/// <param name="o">The index into the vtable</param>
|
||||
/// <param name="x">The nullable single value to put into the buffer. If it doesn't have a value
|
||||
/// it will skip writing to the buffer.</param>
|
||||
/// it will skip writing to the buffer.</param>
|
||||
public void AddFloat(int o, float? x) { if (x.HasValue) { AddFloat(x.Value); Slot(o); } }
|
||||
|
||||
/// <summary>
|
||||
@@ -704,7 +704,7 @@ namespace Google.FlatBuffers
|
||||
/// </summary>
|
||||
/// <param name="o">The index into the vtable</param>
|
||||
/// <param name="x">The nullable double value to put into the buffer. If it doesn't have a value
|
||||
/// it will skip writing to the buffer.</param>
|
||||
/// it will skip writing to the buffer.</param>
|
||||
public void AddDouble(int o, double? x) { if (x.HasValue) { AddDouble(x.Value); Slot(o); } }
|
||||
|
||||
/// <summary>
|
||||
@@ -739,7 +739,7 @@ namespace Google.FlatBuffers
|
||||
}
|
||||
|
||||
|
||||
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1)
|
||||
#if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
|
||||
/// <summary>
|
||||
/// Creates a string in the buffer from a Span containing
|
||||
/// a UTF8 string.
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{28C00774-1E73-4A75-AD8F-844CD21A064D}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>FlatBuffers</RootNamespace>
|
||||
<AssemblyName>FlatBuffers</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\net35</OutputPath>
|
||||
<IntermediateOutputPath>obj\Debug\net35</IntermediateOutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\net35</OutputPath>
|
||||
<IntermediateOutputPath>obj\Release\net35</IntermediateOutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ByteBuffer.cs" />
|
||||
<Compile Include="ByteBufferUtil.cs" />
|
||||
<Compile Include="FlatBufferBuilder.cs" />
|
||||
<Compile Include="FlatBufferConstants.cs" />
|
||||
<Compile Include="FlatBufferVerify.cs" />
|
||||
<Compile Include="IFlatbufferObject.cs" />
|
||||
<Compile Include="Offset.cs" />
|
||||
<Compile Include="Struct.cs" />
|
||||
<Compile Include="Table.cs" />
|
||||
</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.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netstandard2.1;netstandard2.0;net46</TargetFrameworks>
|
||||
<TargetFrameworks>netstandard2.1;net6.0;net8.0</TargetFrameworks>
|
||||
<Description>A cross-platform memory efficient serialization library</Description>
|
||||
<PackageVersion>23.5.26</PackageVersion>
|
||||
<Authors>Google LLC</Authors>
|
||||
@@ -30,12 +30,8 @@
|
||||
<DefineConstants>$(DefineConstants);ENABLE_SPAN_T</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="('$(ENABLE_SPAN_T)' == 'true') And (('$(TargetFramework)' == 'netstandard2.0') Or ('$(TargetFramework)' == 'net46'))">
|
||||
<PackageReference Include="System.Memory" Version="4.5.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace Google.FlatBuffers
|
||||
return offset + bb.GetInt(offset) + sizeof(int); // data starts after the length
|
||||
}
|
||||
|
||||
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1)
|
||||
#if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
|
||||
// Get the data of a vector whoses offset is stored at "offset" in this object as an
|
||||
// Spant<byte>. If the vector is not present in the ByteBuffer,
|
||||
// then an empty span will be returned.
|
||||
|
||||
@@ -1,203 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(UnsafeByteBuffer)' == 'true'">
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DefineConstants>$(DefineConstants);UNSAFE_BYTEBUFFER</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(EnableSpanT)' == 'true'">
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DefineConstants>$(DefineConstants);ENABLE_SPAN_T</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\net\FlatBuffers\ByteBuffer.cs">
|
||||
<Link>FlatBuffers\ByteBuffer.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\net\FlatBuffers\ByteBufferUtil.cs">
|
||||
<Link>FlatBuffers\ByteBufferUtil.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\net\FlatBuffers\IFlatbufferObject.cs">
|
||||
<Link>FlatBuffers\IFlatbufferObject.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\net\FlatBuffers\Offset.cs">
|
||||
<Link>FlatBuffers\Offset.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\FlatBufferVerify.cs">
|
||||
<Link>FlatBuffers\FlatBufferVerify.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\Example2\Monster.cs">
|
||||
<Link>MyGame\Example2\Monster.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MyGame\Example\Any.cs">
|
||||
<Link>MyGame\Example\Any.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MyGame\Example\AnyAmbiguousAliases.cs">
|
||||
<Link>MyGame\Example\AnyAmbiguousAliases.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MyGame\Example\AnyUniqueAliases.cs">
|
||||
<Link>MyGame\Example\AnyUniqueAliases.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MyGame\Example\Color.cs">
|
||||
<Link>MyGame\Example\Color.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MyGame\Example\Race.cs">
|
||||
<Link>MyGame\Example\Race.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MyGame\Example\Monster.cs">
|
||||
<Link>MyGame\Example\Monster.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MyGame\Example\Referrable.cs">
|
||||
<Link>MyGame\Example\Referrable.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>
|
||||
<Compile Include="..\MyGame\Example\TestSimpleTableWithEnum.cs">
|
||||
<Link>MyGame\Example\TestSimpleTableWithEnum.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MyGame\Example\TypeAliases.cs">
|
||||
<Link>MyGame\Example\TypeAliases.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MyGame\Example\Vec3.cs">
|
||||
<Link>MyGame\Example\Vec3.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MyGame\Example\Ability.cs">
|
||||
<Link>MyGame\Example\Ability.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MyGame\Example\ArrayTable.cs">
|
||||
<Link>MyGame\Example\ArrayTable.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MyGame\Example\ArrayStruct.cs">
|
||||
<Link>MyGame\Example\ArrayStruct.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MyGame\Example\NestedStruct.cs">
|
||||
<Link>MyGame\Example\NestedStruct.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MyGame\Example\LongEnum.cs">
|
||||
<Link>MyGame\Example\LongEnum.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MyGame\Example\TestEnum.cs">
|
||||
<Link>MyGame\Example\TestEnum.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MyGame\InParentNamespace.cs">
|
||||
<Link>MyGame\InParentNamespace.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\namespace_test\NamespaceA\NamespaceB\EnumInNestedNS.cs">
|
||||
<Link>NamespaceA\NamespaceB\EnumInNestedNS.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\namespace_test\NamespaceA\NamespaceB\StructInNestedNS.cs">
|
||||
<Link>NamespaceA\NamespaceB\StructInNestedNS.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\namespace_test\NamespaceA\NamespaceB\TableInNestedNS.cs">
|
||||
<Link>NamespaceA\NamespaceB\TableInNestedNS.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\namespace_test\NamespaceA\NamespaceB\UnionInNestedNS.cs">
|
||||
<Link>NamespaceA\NamespaceB\UnionInNestedNS.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\namespace_test\NamespaceA\TableInFirstNS.cs">
|
||||
<Link>NamespaceA\TableInFirstNS.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\union_vector\Attacker.cs">
|
||||
<Link>union_vector\Attacker.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\union_vector\BookReader.cs">
|
||||
<Link>union_vector\BookReader.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\union_vector\Character.cs">
|
||||
<Link>union_vector\Character.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\union_vector\Movie.cs">
|
||||
<Link>union_vector\Movie.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\union_vector\Rapunzel.cs">
|
||||
<Link>union_vector\Rapunzel.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\optional_scalars\OptionalByte.cs">
|
||||
<Link>optional_scalars\OptionalByte.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\optional_scalars\ScalarStuff.cs">
|
||||
<Link>optional_scalars\ScalarStuff.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\KeywordTest\ABC.cs">
|
||||
<Link>KeywordTest\ABC.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\KeywordTest\public.cs">
|
||||
<Link>KeywordTest\public.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\KeywordTest\KeywordsInTable.cs">
|
||||
<Link>KeywordTest\KeywordsInTable.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\KeywordTest\KeywordsInUnion.cs">
|
||||
<Link>KeywordTest\KeywordsInUnion.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\nested_namespace_test\nested_namespace_test1_generated.cs">
|
||||
<Link>nested_namespace_test\nested_namespace_test1_generated.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\nested_namespace_test\nested_namespace_test2_generated.cs">
|
||||
<Link>nested_namespace_test\nested_namespace_test2_generated.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\nested_namespace_test\nested_namespace_test3_generated.cs">
|
||||
<Link>nested_namespace_test\nested_namespace_test3_generated.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\union_value_collsion\union_value_collision_generated.cs">
|
||||
<Link>union_value_collsion\union_value_collision_generated.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove=".gitignore" />
|
||||
<None Remove="clean.sh" />
|
||||
<None Remove="NetTest.sh" />
|
||||
<None Remove="packages.config" />
|
||||
<None Remove="README.md" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="..\monsterdata_test.mon">
|
||||
<Link>Resources\monsterdata_test.mon</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="..\monsterdata_test.json">
|
||||
<Link>Resources\monsterdata_test.json</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,52 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{9DB0B5E7-757E-4BD1-A5F6-279390331254}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>FlatBuffers.Test</RootNamespace>
|
||||
<AssemblyName>FlatBuffers.Test</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<RuntimeIdentifier>win</RuntimeIdentifier>
|
||||
<LangVersion>4</LangVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(UnsafeByteBuffer)' == 'true'">
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DefineConstants>$(DefineConstants);UNSAFE_BYTEBUFFER</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(EnableSpanT)' == 'true'">
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DefineConstants>$(DefineConstants);ENABLE_SPAN_T</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\net\FlatBuffers\ByteBuffer.cs">
|
||||
<Link>FlatBuffers\ByteBuffer.cs</Link>
|
||||
@@ -123,12 +103,12 @@
|
||||
<Compile Include="..\MyGame\Example\ArrayStruct.cs">
|
||||
<Link>MyGame\Example\ArrayStruct.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MyGame\Example\LongEnum.cs">
|
||||
<Link>MyGame\Example\LongEnum.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MyGame\Example\NestedStruct.cs">
|
||||
<Link>MyGame\Example\NestedStruct.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MyGame\Example\LongEnum.cs">
|
||||
<Link>MyGame\Example\LongEnum.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MyGame\Example\TestEnum.cs">
|
||||
<Link>MyGame\Example\TestEnum.cs</Link>
|
||||
</Compile>
|
||||
@@ -192,19 +172,19 @@
|
||||
<Compile Include="..\nested_namespace_test\nested_namespace_test3_generated.cs">
|
||||
<Link>nested_namespace_test\nested_namespace_test3_generated.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Assert.cs" />
|
||||
<Compile Include="ByteBufferTests.cs" />
|
||||
<Compile Include="FlatBufferBuilderTests.cs" />
|
||||
<Compile Include="FlatBuffersFuzzTests.cs" />
|
||||
<Compile Include="FlatBuffersTestClassAttribute.cs" />
|
||||
<Compile Include="FlatBuffersTestMethodAttribute.cs" />
|
||||
<Compile Include="FuzzTestData.cs" />
|
||||
<Compile Include="Lcg.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="FlatBuffersExampleTests.cs" />
|
||||
<Compile Include="TestTable.cs" />
|
||||
<Compile Include="..\union_value_collsion\union_value_collision_generated.cs">
|
||||
<Link>union_value_collsion\union_value_collision_generated.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove=".gitignore" />
|
||||
<None Remove="clean.sh" />
|
||||
<None Remove="NetTest.sh" />
|
||||
<None Remove="packages.config" />
|
||||
<None Remove="README.md" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="..\monsterdata_test.mon">
|
||||
<Link>Resources\monsterdata_test.mon</Link>
|
||||
@@ -215,15 +195,9 @@
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</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.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
set TEMP_BIN=.tmp
|
||||
|
||||
@REM Run the .NET Core tests
|
||||
set CORE_FILE=FlatBuffers.Core.Test
|
||||
@REM Run the .NET tests
|
||||
set CORE_FILE=FlatBuffers.Test
|
||||
set CORE_PROJ_FILE=%CORE_FILE%.csproj
|
||||
set CORE_SLN_FILE=%CORE_FILE%.sln
|
||||
dotnet new sln --force --name %CORE_FILE%
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
PROJ_FILE=FlatBuffers.Test.csproj
|
||||
CORE_PROJ_FILE=FlatBuffers.Core.Test.csproj
|
||||
|
||||
TEMP_DOTNET_DIR=.dotnet_tmp
|
||||
TEMP_BIN=.tmp
|
||||
@@ -18,37 +17,20 @@ $DOTNET new sln
|
||||
$DOTNET sln add $PROJ_FILE
|
||||
$DOTNET restore -r linux-x64 $PROJ_FILE
|
||||
|
||||
# Testing C# on Linux using Mono.
|
||||
# Testing with default options.
|
||||
msbuild -property:Configuration=Release,OutputPath=$TEMP_BIN -verbosity:quiet $PROJ_FILE
|
||||
mono $TEMP_BIN/FlatBuffers.Test.exe
|
||||
$TEMP_BIN/FlatBuffers.Core.Test.exe
|
||||
rm -fr $TEMP_BIN
|
||||
|
||||
# Repeat with unsafe versions
|
||||
msbuild -property:Configuration=Release,UnsafeByteBuffer=true,OutputPath=$TEMP_BIN -verbosity:quiet $PROJ_FILE
|
||||
mono $TEMP_BIN/FlatBuffers.Test.exe
|
||||
rm -fr $TEMP_BIN
|
||||
|
||||
rm FlatBuffers.Test.sln
|
||||
rm -rf obj
|
||||
|
||||
$DOTNET new sln
|
||||
$DOTNET sln add $CORE_PROJ_FILE
|
||||
$DOTNET restore -r linux-x64 $CORE_PROJ_FILE
|
||||
|
||||
# Testing C# on Linux using .Net Core.
|
||||
msbuild -property:Configuration=Release,OutputPath=$TEMP_BIN -verbosity:quiet $CORE_PROJ_FILE
|
||||
$TEMP_BIN/FlatBuffers.Core.Test.exe
|
||||
rm -fr $TEMP_BIN
|
||||
|
||||
# Repeat with unsafe versions
|
||||
msbuild -property:Configuration=Release,UnsafeByteBuffer=true,OutputPath=$TEMP_BIN -verbosity:quiet $CORE_PROJ_FILE
|
||||
$TEMP_BIN/FlatBuffers.Core.Test.exe
|
||||
rm -fr $TEMP_BIN
|
||||
|
||||
# Repeat with SpanT versions
|
||||
msbuild -property:Configuration=Release,EnableSpanT=true,OutputPath=$TEMP_BIN -verbosity:quiet $CORE_PROJ_FILE
|
||||
msbuild -property:Configuration=Release,EnableSpanT=true,OutputPath=$TEMP_BIN -verbosity:quiet $PROJ_FILE
|
||||
$TEMP_BIN/FlatBuffers.Core.Test.exe
|
||||
rm -fr $TEMP_BIN
|
||||
|
||||
rm FlatBuffers.Core.Test.sln
|
||||
rm FlatBuffers.Test.sln
|
||||
rm -rf obj
|
||||
|
||||
BIN
tests/FlatBuffers.Test/monsterdata_cstest.mon
Normal file
BIN
tests/FlatBuffers.Test/monsterdata_cstest.mon
Normal file
Binary file not shown.
BIN
tests/FlatBuffers.Test/monsterdata_cstest_sp.mon
Normal file
BIN
tests/FlatBuffers.Test/monsterdata_cstest_sp.mon
Normal file
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net35" />
|
||||
</packages>
|
||||
<package id="Newtonsoft.Json" version="13.0.3" />
|
||||
</packages>
|
||||
|
||||
Reference in New Issue
Block a user