-
Notifications
You must be signed in to change notification settings - Fork 14
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
+492
−71
Merged
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`.
fc6f1d1
Update LangVersion to `9.0` to enable patterns.
bb2c363
Install `System.Text.Json` package.
091e3fb
Workaround for missing `IsExternalInit`.
3918160
Install `System.Net.Http.Json` package.
cbf2bee
Workaround for missing `ITuple`.
0df8524
Workaround for missing ranges/indexes.
19d6e93
Workaround for `MemoryStream.Write` with less args.
79845b2
Workaround for `BigInteger.ToByteArray` with arg.
5f22e95
Workaround for `BitConverter.To*` without arg.
9ca4ca6
Workaround for `HttpClient.GetStreamAsync` with 2 args.
5572813
Workaround for `BigInteger` constructor with 2 args.
45b7fa1
Workaround for `Enum.Parse`.
1610ff9
Workaround for `Enum.GetName` with less args.
9607b0f
Workaround for missing `DateTime.UnixEpoch`.
d81a28e
Define CI/CD for Unity branch.
e5344e4
Fix invalid `Content-Type` - remove empty charset.
978ea1b
Update `unity-compat.yml` workflow with new branch name.
449d20d
Merge pull request #36 from andrzej-casper/feature/unity-compat
davidatwhiletrue bbcea99
Merge branch 'master' into netstandard-2-0-target
davidatwhiletrue a955ef7
run tests on net7.0 netstandard2.0
davidatwhiletrue ab81ba4
fix test pipeline
davidatwhiletrue 9800e2d
test against net7.0 and netstandard2.0 frameworks
davidatwhiletrue bc17466
Bump up version to 3.0
davidatwhiletrue File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"><SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from Solution" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> | ||
<Solution /> | ||
</SessionState></s:String></wpf:ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.