Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for multi-framework package publish #58

Merged
merged 24 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4cdb78e
Update TargetFramework to `netstandard2.0`.
Aug 29, 2023
fc6f1d1
Update LangVersion to `9.0` to enable patterns.
Aug 29, 2023
bb2c363
Install `System.Text.Json` package.
Aug 29, 2023
091e3fb
Workaround for missing `IsExternalInit`.
Aug 29, 2023
3918160
Install `System.Net.Http.Json` package.
Aug 29, 2023
cbf2bee
Workaround for missing `ITuple`.
Aug 29, 2023
0df8524
Workaround for missing ranges/indexes.
Aug 29, 2023
19d6e93
Workaround for `MemoryStream.Write` with less args.
Aug 29, 2023
79845b2
Workaround for `BigInteger.ToByteArray` with arg.
Aug 29, 2023
5f22e95
Workaround for `BitConverter.To*` without arg.
Aug 29, 2023
9ca4ca6
Workaround for `HttpClient.GetStreamAsync` with 2 args.
Aug 29, 2023
5572813
Workaround for `BigInteger` constructor with 2 args.
Aug 29, 2023
45b7fa1
Workaround for `Enum.Parse`.
Aug 29, 2023
1610ff9
Workaround for `Enum.GetName` with less args.
Aug 29, 2023
9607b0f
Workaround for missing `DateTime.UnixEpoch`.
Aug 29, 2023
d81a28e
Define CI/CD for Unity branch.
Aug 29, 2023
e5344e4
Fix invalid `Content-Type` - remove empty charset.
Aug 30, 2023
978ea1b
Update `unity-compat.yml` workflow with new branch name.
Aug 30, 2023
449d20d
Merge pull request #36 from andrzej-casper/feature/unity-compat
davidatwhiletrue Apr 12, 2024
bbcea99
Merge branch 'master' into netstandard-2-0-target
davidatwhiletrue Apr 12, 2024
a955ef7
run tests on net7.0 netstandard2.0
davidatwhiletrue Apr 12, 2024
ab81ba4
fix test pipeline
davidatwhiletrue Apr 12, 2024
9800e2d
test against net7.0 and netstandard2.0 frameworks
davidatwhiletrue Apr 12, 2024
bc17466
Bump up version to 3.0
davidatwhiletrue Apr 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build and Test

on:
push:
branches: [ master ]
branches: [ master, netstandard-2-0-target ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this branch gonna be permanent?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, it won't be needed. All this PR is to have one single pipeline to build, test and publish for two platforms, .NET and netstandard2.0.

pull_request:
branches: [ master ]

Expand All @@ -11,6 +11,13 @@ jobs:

runs-on: ubuntu-latest

strategy:
matrix:
include:
- name: net7.0
framework: net7.0
- name: netstandard2.0
framework: netstandard2.0
steps:
- uses: actions/checkout@v2
- name: Setup .NET
Expand All @@ -22,4 +29,4 @@ jobs:
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal --filter "TestCategory!~NCTL"
run: TEST_FRAMEWORK=${{ matrix.framework }} dotnet test --no-build --verbosity normal --filter "TestCategory!~NCTL"
10 changes: 9 additions & 1 deletion .github/workflows/integration-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ jobs:
# The type of runner that the job will run on
runs-on: ubuntu-latest

strategy:
matrix:
include:
- name: net7.0
framework: net7.0
- name: netstandard2.0
framework: netstandard2.0

# Service containers to run with `runner-job`
services:
# Label used to access the service container
Expand Down Expand Up @@ -37,4 +45,4 @@ jobs:
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal --settings Casper.Network.SDK.Test/test.runsettings --filter="TestCategory=NCTL"
run: TEST_FRAMEWORK=${{ matrix.framework }} dotnet test --no-build --verbosity normal --settings Casper.Network.SDK.Test/test.runsettings --filter="TestCategory=NCTL"
24 changes: 24 additions & 0 deletions .github/workflows/unity-compat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ame: Unity Compat - Build and Test

on:
push:
branches: [netstandard-2-0-target]
pull_request:
branches: [netstandard-2-0-target]

jobs:
buildntest:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal --filter "TestCategory!~NCTL"
5 changes: 2 additions & 3 deletions Casper.Network.SDK.Test/CLValueJsonDeserializerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Text.Json.Serialization;
using Casper.Network.SDK.Converters;
using Casper.Network.SDK.Types;
using Newtonsoft.Json.Linq;
using NUnit.Framework;
using Org.BouncyCastle.Utilities.Encoders;

Expand Down Expand Up @@ -148,7 +147,7 @@ public void DeserializeI32CLValue()
var json = @"{""cl_type"":""I32"",""bytes"":""00000080"",""parsed"":-2147483648}";
var clValue = JsonSerializer.Deserialize<CLValue>(json);
Assert.IsNotNull(clValue);
Assert.AreEqual(int.MinValue, BitConverter.ToInt32(clValue.Bytes));
Assert.AreEqual(int.MinValue, BitConverterExtensions.ToInt32(clValue.Bytes));
Assert.AreEqual(int.MinValue, clValue.Parsed);
}

