diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index fa370ba..9bb420f 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -8,11 +8,14 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup .NET Core - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v4 with: - dotnet-version: '3.1.x' + dotnet-version: | + 6.0 + 7.0 + 8.0 - name: Install dependencies run: dotnet restore - name: Build diff --git a/ConsoleAppExample/ConsoleAppExample.csproj b/ConsoleAppExample/ConsoleAppExample.csproj index c336957..280393e 100644 --- a/ConsoleAppExample/ConsoleAppExample.csproj +++ b/ConsoleAppExample/ConsoleAppExample.csproj @@ -2,7 +2,8 @@ Exe - netcoreapp3.1 + netcoreapp3.1;netstandard2.0 + 7.1 diff --git a/FeatureHubSDK/FeatureHubSDK.csproj b/FeatureHubSDK/FeatureHubSDK.csproj index 1f82eb0..1de0d58 100644 --- a/FeatureHubSDK/FeatureHubSDK.csproj +++ b/FeatureHubSDK/FeatureHubSDK.csproj @@ -1,7 +1,6 @@ - netstandard2.0 FeatureHub Client .NET SDK FeatureHub IO MIT @@ -16,24 +15,26 @@ https://github.com/featurehub-io/featurehub-dotnet-sdk git FeatureFlags FeatureToggles SDK Flags Toggles RemoteConfig - 2.5.0 - EventSource library dependency update. - 2.5.0 - 2.5.0 + 3.0.0 - EventSource library dependency update. + 3.0.0 + 3.0.0 + 7.1 + netcoreapp3.1;netstandard2.0 - - - + + + - - - + + + - + diff --git a/FeatureHubSDK/StrategyMatchers.cs b/FeatureHubSDK/StrategyMatchers.cs index 13d2eee..57fc06c 100644 --- a/FeatureHubSDK/StrategyMatchers.cs +++ b/FeatureHubSDK/StrategyMatchers.cs @@ -7,12 +7,10 @@ using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; -using FeatureHubSDK; using IO.FeatureHub.SSE.Model; using Murmur; using NodaTime; using NodaTime.Text; -using Version = SemVer.Version; namespace FeatureHubSDK { @@ -23,7 +21,7 @@ public interface IPercentageCalculator public class PercentageMurmur3Calculator : IPercentageCalculator, IDisposable { - public static int MAX_PERCENTAGE = 1000000; + private static int MAX_PERCENTAGE = 1000000; private readonly HashAlgorithm _hashAlgorithm; public PercentageMurmur3Calculator() @@ -52,8 +50,8 @@ public class Applied public Applied(bool matched, object value) { - this.Matched = matched; - this.Value = value; + Matched = matched; + Value = value; } } @@ -103,7 +101,7 @@ public Applied Apply(List strategies, string key, Guid f int useBasePercentage = (rsi.Attributes == null || rsi.Attributes.Count == 0) ? basePercentageVal : 0; // if the percentage is lower than the user's key + // id of feature value then apply it - if (percentage <= (useBasePercentage + rsi.Percentage)) + if (percentage <= useBasePercentage + rsi.Percentage) { if (rsi.Attributes != null && rsi.Attributes.Count != 0) { @@ -121,7 +119,7 @@ public Applied Apply(List strategies, string key, Guid f // this was only a percentage and had no other attributes if (rsi.Attributes == null || rsi.Attributes.Count == 0) { - basePercentage[percentageKey] = basePercentage[percentageKey] + rsi.Percentage; + basePercentage[percentageKey] += rsi.Percentage; } } @@ -256,7 +254,7 @@ public bool Match(string suppliedValue, FeatureRolloutStrategyAttribute attr) if (attr.Conditional == RolloutStrategyAttributeConditional.EQUALS) { - return val == (attr.Values[0] is bool ? ((bool) attr.Values[0]) : bool.Parse(attr.Values[0].ToString())); + return val == (attr.Values[0] is bool ? (bool) attr.Values[0] : bool.Parse(attr.Values[0].ToString())); } if (attr.Conditional == RolloutStrategyAttributeConditional.NOTEQUALS) @@ -383,7 +381,7 @@ internal class NumberMatcher : IStrategyMatcher public bool Match(string suppliedValue, FeatureRolloutStrategyAttribute attr) { - this._attr = attr; + _attr = attr; var dec = decimal.Parse(suppliedValue); switch (attr.Conditional) @@ -420,8 +418,8 @@ internal class SemanticVersionMatcher : IStrategyMatcher { public bool Match(string suppliedValue, FeatureRolloutStrategyAttribute attr) { - var vals = attr.Values.Where(v => v != null).Select(v => new Version(v.ToString())).ToList(); - var version = new Version(suppliedValue); + var vals = attr.Values.Where(v => v != null).Select(v => new SemanticVersioning.Version(v.ToString())).ToList(); + var version = new SemanticVersioning.Version(suppliedValue); switch (attr.Conditional) { @@ -479,7 +477,7 @@ public bool Match(string suppliedValue, FeatureRolloutStrategyAttribute attr) internal class IPNetworkProxy { private IPAddress _address; - private IPNetwork _network; + private IPNetwork2 _network; private bool _isAddress; public IPNetworkProxy(string addr) @@ -488,7 +486,7 @@ public IPNetworkProxy(string addr) { // it is a CIDR _isAddress = false; - _network = IPNetwork.Parse(addr); + _network = IPNetwork2.Parse(addr); } else { diff --git a/FeatureHubTest/FeatureHubTest.csproj b/FeatureHubTest/FeatureHubTest.csproj index b2dee0c..c7c329a 100644 --- a/FeatureHubTest/FeatureHubTest.csproj +++ b/FeatureHubTest/FeatureHubTest.csproj @@ -1,9 +1,12 @@ - netcoreapp3.1 false + + 7.1 + + netcoreapp3.1;netstandard2.0