diff --git a/Directory.Build.props b/Directory.Build.props index b736c47..8cee08b 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,4 +1,5 @@ + 2.12 MyCSharp.de, Benjamin Abt, Günther Foidl and Contributors @@ -15,9 +16,18 @@ $(MSBuildProjectName.Contains('Test')) $(MsBuildProjectName.Contains('Benchmark')) false + true true + + + true + $(MSBuildThisFileDirectory)MyCSharp.HttpUserAgentParser.snk + + 00240000048000009400000006020000002400005253413100040000010001003d5c022c088a46d41d5a5bf7591f3a3dcba30f76b0f43a312b6e45bb419d32283175cbd8bfd83134b123da6db83479e50596fb6bbe0e8c6cef50c01c64a0861c963daaf6905920f44ffe1ce44b3cfcb9c23779f34bc90c7b04e74e36a19bb58af3a69456d49b56993969dba9f8e9e935c2757844a11066d1091477f10cd923b7 + + diff --git a/MyCSharp.HttpUserAgentParser.sln b/MyCSharp.HttpUserAgentParser.sln index defb60f..f5e1dd7 100644 --- a/MyCSharp.HttpUserAgentParser.sln +++ b/MyCSharp.HttpUserAgentParser.sln @@ -33,7 +33,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_", "_", "{5738CE0D-5E6E-47 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "perf", "perf", "{FAAD18A0-E1B8-448D-B611-AFBDA8A89808}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyCSharp.HttpUserAgentParser.Benchmarks", "perf\MyCSharp.HttpUserAgentParser.Benchmarks\MyCSharp.HttpUserAgentParser.Benchmarks.csproj", "{A0D213E9-6408-46D1-AFAF-5096C2F6E027}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MyCSharp.HttpUserAgentParser.Benchmarks", "perf\MyCSharp.HttpUserAgentParser.Benchmarks\MyCSharp.HttpUserAgentParser.Benchmarks.csproj", "{A0D213E9-6408-46D1-AFAF-5096C2F6E027}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/MyCSharp.HttpUserAgentParser.snk b/MyCSharp.HttpUserAgentParser.snk new file mode 100644 index 0000000..7617089 Binary files /dev/null and b/MyCSharp.HttpUserAgentParser.snk differ diff --git a/perf/MyCSharp.HttpUserAgentParser.Benchmarks/MyCSharp.HttpUserAgentParser.Benchmarks.csproj b/perf/MyCSharp.HttpUserAgentParser.Benchmarks/MyCSharp.HttpUserAgentParser.Benchmarks.csproj index bfe6d06..801f331 100644 --- a/perf/MyCSharp.HttpUserAgentParser.Benchmarks/MyCSharp.HttpUserAgentParser.Benchmarks.csproj +++ b/perf/MyCSharp.HttpUserAgentParser.Benchmarks/MyCSharp.HttpUserAgentParser.Benchmarks.csproj @@ -10,6 +10,10 @@ $(DefineConstants);OS_WIN + + $(NoWarn);CS8002 + + diff --git a/src/MyCSharp.HttpUserAgentParser.MemoryCache/HttpUserAgentParserMemoryCachedProvider.cs b/src/MyCSharp.HttpUserAgentParser.MemoryCache/HttpUserAgentParserMemoryCachedProvider.cs index e2f221a..a8f8f1d 100644 --- a/src/MyCSharp.HttpUserAgentParser.MemoryCache/HttpUserAgentParserMemoryCachedProvider.cs +++ b/src/MyCSharp.HttpUserAgentParser.MemoryCache/HttpUserAgentParserMemoryCachedProvider.cs @@ -12,6 +12,11 @@ public class HttpUserAgentParserMemoryCachedProvider : IHttpUserAgentParserProvi private readonly IMemoryCache _memoryCache; private readonly HttpUserAgentParserMemoryCachedProviderOptions _options; + /// + /// Creates a new instance of . + /// + /// The memory cache instance to use + /// The options used to set expiration and size limit public HttpUserAgentParserMemoryCachedProvider(IMemoryCache memoryCache, HttpUserAgentParserMemoryCachedProviderOptions options) { _memoryCache = memoryCache; diff --git a/src/MyCSharp.HttpUserAgentParser.MemoryCache/MyCSharp.HttpUserAgentParser.MemoryCache.csproj b/src/MyCSharp.HttpUserAgentParser.MemoryCache/MyCSharp.HttpUserAgentParser.MemoryCache.csproj index dd632d6..1c3a6c9 100644 --- a/src/MyCSharp.HttpUserAgentParser.MemoryCache/MyCSharp.HttpUserAgentParser.MemoryCache.csproj +++ b/src/MyCSharp.HttpUserAgentParser.MemoryCache/MyCSharp.HttpUserAgentParser.MemoryCache.csproj @@ -3,10 +3,14 @@ HTTP User Agent Parser Extensions for IMemoryCache HTTP User Agent Parser Extensions for IMemoryCache - netstandard2.1 + netstandard2.0;netstandard2.1 true + + + + diff --git a/src/MyCSharp.HttpUserAgentParser/MyCSharp.HttpUserAgentParser.csproj b/src/MyCSharp.HttpUserAgentParser/MyCSharp.HttpUserAgentParser.csproj index b07b831..86f0545 100644 --- a/src/MyCSharp.HttpUserAgentParser/MyCSharp.HttpUserAgentParser.csproj +++ b/src/MyCSharp.HttpUserAgentParser/MyCSharp.HttpUserAgentParser.csproj @@ -3,10 +3,14 @@ HTTP User Agent Parser Parses user agents for Browser, Platform and Bots. - netstandard2.1 + netstandard2.0;netstandard2.1 true + + + + diff --git a/src/NetStandard2.0-Shim.cs b/src/NetStandard2.0-Shim.cs new file mode 100644 index 0000000..74653c4 --- /dev/null +++ b/src/NetStandard2.0-Shim.cs @@ -0,0 +1,30 @@ +// Copyright © myCSharp 2020-2021, 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; + } +}