diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d8f5b1..244d488 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,6 @@ on: env: BuildConfig: Release DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - DOTNET_VERSION: '6.0.100' # https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/6.0/releases.json jobs: build: @@ -19,7 +18,7 @@ jobs: steps: - name: Cancel previous builds in PR - uses: styfle/cancel-workflow-action@0.9.0 + uses: styfle/cancel-workflow-action@0.9.1 with: access_token: ${{ github.token }} @@ -28,9 +27,9 @@ jobs: fetch-depth: 0 # avoid shallow clone so nbgv can do its work. - name: 'Install .NET SDK' - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v3 with: - dotnet-version: ${{ env.DOTNET_VERSION }} + global-json-file: ./global.json - name: Versioning uses: dotnet/nbgv@master @@ -54,9 +53,8 @@ jobs: /p:Version=${{ steps.nbgv.outputs.NuGetPackageVersion }} - name: Push to NuGet - ## push only stable packages - if: github.ref == 'refs/heads/main' run: dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_DEPLOY_KEY }} --source https://api.nuget.org/v3/index.json - --no-symbols 1 + --no-symbols + --skip-duplicate diff --git a/Directory.Build.props b/Directory.Build.props index 8af7813..15847a1 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,21 +1,33 @@ - 2.12 MyCSharp.de, Benjamin Abt, Günther Foidl and Contributors - https://github.com/mycsharp/HttpUserAgentParser - MIT + MyCSharp.HttpUserAgentParser en-US - HTTP User Agent Parser for .NET true - preview - enable - true - true embedded + + + + $(MSBuildProjectName.Contains('Test')) $(MsBuildProjectName.Contains('Benchmark')) + + + + https://github.com/mycsharp/HttpUserAgentParser + true + HTTP User Agent Parser for .NET + 2.12 false + UserAgent, User Agent, Parse, Browser, Client, Detector, Detection, Console, ASP, Desktop, Mobile + true + + + + 12.0 + enable + enable true @@ -35,5 +47,5 @@ - + diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100644 index 0000000..e08352f --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,41 @@ + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers + + + \ No newline at end of file diff --git a/LICENSE b/LICENSE index 1d69c4c..11152f9 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 MyCSharp +Copyright (c) 2021-2023 MyCSharp Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/MyCSharp.HttpUserAgentParser.sln b/MyCSharp.HttpUserAgentParser.sln index e4c4eb0..d1dc0c3 100644 --- a/MyCSharp.HttpUserAgentParser.sln +++ b/MyCSharp.HttpUserAgentParser.sln @@ -25,6 +25,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_", "_", "{5738CE0D-5E6E-47 .gitignore = .gitignore .github\workflows\ci.yml = .github\workflows\ci.yml Directory.Build.props = Directory.Build.props + Directory.Packages.props = Directory.Packages.props + global.json = global.json LICENSE = LICENSE NuGet.config = NuGet.config README.md = README.md @@ -35,7 +37,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "perf", "perf", "{FAAD18A0-E EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MyCSharp.HttpUserAgentParser.Benchmarks", "perf\MyCSharp.HttpUserAgentParser.Benchmarks\MyCSharp.HttpUserAgentParser.Benchmarks.csproj", "{A0D213E9-6408-46D1-AFAF-5096C2F6E027}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyCSharp.HttpUserAgentParser.TestHelpers", "tests\MyCSharp.HttpUserAgentParser.TestHelpers\MyCSharp.HttpUserAgentParser.TestHelpers.csproj", "{165EE915-1A4F-4875-90CE-1A2AE1540AE7}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MyCSharp.HttpUserAgentParser.TestHelpers", "tests\MyCSharp.HttpUserAgentParser.TestHelpers\MyCSharp.HttpUserAgentParser.TestHelpers.csproj", "{165EE915-1A4F-4875-90CE-1A2AE1540AE7}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/README.md b/README.md index c764529..6ce902b 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ by [@BenjaminAbt](https://github.com/BenjaminAbt) and [@gfoidl](https://github.c MIT License -Copyright (c) 2021 MyCSharp +Copyright (c) 2021-2023 MyCSharp Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -160,3 +160,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/global.json b/global.json new file mode 100644 index 0000000..48e1c84 --- /dev/null +++ b/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "8.0.100" + } +} diff --git a/perf/MyCSharp.HttpUserAgentParser.Benchmarks/MyCSharp.HttpUserAgentParser.Benchmarks.csproj b/perf/MyCSharp.HttpUserAgentParser.Benchmarks/MyCSharp.HttpUserAgentParser.Benchmarks.csproj index 7052a22..ff255f3 100644 --- a/perf/MyCSharp.HttpUserAgentParser.Benchmarks/MyCSharp.HttpUserAgentParser.Benchmarks.csproj +++ b/perf/MyCSharp.HttpUserAgentParser.Benchmarks/MyCSharp.HttpUserAgentParser.Benchmarks.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net7.0;net8.0 disable @@ -15,18 +15,18 @@ - - + + - - + + + + - - - - + + diff --git a/src/MyCSharp.HttpUserAgentParser.AspNetCore/LICENSE.txt b/src/MyCSharp.HttpUserAgentParser.AspNetCore/LICENSE.txt new file mode 100644 index 0000000..11152f9 --- /dev/null +++ b/src/MyCSharp.HttpUserAgentParser.AspNetCore/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021-2023 MyCSharp + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/MyCSharp.HttpUserAgentParser.AspNetCore/MyCSharp.HttpUserAgentParser.AspNetCore.csproj b/src/MyCSharp.HttpUserAgentParser.AspNetCore/MyCSharp.HttpUserAgentParser.AspNetCore.csproj index ba7fffd..33de36b 100644 --- a/src/MyCSharp.HttpUserAgentParser.AspNetCore/MyCSharp.HttpUserAgentParser.AspNetCore.csproj +++ b/src/MyCSharp.HttpUserAgentParser.AspNetCore/MyCSharp.HttpUserAgentParser.AspNetCore.csproj @@ -3,10 +3,20 @@ HTTP User Agent Parser Extensions for ASP.NET Core HTTP User Agent Parser Extensions for ASP.NET Core - net6.0 + net7.0;net8.0 + + + true + readme.md + LICENSE.txt + + + + + diff --git a/src/MyCSharp.HttpUserAgentParser.AspNetCore/readme.md b/src/MyCSharp.HttpUserAgentParser.AspNetCore/readme.md new file mode 100644 index 0000000..2cf587b --- /dev/null +++ b/src/MyCSharp.HttpUserAgentParser.AspNetCore/readme.md @@ -0,0 +1,5 @@ +# MyCSharp.HttpUserAgentParser + +Parsing HTTP User Agents with .NET + +https://github.com/mycsharp/HttpUserAgentParser diff --git a/src/MyCSharp.HttpUserAgentParser.MemoryCache/LICENSE.txt b/src/MyCSharp.HttpUserAgentParser.MemoryCache/LICENSE.txt new file mode 100644 index 0000000..11152f9 --- /dev/null +++ b/src/MyCSharp.HttpUserAgentParser.MemoryCache/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021-2023 MyCSharp + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/MyCSharp.HttpUserAgentParser.MemoryCache/MyCSharp.HttpUserAgentParser.MemoryCache.csproj b/src/MyCSharp.HttpUserAgentParser.MemoryCache/MyCSharp.HttpUserAgentParser.MemoryCache.csproj index 611c0bb..49b2866 100644 --- a/src/MyCSharp.HttpUserAgentParser.MemoryCache/MyCSharp.HttpUserAgentParser.MemoryCache.csproj +++ b/src/MyCSharp.HttpUserAgentParser.MemoryCache/MyCSharp.HttpUserAgentParser.MemoryCache.csproj @@ -3,17 +3,23 @@ HTTP User Agent Parser Extensions for IMemoryCache HTTP User Agent Parser Extensions for IMemoryCache - netstandard2.0;netstandard2.1;net6.0 + net7.0;net8.0 + + + true + readme.md + LICENSE.txt - - + + + - - + + diff --git a/src/MyCSharp.HttpUserAgentParser.MemoryCache/readme.md b/src/MyCSharp.HttpUserAgentParser.MemoryCache/readme.md new file mode 100644 index 0000000..2cf587b --- /dev/null +++ b/src/MyCSharp.HttpUserAgentParser.MemoryCache/readme.md @@ -0,0 +1,5 @@ +# MyCSharp.HttpUserAgentParser + +Parsing HTTP User Agents with .NET + +https://github.com/mycsharp/HttpUserAgentParser diff --git a/src/MyCSharp.HttpUserAgentParser/LICENSE.txt b/src/MyCSharp.HttpUserAgentParser/LICENSE.txt new file mode 100644 index 0000000..11152f9 --- /dev/null +++ b/src/MyCSharp.HttpUserAgentParser/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021-2023 MyCSharp + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/MyCSharp.HttpUserAgentParser/MyCSharp.HttpUserAgentParser.csproj b/src/MyCSharp.HttpUserAgentParser/MyCSharp.HttpUserAgentParser.csproj index 97c6d32..ca4bc1c 100644 --- a/src/MyCSharp.HttpUserAgentParser/MyCSharp.HttpUserAgentParser.csproj +++ b/src/MyCSharp.HttpUserAgentParser/MyCSharp.HttpUserAgentParser.csproj @@ -3,17 +3,23 @@ HTTP User Agent Parser Parses user agents for Browser, Platform and Bots. - netstandard2.0;netstandard2.1;net6.0 + net7.0;net8.0 + + + true + readme.md + LICENSE.txt - - + + + - - + + diff --git a/src/MyCSharp.HttpUserAgentParser/readme.md b/src/MyCSharp.HttpUserAgentParser/readme.md new file mode 100644 index 0000000..2cf587b --- /dev/null +++ b/src/MyCSharp.HttpUserAgentParser/readme.md @@ -0,0 +1,5 @@ +# MyCSharp.HttpUserAgentParser + +Parsing HTTP User Agents with .NET + +https://github.com/mycsharp/HttpUserAgentParser diff --git a/src/NetStandard2.0-Shim.cs b/src/NetStandard2.0-Shim.cs deleted file mode 100644 index 31fa68f..0000000 --- a/src/NetStandard2.0-Shim.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright © myCSharp.de - all rights reserved - -namespace System.Diagnostics.CodeAnalysis -{ - [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] - internal sealed class NotNullWhenAttribute : Attribute - { - public NotNullWhenAttribute(bool returnValue) => this.ReturnValue = returnValue; - - public bool ReturnValue { get; } - } -} - -namespace MyCSharp.HttpUserAgentParser -{ - using System; - using System.Collections.Generic; - - internal static class Extensions - { - public static void Deconstruct(this KeyValuePair kvp, out TKey key, out TValue value) - { - key = kvp.Key; - value = kvp.Value; - } - - public static bool Contains(this string instance, string value, StringComparison comparison) - => instance.IndexOf(value, comparison) >= 0; - } -} diff --git a/tests/MyCSharp.HttpUserAgentParser.AspNetCore.UnitTests/MyCSharp.HttpUserAgentParser.AspNetCore.UnitTests.csproj b/tests/MyCSharp.HttpUserAgentParser.AspNetCore.UnitTests/MyCSharp.HttpUserAgentParser.AspNetCore.UnitTests.csproj index 75a3204..f979669 100644 --- a/tests/MyCSharp.HttpUserAgentParser.AspNetCore.UnitTests/MyCSharp.HttpUserAgentParser.AspNetCore.UnitTests.csproj +++ b/tests/MyCSharp.HttpUserAgentParser.AspNetCore.UnitTests/MyCSharp.HttpUserAgentParser.AspNetCore.UnitTests.csproj @@ -2,20 +2,21 @@ Exe - net6.0 + net7.0;net8.0 - - - - - - + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/MyCSharp.HttpUserAgentParser.MemoryCache.UnitTests/MyCSharp.HttpUserAgentParser.MemoryCache.UnitTests.csproj b/tests/MyCSharp.HttpUserAgentParser.MemoryCache.UnitTests/MyCSharp.HttpUserAgentParser.MemoryCache.UnitTests.csproj index 68858e3..ebbb18b 100644 --- a/tests/MyCSharp.HttpUserAgentParser.MemoryCache.UnitTests/MyCSharp.HttpUserAgentParser.MemoryCache.UnitTests.csproj +++ b/tests/MyCSharp.HttpUserAgentParser.MemoryCache.UnitTests/MyCSharp.HttpUserAgentParser.MemoryCache.UnitTests.csproj @@ -2,20 +2,21 @@ Exe - net6.0 + net7.0;net8.0 - - - - - - + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/MyCSharp.HttpUserAgentParser.TestHelpers/MyCSharp.HttpUserAgentParser.TestHelpers.csproj b/tests/MyCSharp.HttpUserAgentParser.TestHelpers/MyCSharp.HttpUserAgentParser.TestHelpers.csproj index 75a5701..b075017 100644 --- a/tests/MyCSharp.HttpUserAgentParser.TestHelpers/MyCSharp.HttpUserAgentParser.TestHelpers.csproj +++ b/tests/MyCSharp.HttpUserAgentParser.TestHelpers/MyCSharp.HttpUserAgentParser.TestHelpers.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0;net8.0 @@ -9,9 +9,9 @@ - - - + + + diff --git a/tests/MyCSharp.HttpUserAgentParser.UnitTests/HttpUserAgentParserTests.cs b/tests/MyCSharp.HttpUserAgentParser.UnitTests/HttpUserAgentParserTests.cs index 9867023..dbb952a 100644 --- a/tests/MyCSharp.HttpUserAgentParser.UnitTests/HttpUserAgentParserTests.cs +++ b/tests/MyCSharp.HttpUserAgentParser.UnitTests/HttpUserAgentParserTests.cs @@ -55,7 +55,7 @@ public class HttpUserAgentParserTests [InlineData("Mozilla/5.0 (Macintosh; Intel Mac OS X 11_3_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36 OPR/76.0.4017.107", "Opera", "76.0.4017.107", "Mac OS X", HttpUserAgentPlatformType.MacOS, null)] [InlineData("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36 OPR/76.0.4017.107", "Opera", "76.0.4017.107", "Linux", HttpUserAgentPlatformType.Linux, null)] [InlineData("Mozilla/5.0 (Linux; Android 10; VOG-L29) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.210 Mobile Safari/537.36 OPR/63.0.3216.58473", "Opera", "63.0.3216.58473", "Android", HttpUserAgentPlatformType.Android, "Android")] - public void BrowserTests(string ua, string name, string version, string platformName, HttpUserAgentPlatformType platformType, string mobileDeviceType) + public void BrowserTests(string ua, string name, string version, string platformName, HttpUserAgentPlatformType platformType, string? mobileDeviceType) { HttpUserAgentInformation uaInfo = HttpUserAgentInformation.Parse(ua); diff --git a/tests/MyCSharp.HttpUserAgentParser.UnitTests/MyCSharp.HttpUserAgentParser.UnitTests.csproj b/tests/MyCSharp.HttpUserAgentParser.UnitTests/MyCSharp.HttpUserAgentParser.UnitTests.csproj index 56815d6..8162c30 100644 --- a/tests/MyCSharp.HttpUserAgentParser.UnitTests/MyCSharp.HttpUserAgentParser.UnitTests.csproj +++ b/tests/MyCSharp.HttpUserAgentParser.UnitTests/MyCSharp.HttpUserAgentParser.UnitTests.csproj @@ -1,21 +1,22 @@ - + Exe - net6.0 + net7.0;net8.0 - - - - - - + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/version.json b/version.json index 5d8a5d4..8c23c13 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "2.0", + "version": "3.0", "nugetPackageVersion": { "semVer": 1 // optional. Set to either 1 or 2 to control how the NuGet package version string is generated. Default is 1. },