Expand All @@ -168,7 +167,7 @@ public void DeserializeU64CLValue()
var clValue = JsonSerializer.Deserialize<CLValue>(json);
Assert.IsNotNull(clValue);
Assert.AreEqual(CLType.U64, clValue.TypeInfo.Type);
Assert.AreEqual(ulong.MaxValue, BitConverter.ToUInt64(clValue.Bytes));
Assert.AreEqual(ulong.MaxValue, BitConverterExtensions.ToUInt64(clValue.Bytes));
Assert.AreEqual(ulong.MaxValue, clValue.Parsed);
}

Expand Down
2 changes: 1 addition & 1 deletion Casper.Network.SDK.Test/CLValueToTypeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public void CLValueToBigInteger()
Assert.AreEqual(new BigInteger(5123456789012), clValue.ToBigInteger());
Assert.AreEqual(new BigInteger(5123456789012), (BigInteger) clValue);

var bigInt = new BigInteger(Hex.Decode("F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF"), true);
var bigInt = BigIntegerCompat.Create(Hex.Decode("F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF"), true);
clValue = CLValue.U128(bigInt);
Assert.AreEqual(bigInt, clValue.ToBigInteger());
Assert.AreEqual(bigInt, (BigInteger) clValue);
Expand Down
18 changes: 13 additions & 5 deletions Casper.Network.SDK.Test/Casper.Network.SDK.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>

<LangVersion>9.0</LangVersion>
<IsPackable>false</IsPackable>

<RootNamespace>NetCasperTest</RootNamespace>
</PropertyGroup>

Expand All @@ -15,10 +14,19 @@
<PackageReference Include="coverlet.collector" Version="3.2.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Casper.Network.SDK\Casper.Network.SDK.csproj" />
<!-- Define a property to read from an environment variable -->
<PropertyGroup>
<CustomTargetFramework Condition="'$(TEST_FRAMEWORK)' != ''">$(TEST_FRAMEWORK)</CustomTargetFramework>
<!-- Fallback to a default framework if the environment variable is not set -->
<CustomTargetFramework Condition="'$(CustomTargetFramework)' == ''">net7.0</CustomTargetFramework>
</PropertyGroup>

<ItemGroup Condition="'$(CustomTargetFramework)' == 'net7.0'">
<ProjectReference Include="..\Casper.Network.SDK\Casper.Network.SDK.csproj" Properties="TargetFramework=net7.0" />
</ItemGroup>
<ItemGroup Condition="'$(CustomTargetFramework)' == 'netstandard2.0'">
<ProjectReference Include="..\Casper.Network.SDK\Casper.Network.SDK.csproj" Properties="TargetFramework=netstandard2.0" />
</ItemGroup>

<ItemGroup>
<Content Include="TestData\**\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down
18 changes: 9 additions & 9 deletions Casper.Network.SDK.Test/KeysTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,27 @@ public void TestValidBlakeEd25519()
var publicKey = PublicKey.FromHexString(ED25519publicKey);
Assert.AreEqual(KeyAlgo.ED25519, publicKey.KeyAlgorithm);
Assert.AreEqual(ED25519publicKey, publicKey.ToAccountHex());
Assert.IsTrue(Hex.Decode(ED25519publicKey)[1..].SequenceEqual(publicKey.RawBytes));
Assert.IsTrue(Hex.Decode(ED25519publicKey).Slice(1).SequenceEqual(publicKey.RawBytes));

var hash = publicKey.GetAccountHash();
Assert.AreEqual(ED25519hash, hash.Substring("account-hash-".Length), "Unexpected ED25519 hash value");

