diff --git a/.github/workflows/test_and_build.yml b/.github/workflows/test_and_build.yml index dbc788fb..c0c0f7b8 100644 --- a/.github/workflows/test_and_build.yml +++ b/.github/workflows/test_and_build.yml @@ -151,7 +151,7 @@ jobs: run: sed -i "s|%%CS2VERSION%%|1.39.6.5/13965 9842|g" ./release.json; - name: replace METAMODVERSION variable in meta files run: sed -i "s|%%METAMODVERSION%%|2.0 - 1256|g" ./release.json; - - name: upload artefact + - name: upload artifact if: github.event_name != 'pull_request' uses: actions/upload-artifact@v4 with: @@ -220,7 +220,7 @@ jobs: - name: move package run: mv PugSharp_with_cssharp_and_runtime_linux_$PUGSHARPNETVER.zip ../ working-directory: ./packagebuild - - name: upload artefact + - name: upload artifact if: github.event_name != 'pull_request' uses: actions/upload-artifact@v4 with: @@ -228,7 +228,7 @@ jobs: path: | ./PugSharp_linux_*.zip retention-days: 10 - - name: upload artefact + - name: upload artifact if: github.event_name != 'pull_request' uses: actions/upload-artifact@v4 with: @@ -236,7 +236,7 @@ jobs: path: | ./PugSharp_with_cssharp_linux_*.zip retention-days: 10 - - name: upload artefact + - name: upload artifact if: github.event_name != 'pull_request' uses: actions/upload-artifact@v4 with: @@ -318,7 +318,7 @@ jobs: shell: bash run: mv PugSharp_with_cssharp_and_runtime_windows_$PUGSHARPNETVER.zip ../ working-directory: ./packagebuild - - name: upload artefact + - name: upload artifact if: github.event_name != 'pull_request' uses: actions/upload-artifact@v4 with: @@ -326,7 +326,7 @@ jobs: path: | ./PugSharp_windows_*.zip retention-days: 10 - - name: upload artefact + - name: upload artifact if: github.event_name != 'pull_request' uses: actions/upload-artifact@v4 with: @@ -334,7 +334,7 @@ jobs: path: | ./PugSharp_with_cssharp_windows_*.zip retention-days: 10 - - name: upload artefact + - name: upload artifact if: github.event_name != 'pull_request' uses: actions/upload-artifact@v4 with: diff --git a/Directory.Build.props b/Directory.Build.props index 6e6b09f1..32d145c2 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -6,7 +6,7 @@ - + all runtime; build; native; contentfiles; analyzers diff --git a/PugSharp.Api.Contract/PugSharp.Api.Contract.csproj b/PugSharp.Api.Contract/PugSharp.Api.Contract.csproj index db7eba58..80ec2085 100644 --- a/PugSharp.Api.Contract/PugSharp.Api.Contract.csproj +++ b/PugSharp.Api.Contract/PugSharp.Api.Contract.csproj @@ -1,23 +1,14 @@  - - - net7.0 - enable - enable - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers - - - + + net7.0 + enable + enable + + + + + + + + diff --git a/PugSharp.Api.G5Api.Tests/PugSharp.Api.G5Api.Tests.csproj b/PugSharp.Api.G5Api.Tests/PugSharp.Api.G5Api.Tests.csproj index cf8b6255..fcf20f89 100644 --- a/PugSharp.Api.G5Api.Tests/PugSharp.Api.G5Api.Tests.csproj +++ b/PugSharp.Api.G5Api.Tests/PugSharp.Api.G5Api.Tests.csproj @@ -1,39 +1,28 @@ - - + net7.0 enable enable - false true - + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + - - - - - all - runtime; build; native; contentfiles; analyzers - - - diff --git a/PugSharp.Api.G5Api/PugSharp.Api.G5Api.csproj b/PugSharp.Api.G5Api/PugSharp.Api.G5Api.csproj index 3de26ab6..dfcdb3f1 100644 --- a/PugSharp.Api.G5Api/PugSharp.Api.G5Api.csproj +++ b/PugSharp.Api.G5Api/PugSharp.Api.G5Api.csproj @@ -1,5 +1,4 @@  - net7.0 enable @@ -7,20 +6,12 @@ - - + + - - + + - - - - all - runtime; build; native; contentfiles; analyzers - - - diff --git a/PugSharp.Api.Json/PugSharp.Api.Json.csproj b/PugSharp.Api.Json/PugSharp.Api.Json.csproj index 5a48403f..c4749e21 100644 --- a/PugSharp.Api.Json/PugSharp.Api.Json.csproj +++ b/PugSharp.Api.Json/PugSharp.Api.Json.csproj @@ -1,27 +1,18 @@ - + + + net7.0 + enable + enable + - - net7.0 - enable - enable - - - - - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers - - + + + + + + + + + diff --git a/PugSharp.ApiStats/ApiStats.cs b/PugSharp.ApiStats/ApiStats.cs index 074318f1..2b5447de 100644 --- a/PugSharp.ApiStats/ApiStats.cs +++ b/PugSharp.ApiStats/ApiStats.cs @@ -1,6 +1,6 @@ using System.Globalization; +using System.Web; -using Microsoft.AspNetCore.WebUtilities; using Microsoft.Extensions.Logging; using PugSharp.Api.Contract; @@ -42,7 +42,7 @@ public async Task GoingLiveAsync(GoingLiveParams goingLiveParams, CancellationTo {ApiStatsConstants.StatsMapName, goingLiveParams.MapName}, }; - var uri = QueryHelpers.AddQueryString(string.Create(CultureInfo.InvariantCulture, $"golive/{goingLiveParams.MapNumber}"), queryParams); + var uri = AppendQuery(string.Create(CultureInfo.InvariantCulture, $"golive/{goingLiveParams.MapNumber}"), queryParams); var response = await HttpClient.PostAsync(uri, content: null, cancellationToken).ConfigureAwait(false); @@ -69,7 +69,7 @@ public async Task RoundStatsUpdateAsync(RoundStatusUpdateParams roundStatusUpdat {"team2score", CreateIntParam(roundStatusUpdateParams.CurrentMap.Team2.Score)}, }; - var uri = QueryHelpers.AddQueryString(string.Create(CultureInfo.InvariantCulture, $"updateround/{roundStatusUpdateParams.MapNumber}"), queryParams); + var uri = AppendQuery(string.Create(CultureInfo.InvariantCulture, $"updateround/{roundStatusUpdateParams.MapNumber}"), queryParams); var response = await HttpClient.PostAsync(uri, content: null, cancellationToken).ConfigureAwait(false); @@ -105,7 +105,7 @@ public async Task FinalizeMapAsync(MapResultParams finalizeMapParams, Cancellati {ApiStatsConstants.StatsMapWinner, finalizeMapParams.WinnerTeamName}, }; - var uri = QueryHelpers.AddQueryString(string.Create(CultureInfo.InvariantCulture, $"finalize/{finalizeMapParams.MapNumber}"), queryParams); + var uri = AppendQuery(string.Create(CultureInfo.InvariantCulture, $"finalize/{finalizeMapParams.MapNumber}"), queryParams); var response = await HttpClient.PostAsync(uri, content: null, cancellationToken).ConfigureAwait(false); @@ -130,7 +130,7 @@ public async Task FinalizeAsync(SeriesResultParams seriesResultParams, Cancellat {ApiStatsConstants.StatsSeriesForfeit, CreateIntParam(Convert.ToInt32(seriesResultParams.Forfeit))}, }; - var uri = QueryHelpers.AddQueryString($"finalize", queryParams); + var uri = AppendQuery(string.Create(CultureInfo.InvariantCulture, $"finalize"), queryParams); var response = await HttpClient.PostAsync(uri, content: null, cancellationToken).ConfigureAwait(false); @@ -179,7 +179,7 @@ private async Task UpdatePlayerStatsInternalAsync(int mapNumber, ITeamInfo teamI Dictionary queryParams = CreateUpdatePlayerQueryParameters(teamName, playerStatistics); - var uri = QueryHelpers.AddQueryString(string.Create(CultureInfo.InvariantCulture, $"updateplayer/{mapNumber}/{player.Key}"), queryParams); + var uri = AppendQuery(string.Create(CultureInfo.InvariantCulture, $"updateplayer/{mapNumber}/{player.Key}"), queryParams); var response = await HttpClient.PostAsync(uri, content: null, cancellationToken).ConfigureAwait(false); @@ -235,6 +235,17 @@ internal static string CreateIntParam(int param) return param.ToString(CultureInfo.InvariantCulture); } + internal static string AppendQuery(string baseUri, Dictionary queryParams) + { + var query = HttpUtility.ParseQueryString(string.Empty); + foreach (var dict in queryParams) + { + query[dict.Key] = dict.Value; + } + + return string.Join('?', baseUri.TrimEnd('/').TrimEnd('?'), query.ToString()); + } + private static class ApiStatsConstants { #pragma warning disable S125 // Sections of code should not be commented out diff --git a/PugSharp.ApiStats/BaseApi.cs b/PugSharp.ApiStats/BaseApi.cs index 7f9414e1..97948bce 100644 --- a/PugSharp.ApiStats/BaseApi.cs +++ b/PugSharp.ApiStats/BaseApi.cs @@ -1,5 +1,6 @@ -using Microsoft.Extensions.Logging; -using Microsoft.Net.Http.Headers; +using System.Net; + +using Microsoft.Extensions.Logging; namespace PugSharp.ApiStats; @@ -33,11 +34,11 @@ protected void InitializeBase(string? baseUrl, string? authKey) HttpClient.BaseAddress = new Uri(baseUrl); - HttpClient.DefaultRequestHeaders.Remove(HeaderNames.Authorization); + HttpClient.DefaultRequestHeaders.Remove(nameof(HttpRequestHeader.Authorization)); if (!string.IsNullOrEmpty(authKey)) { - HttpClient.DefaultRequestHeaders.Add(HeaderNames.Authorization, authKey); + HttpClient.DefaultRequestHeaders.Add(nameof(HttpRequestHeader.Authorization), authKey); } } catch (Exception ex) diff --git a/PugSharp.ApiStats/PugSharp.ApiStats.csproj b/PugSharp.ApiStats/PugSharp.ApiStats.csproj index 4827cd43..bce4ba35 100644 --- a/PugSharp.ApiStats/PugSharp.ApiStats.csproj +++ b/PugSharp.ApiStats/PugSharp.ApiStats.csproj @@ -1,5 +1,4 @@  - net7.0 enable @@ -7,20 +6,14 @@ - - + + - - + - - all - runtime; build; native; contentfiles; analyzers - - - + \ No newline at end of file diff --git a/PugSharp.Config/ConfigProvider.cs b/PugSharp.Config/ConfigProvider.cs index d82419ff..5cffb6e2 100644 --- a/PugSharp.Config/ConfigProvider.cs +++ b/PugSharp.Config/ConfigProvider.cs @@ -1,7 +1,7 @@ -using System.Text.Json; +using System.Net; +using System.Text.Json; using Microsoft.Extensions.Logging; -using Microsoft.Net.Http.Headers; using OneOf; using OneOf.Types; @@ -72,7 +72,7 @@ public async Task, MatchConfig>> LoadMatchConfigFromUrlAsync if (!string.IsNullOrEmpty(authToken)) { - httpRequestMessage.Headers.Add(HeaderNames.Authorization, authToken); + httpRequestMessage.Headers.Add(nameof(HttpRequestHeader.Authorization), authToken); } var response = await _HttpClient.SendAsync(httpRequestMessage).ConfigureAwait(false); diff --git a/PugSharp.Config/PugSharp.Config.csproj b/PugSharp.Config/PugSharp.Config.csproj index 2d7dd270..5f037928 100644 --- a/PugSharp.Config/PugSharp.Config.csproj +++ b/PugSharp.Config/PugSharp.Config.csproj @@ -1,5 +1,4 @@  - net7.0 enable @@ -8,18 +7,9 @@ - + - - - - - all - runtime; build; native; contentfiles; analyzers - - - diff --git a/PugSharp.DebugDummy/Program.cs b/PugSharp.DebugDummy/Program.cs index 3751555c..3ed0e5d7 100644 --- a/PugSharp.DebugDummy/Program.cs +++ b/PugSharp.DebugDummy/Program.cs @@ -1,2 +1,3 @@ // See https://aka.ms/new-console-template for more information Console.WriteLine("Hello, World!"); + diff --git a/PugSharp.DebugDummy/PugSharp.DebugDummy.csproj b/PugSharp.DebugDummy/PugSharp.DebugDummy.csproj index 3adac1b5..0e7429c8 100644 --- a/PugSharp.DebugDummy/PugSharp.DebugDummy.csproj +++ b/PugSharp.DebugDummy/PugSharp.DebugDummy.csproj @@ -1,33 +1,21 @@  - - - Exe - net7.0 - enable - enable - - + + Exe + net7.0 + enable + enable + false ..\cs2\game\csgo\addons\counterstrikesharp\plugins\PugSharp\ - - + + - - - - - - - - all - runtime; build; native; contentfiles; analyzers - + - diff --git a/PugSharp.Match.Contract/PugSharp.Match.Contract.csproj b/PugSharp.Match.Contract/PugSharp.Match.Contract.csproj index 5a48403f..10308871 100644 --- a/PugSharp.Match.Contract/PugSharp.Match.Contract.csproj +++ b/PugSharp.Match.Contract/PugSharp.Match.Contract.csproj @@ -1,27 +1,18 @@ + + net7.0 + enable + enable + - - net7.0 - enable - enable - - - - - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers - - + + + + + + + + + diff --git a/PugSharp.Match.Tests/PugSharp.Match.Tests.csproj b/PugSharp.Match.Tests/PugSharp.Match.Tests.csproj index 2015e2d4..84e29b63 100644 --- a/PugSharp.Match.Tests/PugSharp.Match.Tests.csproj +++ b/PugSharp.Match.Tests/PugSharp.Match.Tests.csproj @@ -1,41 +1,29 @@ - - + net7.0 enable enable - false true - - + + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all - - - - - - all - runtime; build; native; contentfiles; analyzers - - - diff --git a/PugSharp.Match/PugSharp.Match.csproj b/PugSharp.Match/PugSharp.Match.csproj index 525f14b2..3f1baa6d 100644 --- a/PugSharp.Match/PugSharp.Match.csproj +++ b/PugSharp.Match/PugSharp.Match.csproj @@ -1,5 +1,4 @@  - net7.0 enable @@ -8,7 +7,7 @@ - + @@ -22,12 +21,4 @@ - - - - all - runtime; build; native; contentfiles; analyzers - - - diff --git a/PugSharp.Server.Contract/PugSharp.Server.Contract.csproj b/PugSharp.Server.Contract/PugSharp.Server.Contract.csproj index 97f02718..8f1b748d 100644 --- a/PugSharp.Server.Contract/PugSharp.Server.Contract.csproj +++ b/PugSharp.Server.Contract/PugSharp.Server.Contract.csproj @@ -1,27 +1,18 @@ - + + + net7.0 + enable + enable + - - net7.0 - enable - enable - - - - - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers - - + + + + + + + + + diff --git a/PugSharp.Shared/PugSharp.Shared.csproj b/PugSharp.Shared/PugSharp.Shared.csproj index 0c044c91..4a532aa4 100644 --- a/PugSharp.Shared/PugSharp.Shared.csproj +++ b/PugSharp.Shared/PugSharp.Shared.csproj @@ -1,5 +1,4 @@  - net7.0 enable @@ -9,16 +8,8 @@ - + - - - - all - runtime; build; native; contentfiles; analyzers - - - diff --git a/PugSharp.Translation/PugSharp.Translation.csproj b/PugSharp.Translation/PugSharp.Translation.csproj index 404012ea..d97da212 100644 --- a/PugSharp.Translation/PugSharp.Translation.csproj +++ b/PugSharp.Translation/PugSharp.Translation.csproj @@ -1,5 +1,4 @@  - net7.0 enable @@ -8,10 +7,10 @@ - - - - + + + + @@ -28,12 +27,4 @@ Resources.Designer.cs - - - - all - runtime; build; native; contentfiles; analyzers - - - diff --git a/PugSharp/PugSharp.csproj b/PugSharp/PugSharp.csproj index 721f8621..cb1573ee 100644 --- a/PugSharp/PugSharp.csproj +++ b/PugSharp/PugSharp.csproj @@ -7,20 +7,14 @@ - - + none runtime compile; build; native; contentfiles; analyzers; buildtransitive - - - + - - @@ -31,12 +25,4 @@ - - - - all - runtime; build; native; contentfiles; analyzers - - -