diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4c1a784..884b6a3 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -14,10 +14,8 @@ jobs: steps: - name: Check out code uses: actions/checkout@v3 - - name: Set up .NET 7.0 + - name: Set up .NET uses: actions/setup-dotnet@v3 - with: - dotnet-version: 7.x - name: Restore run: dotnet restore - name: Build diff --git a/Directory.Build.props b/Directory.Build.props index 36315a4..c0a1719 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -24,7 +24,7 @@ - + diff --git a/global.json b/global.json new file mode 100644 index 0000000..391ba3c --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "version": "8.0.100", + "rollForward": "latestFeature" + } +} diff --git a/src/BsDiff/BinaryPatch.cs b/src/BsDiff/BinaryPatch.cs index 2246f35..3326d34 100644 --- a/src/BsDiff/BinaryPatch.cs +++ b/src/BsDiff/BinaryPatch.cs @@ -43,8 +43,12 @@ public static class BinaryPatch public static void Create(ReadOnlySpan oldData, ReadOnlySpan newData, Stream output) { // check arguments +#if NET6_0_OR_GREATER + ArgumentNullException.ThrowIfNull(output); +#else if (output is null) throw new ArgumentNullException(nameof(output)); +#endif if (!output.CanSeek) throw new ArgumentException("Output stream must be seekable.", nameof(output)); if (!output.CanWrite) @@ -222,12 +226,18 @@ 0 32 Header public static void Apply(Stream input, Func openPatchStream, Stream output) { // check arguments +#if NET6_0_OR_GREATER + ArgumentNullException.ThrowIfNull(input); + ArgumentNullException.ThrowIfNull(openPatchStream); + ArgumentNullException.ThrowIfNull(output); +#else if (input is null) throw new ArgumentNullException(nameof(input)); if (openPatchStream is null) throw new ArgumentNullException(nameof(openPatchStream)); if (output is null) throw new ArgumentNullException(nameof(output)); +#endif /* File format: diff --git a/src/BsDiff/BsDiff.csproj b/src/BsDiff/BsDiff.csproj index fd2434b..ba2c7cd 100644 --- a/src/BsDiff/BsDiff.csproj +++ b/src/BsDiff/BsDiff.csproj @@ -1,7 +1,7 @@ - + - netstandard2.0;net7.0 + netstandard2.0;net6.0;net8.0 true .NET port of bsdiff, Colin Pervical's binary diff/patch utility, in 100% managed code. BsDiff @@ -14,7 +14,7 @@ - + diff --git a/src/BsDiffTool/BsDiffTool.csproj b/src/BsDiffTool/BsDiffTool.csproj index d9698a8..65c95c0 100644 --- a/src/BsDiffTool/BsDiffTool.csproj +++ b/src/BsDiffTool/BsDiffTool.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 Port of bsdiff to .NET. diff --git a/src/BsPatchTool/BsPatchTool.csproj b/src/BsPatchTool/BsPatchTool.csproj index cd71eac..080b881 100644 --- a/src/BsPatchTool/BsPatchTool.csproj +++ b/src/BsPatchTool/BsPatchTool.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 Port of bspatch to .NET. diff --git a/tests/BsDiff.Tests/BsDiff.Tests.csproj b/tests/BsDiff.Tests/BsDiff.Tests.csproj index 1e50bfb..43e3838 100644 --- a/tests/BsDiff.Tests/BsDiff.Tests.csproj +++ b/tests/BsDiff.Tests/BsDiff.Tests.csproj @@ -1,20 +1,20 @@ - net6.0;net7.0 + net6.0;net8.0 enable false - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all