var pk2 = PublicKey.FromBytes(Hex.Decode(ED25519publicKey));
Assert.AreEqual(KeyAlgo.ED25519, pk2.KeyAlgorithm);
Assert.AreEqual(ED25519publicKey, pk2.ToAccountHex());
Assert.IsTrue(Hex.Decode(ED25519publicKey)[1..].SequenceEqual(pk2.RawBytes));
Assert.IsTrue(Hex.Decode(ED25519publicKey).Slice(1).SequenceEqual(pk2.RawBytes));

var pk3 = PublicKey.FromRawBytes(Hex.Decode(ED25519publicKey)[1..], KeyAlgo.ED25519);
var pk3 = PublicKey.FromRawBytes(Hex.Decode(ED25519publicKey).Slice(1), KeyAlgo.ED25519);
Assert.AreEqual(KeyAlgo.ED25519, pk3.KeyAlgorithm);
Assert.AreEqual(ED25519publicKey, pk3.ToAccountHex());
Assert.IsTrue(Hex.Decode(ED25519publicKey)[1..].SequenceEqual(pk3.RawBytes));
Assert.IsTrue(Hex.Decode(ED25519publicKey).Slice(1).SequenceEqual(pk3.RawBytes));

var pemfile = TestContext.CurrentContext.TestDirectory +
"/TestData/test-ed25519-pk.pem";
var pk4 = PublicKey.FromPem(pemfile);
Assert.AreEqual(KeyAlgo.ED25519, pk4.KeyAlgorithm);
Assert.AreEqual(ED25519publicKey, pk4.ToAccountHex());
Assert.IsTrue(Hex.Decode(ED25519publicKey)[1..].SequenceEqual(pk4.RawBytes));
Assert.IsTrue(Hex.Decode(ED25519publicKey).Slice(1).SequenceEqual(pk4.RawBytes));
Assert.IsTrue(Hex.Decode(ED25519publicKey).SequenceEqual(pk4.GetBytes()));

var hash3 = pk4.GetAccountHash();
Expand All @@ -60,19 +60,19 @@ public void TestValidBlakeSecp256k1()
var pk2 = PublicKey.FromBytes(Hex.Decode(SECP256K1publicKey));
Assert.AreEqual(KeyAlgo.SECP256K1, pk2.KeyAlgorithm);
Assert.AreEqual(SECP256K1publicKey, pk2.ToAccountHex());
Assert.IsTrue(Hex.Decode(SECP256K1publicKey)[1..].SequenceEqual(pk2.RawBytes));
Assert.IsTrue(Hex.Decode(SECP256K1publicKey).Slice(1).SequenceEqual(pk2.RawBytes));

var pk3 = PublicKey.FromRawBytes(Hex.Decode(SECP256K1publicKey)[1..], KeyAlgo.SECP256K1);
var pk3 = PublicKey.FromRawBytes(Hex.Decode(SECP256K1publicKey).Slice(1), KeyAlgo.SECP256K1);
Assert.AreEqual(KeyAlgo.SECP256K1, pk3.KeyAlgorithm);
Assert.AreEqual(SECP256K1publicKey, pk3.ToAccountHex());
Assert.IsTrue(Hex.Decode(SECP256K1publicKey)[1..].SequenceEqual(pk3.RawBytes));
Assert.IsTrue(Hex.Decode(SECP256K1publicKey).Slice(1).SequenceEqual(pk3.RawBytes));

var pemfile = TestContext.CurrentContext.TestDirectory +
"/TestData/test-secp256k1-pk.pem";
var pk4 = PublicKey.FromPem(pemfile);
Assert.AreEqual(KeyAlgo.SECP256K1, pk4.KeyAlgorithm);
Assert.AreEqual(SECP256K1publicKey, pk4.ToAccountHex());
Assert.IsTrue(Hex.Decode(SECP256K1publicKey)[1..].SequenceEqual(pk4.RawBytes));
Assert.IsTrue(Hex.Decode(SECP256K1publicKey).Slice(1).SequenceEqual(pk4.RawBytes));
Assert.IsTrue(Hex.Decode(SECP256K1publicKey).SequenceEqual(pk4.GetBytes()));

var hash3 = pk4.GetAccountHash();
Expand Down
2 changes: 1 addition & 1 deletion Casper.Network.SDK.Test/NctlContractTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
[Test, Order(1)]
public async Task DeployContractTest()
{
var wasmBytes = await File.ReadAllBytesAsync(_wasmFile);
var wasmBytes = await FileExtensions.ReadAllBytesAsync(_wasmFile);

var deploy = DeployTemplates.ContractDeploy(
wasmBytes,
Expand Down Expand Up @@ -199,7 +199,7 @@
[Test, Order(9)]
public async Task GetItemTest()
{
var rpcResponse = await _client.QueryState(_faucetKey.PublicKey.GetAccountHash(),

Check warning on line 202 in Casper.Network.SDK.Test/NctlContractTest.cs

View workflow job for this annotation

GitHub Actions / buildntest (net7.0, net7.0)

'NetCasperClient.QueryState(string, List<string>, string)' is obsolete: 'Use QueryGlobalState() to retrieve stored values from the network.'

Check warning on line 202 in Casper.Network.SDK.Test/NctlContractTest.cs

View workflow job for this annotation

GitHub Actions / buildntest (net7.0, net7.0)

'NetCasperClient.QueryState(string, List<string>, string)' is obsolete: 'Use QueryGlobalState() to retrieve stored values from the network.'

Check warning on line 202 in Casper.Network.SDK.Test/NctlContractTest.cs

View workflow job for this annotation

GitHub Actions / buildntest (netstandard2.0, netstandard2.0)

'NetCasperClient.QueryState(string, List<string>, string)' is obsolete: 'Use QueryGlobalState() to retrieve stored values from the network.'

Check warning on line 202 in Casper.Network.SDK.Test/NctlContractTest.cs

View workflow job for this annotation

GitHub Actions / buildntest (net7.0, net7.0)

'NetCasperClient.QueryState(string, List<string>, string)' is obsolete: 'Use QueryGlobalState() to retrieve stored values from the network.'

Check warning on line 202 in Casper.Network.SDK.Test/NctlContractTest.cs

View workflow job for this annotation

GitHub Actions / buildntest (net7.0, net7.0)

'NetCasperClient.QueryState(string, List<string>, string)' is obsolete: 'Use QueryGlobalState() to retrieve stored values from the network.'

Check warning on line 202 in Casper.Network.SDK.Test/NctlContractTest.cs

View workflow job for this annotation

GitHub Actions / buildntest (netstandard2.0, netstandard2.0)

'NetCasperClient.QueryState(string, List<string>, string)' is obsolete: 'Use QueryGlobalState() to retrieve stored values from the network.'
new List<string> {"counter", "count"});
var count = rpcResponse.Parse().StoredValue.CLValue;
Assert.IsNotNull(count);
Expand Down
2 changes: 1 addition & 1 deletion Casper.Network.SDK.Test/NctlMyDictContractTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class NctlMyDictContractTest : NctlBase
[Test, Order(1)]
public async Task DeployContractTest()
{
var wasmBytes = await File.ReadAllBytesAsync(_wasmFile);
var wasmBytes = await FileExtensions.ReadAllBytesAsync(_wasmFile);

var deploy = DeployTemplates.ContractDeploy(
wasmBytes,
Expand Down
2 changes: 1 addition & 1 deletion Casper.Network.SDK.Test/NctlSpeculativeExecutionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void Setup()
[Test, Order(1)]
public async Task SpeculativeExecutionTest()
{
var wasmBytes = await File.ReadAllBytesAsync(_wasmFile);
var wasmBytes = await FileExtensions.ReadAllBytesAsync(_wasmFile);

var deploy = DeployTemplates.ContractDeploy(
wasmBytes,
Expand Down
4 changes: 3 additions & 1 deletion Casper.Network.SDK.sln.DotSettings.user
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/Environment/Highlighting/HighlightingSourceSnapshotLocation/@EntryValue">C:\Users\d\AppData\Local\JetBrains\Rider2021.3\resharper-host\temp\Rider\vAny\CoverageData\_Casper.Network.SDK.-947408436\Snapshot\snapshot.utdcvr</s:String></wpf:ResourceDictionary>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=240e6887_002D6585_002D487e_002D89bf_002D0b306f497b30/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from Solution" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
&lt;Solution /&gt;
&lt;/SessionState&gt;</s:String></wpf:ResourceDictionary>
14 changes: 9 additions & 5 deletions Casper.Network.SDK/Casper.Network.SDK.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<AssemblyVersion>2.2.0.0</AssemblyVersion>
<FileVersion>2.2.0</FileVersion>
<PackageVersion>2.2.0</PackageVersion>
<TargetFrameworks>net7.0;netstandard2.0</TargetFrameworks>
<LangVersion>9.0</LangVersion>
<NoWarn>CS1591</NoWarn>
<AssemblyVersion>2.3.0.0</AssemblyVersion>
<FileVersion>2.3.0</FileVersion>
<PackageVersion>2.3.0</PackageVersion>
<Title>Casper.Network.SDK</Title>
<Authors>make-software</Authors>
<PackageProjectUrl>https://github.com/make-software/casper-net-sdk</PackageProjectUrl>
Expand All @@ -18,11 +20,13 @@
</Description>
<RootNamespace>Casper.Network.SDK</RootNamespace>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
<DocumentationFile>bin\$(Configuration)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BouncyCastle.Cryptography" Version="2.3.0" />
<PackageReference Include="System.Net.Http.Json" Version="7.0.1" />
<PackageReference Include="System.Text.Json" Version="7.0.3" />
</ItemGroup>

<ItemGroup>
Expand Down
35 changes: 35 additions & 0 deletions Casper.Network.SDK/Compat/BigIntegerCompat.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System;
using System.Numerics;

public class BigIntegerCompat
{
public static BigInteger Create(byte[] value, bool isUnsigned = false, bool isBigEndian = false)
{
#if NET7_0_OR_GREATER
return new BigInteger(value, true, false);
#elif NETSTANDARD2_0
if (value == null)
{
throw new ArgumentNullException(nameof(value));
}

if (isBigEndian)
{
Array.Reverse(value);
}

if (isUnsigned)
{
// Ensure that the resulting BigInteger is treated as an unsigned value by appending a 0 byte if necessary
if (value[value.Length - 1] >= 0x80)
{
Array.Resize(ref value, value.Length + 1);
value[value.Length - 1] = 0;
}
}

return new BigInteger(value);
#endif
}
}

62 changes: 62 additions & 0 deletions Casper.Network.SDK/Compat/BigIntegerExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#if NETSTANDARD2_0

using System;
using System.Numerics;

public static class BigIntegerExtensions
{
public static byte[] ToByteArray(this BigInteger value, bool isUnsigned = false)
{
byte[] bytes = value.ToByteArray();

if (isUnsigned)
{
if (value < 0)
{
throw new InvalidOperationException("Cannot retrieve an unsigned byte array representation of a negative BigInteger.");
}

// If the BigInteger is positive and the highest byte is 0x80 or higher,
// an additional byte is added to indicate a positive number when using two's complement notation.
// For the unsigned representation, this additional byte is not necessary.
if (bytes.Length > 1 && bytes[bytes.Length - 1] == 0)
{
Array.Resize(ref bytes, bytes.Length - 1);
}
}

return bytes;
}

public static int GetBitLength(this BigInteger value)
{
// If the value is zero, its bit length is 0
if (value == BigInteger.Zero)
return 0;

// Get the byte array without the sign
byte[] bytes = value.ToByteArray();

// Find the highest-order byte with a non-zero value
int highestByte = bytes.Length - 1;
while (highestByte > 0 && bytes[highestByte] == 0)
{
highestByte--;
}

// Count the bits in the last used byte
int bitsInLastByte = 0;
byte lastByte = bytes[highestByte];
while (lastByte != 0)
{
bitsInLastByte++;
lastByte >>= 1;
}

// Calculate the total bit length
// (Number of full bytes minus 1) * 8 + bits in last byte
return highestByte * 8 + bitsInLastByte;
}
}

#endif
26 changes: 26 additions & 0 deletions Casper.Network.SDK/Compat/BitConverterExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

using System;

public static class BitConverterExtensions
{
public static Int64 ToInt64(byte[] value, int startIndex = 0)
{
return BitConverter.ToInt64(value, startIndex);
}

public static Int32 ToInt32(byte[] value, int startIndex = 0)
{
return BitConverter.ToInt32(value, startIndex);
}

public static UInt64 ToUInt64(byte[] value, int startIndex = 0)
{
return BitConverter.ToUInt64(value, startIndex);
}

public static UInt32 ToUInt32(byte[] value, int startIndex = 0)
{
return BitConverter.ToUInt32(value, startIndex);
}
}

Loading
Loading