From c7f1b542024b8cd515e1401311eee20b206a7817 Mon Sep 17 00:00:00 2001 From: Thiago Zimmermann <13345912+thiago-dev@users.noreply.github.com> Date: Sun, 18 Sep 2022 04:04:03 +0200 Subject: [PATCH 01/13] Migrate to netstandard 2.0 --- Migrations/MigrationConfiguration.cs | 32 ---- NFive.SDK.Server.csproj | 219 ++++----------------------- Storage/EFContext.cs | 51 ++++--- packages.config | 23 --- 4 files changed, 59 insertions(+), 266 deletions(-) delete mode 100644 Migrations/MigrationConfiguration.cs delete mode 100644 packages.config diff --git a/Migrations/MigrationConfiguration.cs b/Migrations/MigrationConfiguration.cs deleted file mode 100644 index 04e15c1..0000000 --- a/Migrations/MigrationConfiguration.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Data.Entity; -using System.Data.Entity.Migrations; -using JetBrains.Annotations; - -namespace NFive.SDK.Server.Migrations -{ - /// - /// - /// Configuration relating to the use of migrations for a given database model. - /// - /// The type of the database context. - [PublicAPI] - public abstract class MigrationConfiguration : DbMigrationsConfiguration where TContext : DbContext - { - /// - /// - /// Initializes a new instance of the class. - /// - protected MigrationConfiguration() - { - this.AutomaticMigrationsEnabled = false; - this.AutomaticMigrationDataLossAllowed = false; - } - - /// - /// - /// Runs after upgrading to the latest migration to allow seed data to be updated. - /// - /// Context to be used for updating seed data. - protected override void Seed(TContext context) { } - } -} diff --git a/NFive.SDK.Server.csproj b/NFive.SDK.Server.csproj index 6df8b81..d68e2ed 100644 --- a/NFive.SDK.Server.csproj +++ b/NFive.SDK.Server.csproj @@ -1,194 +1,37 @@ - - - - + + - Debug - AnyCPU - {603D3FEB-F8DF-45BB-869C-6907125FACCD} - Library - Properties - NFive.SDK.Server + netstandard2.0 + false NFive.SDK.Server.net - v4.5.2 - 512 - - - false - none - false - bin\Debug - DEBUG;TRACE - prompt - 4 - - .allowedextension - - - None - - - - false - none - true - bin\Release - TRACE - prompt - 4 - - .allowedextension - - - None - + NFive.SDK.Server + true + false + + NFive.SDK.Server + NFive + NFive + LGPL-3.0-only + nfive fivem gtav + false + https://github.com/NFive/SDK.Server + https://github.com/NFive/SDK.Server + git + NFive Server SDK for plugins + - - packages\BouncyCastle.1.8.9\lib\BouncyCastle.Crypto.dll - False - - - packages\CitizenFX.Core.Server.1.0.4410\lib\net45\CitizenFX.Core.Server.dll - False - - - packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll - False - - - packages\Google.Protobuf.3.17.3\lib\net45\Google.Protobuf.dll - False - - - packages\JetBrains.Annotations.2021.2.0\lib\net20\JetBrains.Annotations.dll - False - - - packages\K4os.Compression.LZ4.1.2.6\lib\net45\K4os.Compression.LZ4.dll - False - - - packages\K4os.Compression.LZ4.Streams.1.2.6\lib\net45\K4os.Compression.LZ4.Streams.dll - False - - - packages\K4os.Hash.xxHash.1.0.6\lib\net45\K4os.Hash.xxHash.dll - False - - - - packages\MySql.Data.8.0.21\lib\net452\MySql.Data.dll - False - - - packages\MySql.Data.EntityFramework.8.0.21\lib\net452\MySql.Data.EntityFramework.dll - False - - - packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll - False - - - packages\NFive.SDK.Core.0.1.0.62\lib\net452\NFive.SDK.Core.net.dll - False - - - packages\NGettext.0.6.6\lib\net45\NGettext.dll - False - - - packages\SSH.NET.2020.0.1\lib\net40\Renci.SshNet.dll - False - - - - packages\System.Buffers.4.5.1\lib\netstandard1.1\System.Buffers.dll - False - - - - packages\System.Memory.4.5.4\lib\netstandard1.1\System.Memory.dll - False - - - packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll - False - - - packages\MySql.Data.8.0.21\lib\net452\Ubiety.Dns.Core.dll - False - - - packages\Z.EntityFramework.Extensions.5.2.3\lib\net45\Z.EntityFramework.Extensions.dll - False - - - packages\Z.EntityFramework.Plus.EF6.5.2.3\lib\net45\Z.EntityFramework.Plus.EF6.dll - False - - - packages\Z.Expressions.Eval.4.0.46\lib\net45\Z.Expressions.Eval.dll - False - - - packages\MySql.Data.8.0.21\lib\net452\Zstandard.Net.dll - False - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Designer - + + + + + + + + + + + + - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - \ No newline at end of file diff --git a/Storage/EFContext.cs b/Storage/EFContext.cs index 92e1699..ccdcff3 100644 --- a/Storage/EFContext.cs +++ b/Storage/EFContext.cs @@ -1,9 +1,6 @@ -using System; -using System.ComponentModel.DataAnnotations.Schema; -using System.Data.Entity; using System.Linq; using JetBrains.Annotations; -using MySql.Data.EntityFramework; +using Microsoft.EntityFrameworkCore; using NFive.SDK.Server.Configuration; namespace NFive.SDK.Server.Storage @@ -14,30 +11,33 @@ namespace NFive.SDK.Server.Storage /// /// The type of the database context. [PublicAPI] - [DbConfigurationType(typeof(MySqlEFConfiguration))] - public abstract class EFContext : DbContext where TContext : DbContext + public abstract class EFContext : DbContext + where TContext : DbContext { /// /// /// Initializes a new instance of the class. /// - static EFContext() + protected EFContext() + : base(GetOptions(ServerConfiguration.DatabaseConnection)) { - Database.SetInitializer(null); } - /// - /// - /// Initializes a new instance of the class. - /// - protected EFContext() : base(ServerConfiguration.DatabaseConnection) { } - /// /// /// Initializes a new instance of the class. /// /// The MySQL database connection string. - protected EFContext(string connectionString) : base(connectionString) { } + protected EFContext(string connectionString) + : base(GetOptions(connectionString)) + { + + } + + private static DbContextOptions GetOptions(string connectionString) + { + return new DbContextOptionsBuilder().UseMySql(connectionString).Options; + } /// /// @@ -45,20 +45,25 @@ protected EFContext(string connectionString) : base(connectionString) { } /// locked down and used to initialize the context. /// /// The builder that defines the model for the context being created. - protected override void OnModelCreating(DbModelBuilder modelBuilder) + protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); // Store booleans as MySQL BIT type - modelBuilder - .Properties() - .Configure(c => c.HasColumnType("bit")); + foreach (var property in modelBuilder.Model.GetEntityTypes() + .SelectMany(t => t.GetProperties()) + .Where(p => p.ClrType == typeof(bool) && p.GetColumnType() == null)) + { + property.SetColumnType("bit"); + } // Store strings as MySQL VARCHAR type - modelBuilder - .Properties() - .Where(x => x.PropertyType == typeof(string) && !x.GetCustomAttributes(false).OfType().Any(q => q.TypeName != null && q.TypeName.Equals("varchar", StringComparison.InvariantCultureIgnoreCase))) - .Configure(c => c.HasColumnType("varchar")); + foreach (var property in modelBuilder.Model.GetEntityTypes() + .SelectMany(t => t.GetProperties()) + .Where(p => p.ClrType == typeof(string) && p.GetColumnType() == null)) + { + property.SetIsUnicode(false); + } } } } diff --git a/packages.config b/packages.config deleted file mode 100644 index 326c84f..0000000 --- a/packages.config +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From c3b1039866e2b0f425743c8e806df054b4bfde4f Mon Sep 17 00:00:00 2001 From: Thiago Zimmermann <13345912+thiago-dev@users.noreply.github.com> Date: Sun, 18 Sep 2022 04:04:23 +0200 Subject: [PATCH 02/13] Use github actions for ci/cd --- .github/version.yml | 6 +++ .github/workflows/cd.yml | 89 ++++++++++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 62 ++++++++++++++++++++++++++++ NFive.SDK.Server.nuspec | 17 -------- appveyor.yml | 31 -------------- nuget.config | 10 ----- 6 files changed, 157 insertions(+), 58 deletions(-) create mode 100644 .github/version.yml create mode 100644 .github/workflows/cd.yml create mode 100644 .github/workflows/ci.yml delete mode 100644 NFive.SDK.Server.nuspec delete mode 100644 appveyor.yml delete mode 100644 nuget.config diff --git a/.github/version.yml b/.github/version.yml new file mode 100644 index 0000000..a013f09 --- /dev/null +++ b/.github/version.yml @@ -0,0 +1,6 @@ +mode: ContinuousDeployment +branches: + master: + tag: beta + hotfix: + tag: useBranchName \ No newline at end of file diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..2afd731 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,89 @@ +name: Release + +on: + push: + tags: + - "*" + +jobs: + calculate-version: + name: Calculate Version + runs-on: ubuntu-latest + outputs: + semVer: ${{ steps.gitversion.outputs.semVer }} + + steps: + - uses: actions/checkout@v2.4.2 + with: + fetch-depth: 0 + + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v0.9.7 + with: + versionSpec: "5.x" + + - name: Determine Version + id: gitversion + uses: gittools/actions/gitversion/execute@v0.9.7 + with: + useConfigFile: true + configFilePath: ./.github/version.yml + + build: + name: Build and Release + runs-on: windows-latest + needs: calculate-version + env: + SEMVER: ${{ needs.calculate-version.outputs.semVer }} + ZipName: NFive.SDK.Server-${{ needs.calculate-version.outputs.semVer }}.zip + + steps: + - uses: actions/checkout@v2.4.2 + + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v1.1 + + - name: Setup NuGet + uses: NuGet/setup-nuget@v1.0.6 + + - name: Restore dependencies + run: nuget restore NFive.SDK.Server.sln + + - name: Build the solution + run: msbuild NFive.SDK.Server.sln /p:Configuration=Release /p:Outdir=Build + + - uses: vimtor/action-zip@v1 + with: + files: Build/ + dest: ${{ env.ZipName }} + + # Create a Release on the GitHub project + - name: Create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: ${{ env.SEMVER }} + release_name: ${{ env.SEMVER }} + draft: false + prerelease: false + + # Upload the Build Artifact to the Release + - name: Update release asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + asset_path: .\${{ env.ZipName }} + asset_name: ${{ env.ZipName }} + asset_content_type: application/zip + + - name: Pack + run: dotnet pack NFive.SDK.Server.csproj -p:PackageVersion=${{ env.SEMVER }} --configuration Release + + # Push package to nuget.org + - name: Push nuget package + run: dotnet nuget push **/*.nupkg --skip-duplicate --source "https://api.nuget.org/v3/index.json" --api-key ${{secrets.nuget_api_key}} \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..936a38a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,62 @@ +name: CI + +on: + push: + branches: + - "**" + tags: + - "v*.*.*" + pull_request: + branches: + - "**" + +jobs: + calculate-version: + name: Calculate Version + runs-on: ubuntu-latest + outputs: + semVer: ${{ steps.gitversion.outputs.semVer }} + + steps: + - uses: actions/checkout@v2.4.2 + with: + fetch-depth: 0 + + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v0.9.7 + with: + versionSpec: "5.x" + + - name: Determine Version + id: gitversion + uses: gittools/actions/gitversion/execute@v0.9.7 + with: + useConfigFile: true + configFilePath: ./.github/version.yml + + build: + runs-on: windows-latest + needs: calculate-version + env: + SEMVER: ${{ needs.calculate-version.outputs.semVer }} + + steps: + - uses: actions/checkout@v2.4.2 + + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v1.1 + + - name: Setup NuGet + uses: NuGet/setup-nuget@v1.0.6 + + - name: Restore dependencies + run: nuget restore NFive.SDK.Server.sln + + - name: Build the solution + run: msbuild NFive.SDK.Server.sln /p:Configuration=Release /p:Outdir=Build + + - name: Attach Zip as build artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: NFive.SDK.Server-${{ env.SEMVER }} + path: Build \ No newline at end of file diff --git a/NFive.SDK.Server.nuspec b/NFive.SDK.Server.nuspec deleted file mode 100644 index e70074c..0000000 --- a/NFive.SDK.Server.nuspec +++ /dev/null @@ -1,17 +0,0 @@ - - - - NFive.SDK.Server - $version$ - $title$ - NFive - NFive - false - LGPL-3.0-only - https://github.com/NFive/SDK.Server - $description$ - $copyright$ - nfive fivem gtav - - - diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index c1ebccf..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,31 +0,0 @@ -version: 0.1.0.{build} - -image: Visual Studio 2019 -configuration: Release -platform: Any CPU -clone_depth: 1 - -branches: - only: - - master - -cache: -- packages -> packages.config - -test: off - -assembly_info: - patch: true - file: Properties\AssemblyInfo.cs - assembly_version: "{version}" - assembly_file_version: "{version}" - assembly_informational_version: "{version}" - -before_build: -- nuget update -self -- nuget restore - -build: - project: NFive.SDK.Server.sln - verbosity: minimal - publish_nuget: true diff --git a/nuget.config b/nuget.config deleted file mode 100644 index 046928f..0000000 --- a/nuget.config +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file From 58f2b2b433642dd1cb3460acf46aaec3d61b3fff Mon Sep 17 00:00:00 2001 From: Thiago Zimmermann <13345912+thiago-dev@users.noreply.github.com> Date: Sun, 18 Sep 2022 04:59:44 +0200 Subject: [PATCH 03/13] Update dependencies --- NFive.SDK.Server.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NFive.SDK.Server.csproj b/NFive.SDK.Server.csproj index d68e2ed..a1ff16c 100644 --- a/NFive.SDK.Server.csproj +++ b/NFive.SDK.Server.csproj @@ -21,8 +21,8 @@ - - + + From 30267c393522c6453e8399ef76a02c7cbf708c9c Mon Sep 17 00:00:00 2001 From: Thiago Zimmermann <13345912+thiago-dev@users.noreply.github.com> Date: Sun, 18 Sep 2022 05:38:10 +0200 Subject: [PATCH 04/13] Implement Entity Validation --- NFive.SDK.Server.csproj | 1 - Storage/EFContext.cs | 27 +++++++++++++++++++++++++++ Storage/EntityValidationException.cs | 16 ++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 Storage/EntityValidationException.cs diff --git a/NFive.SDK.Server.csproj b/NFive.SDK.Server.csproj index a1ff16c..0aef501 100644 --- a/NFive.SDK.Server.csproj +++ b/NFive.SDK.Server.csproj @@ -23,7 +23,6 @@ - diff --git a/Storage/EFContext.cs b/Storage/EFContext.cs index ccdcff3..057322f 100644 --- a/Storage/EFContext.cs +++ b/Storage/EFContext.cs @@ -1,6 +1,10 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Linq; using JetBrains.Annotations; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; using NFive.SDK.Server.Configuration; namespace NFive.SDK.Server.Storage @@ -65,5 +69,28 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) property.SetIsUnicode(false); } } + + public override int SaveChanges(bool acceptAllChangesOnSuccess) + { + var serviceProvider = this.GetService(); + var items = new Dictionary(); + + foreach (var entry in this.ChangeTracker.Entries().Where(e => (e.State == EntityState.Added) || (e.State == EntityState.Modified))) + { + var entity = entry.Entity; + var context = new ValidationContext(entity, serviceProvider, items); + + var results = new List(); + + if (Validator.TryValidateObject(entity, context, results, true)) continue; + + if (results.Any()) + { + throw new EntityValidationException("Entity Validation failed.", results); + } + } + + return base.SaveChanges(acceptAllChangesOnSuccess); + } } } diff --git a/Storage/EntityValidationException.cs b/Storage/EntityValidationException.cs new file mode 100644 index 0000000..b83605a --- /dev/null +++ b/Storage/EntityValidationException.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace NFive.SDK.Server.Storage +{ + public class EntityValidationException : Exception + { + public IEnumerable ValidationErrors { get; set; } + + public EntityValidationException(string message, IEnumerable validationErrors) : base(message) + { + ValidationErrors = validationErrors; + } + } +} From d67e29fa1531a8b56a7a838a7c1026d5e7e66db5 Mon Sep 17 00:00:00 2001 From: Thiago Zimmermann <13345912+thiago-dev@users.noreply.github.com> Date: Fri, 3 Mar 2023 16:44:40 +0100 Subject: [PATCH 05/13] Update NFive.SDK.Server.csproj --- NFive.SDK.Server.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NFive.SDK.Server.csproj b/NFive.SDK.Server.csproj index 0aef501..4552c99 100644 --- a/NFive.SDK.Server.csproj +++ b/NFive.SDK.Server.csproj @@ -22,7 +22,7 @@ - + From 46dff55217792cbcbfee8db5778725717d1f8730 Mon Sep 17 00:00:00 2001 From: all-in-simplicity <13345912+all-in-simplicity@users.noreply.github.com> Date: Fri, 16 Feb 2024 06:49:51 +0100 Subject: [PATCH 06/13] Update github actions --- .github/workflows/cd.yml | 22 +++++++++------------- .github/workflows/ci.yml | 21 ++++++++++----------- NFive.SDK.Server.csproj | 26 +++++++++++++++++++++++--- Properties/AssemblyInfo.cs | 16 ---------------- icon.png | Bin 0 -> 5617 bytes 5 files changed, 42 insertions(+), 43 deletions(-) delete mode 100644 Properties/AssemblyInfo.cs create mode 100644 icon.png diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 2afd731..7f9b783 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -11,20 +11,21 @@ jobs: runs-on: ubuntu-latest outputs: semVer: ${{ steps.gitversion.outputs.semVer }} + assemblySemVer: ${{ steps.gitversion.outputs.assemblySemVer }} steps: - - uses: actions/checkout@v2.4.2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v0.9.7 + uses: gittools/actions/gitversion/setup@v0.10.2 with: versionSpec: "5.x" - name: Determine Version id: gitversion - uses: gittools/actions/gitversion/execute@v0.9.7 + uses: gittools/actions/gitversion/execute@v0.10.2 with: useConfigFile: true configFilePath: ./.github/version.yml @@ -36,12 +37,10 @@ jobs: env: SEMVER: ${{ needs.calculate-version.outputs.semVer }} ZipName: NFive.SDK.Server-${{ needs.calculate-version.outputs.semVer }}.zip + ASSEMBLYSEMVER: ${{ needs.calculate-version.outputs.assemblySemVer }} steps: - - uses: actions/checkout@v2.4.2 - - - name: Setup MSBuild - uses: microsoft/setup-msbuild@v1.1 + - uses: actions/checkout@v4 - name: Setup NuGet uses: NuGet/setup-nuget@v1.0.6 @@ -50,33 +49,31 @@ jobs: run: nuget restore NFive.SDK.Server.sln - name: Build the solution - run: msbuild NFive.SDK.Server.sln /p:Configuration=Release /p:Outdir=Build + run: dotnet build -c Release /p:Version=${{env.ASSEMBLYSEMVER}} -o Build NFive.SDK.Server.sln - uses: vimtor/action-zip@v1 with: files: Build/ dest: ${{ env.ZipName }} - # Create a Release on the GitHub project - name: Create release id: create_release uses: actions/create-release@v1 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ env.SEMVER }} release_name: ${{ env.SEMVER }} draft: false prerelease: false - # Upload the Build Artifact to the Release - name: Update release asset id: upload-release-asset uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: .\${{ env.ZipName }} asset_name: ${{ env.ZipName }} asset_content_type: application/zip @@ -84,6 +81,5 @@ jobs: - name: Pack run: dotnet pack NFive.SDK.Server.csproj -p:PackageVersion=${{ env.SEMVER }} --configuration Release - # Push package to nuget.org - name: Push nuget package run: dotnet nuget push **/*.nupkg --skip-duplicate --source "https://api.nuget.org/v3/index.json" --api-key ${{secrets.nuget_api_key}} \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 936a38a..21b6231 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,20 +16,21 @@ jobs: runs-on: ubuntu-latest outputs: semVer: ${{ steps.gitversion.outputs.semVer }} + assemblySemVer: ${{ steps.gitversion.outputs.assemblySemVer }} steps: - - uses: actions/checkout@v2.4.2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v0.9.7 + uses: gittools/actions/gitversion/setup@v0.10.2 with: versionSpec: "5.x" - name: Determine Version id: gitversion - uses: gittools/actions/gitversion/execute@v0.9.7 + uses: gittools/actions/gitversion/execute@v0.10.2 with: useConfigFile: true configFilePath: ./.github/version.yml @@ -39,24 +40,22 @@ jobs: needs: calculate-version env: SEMVER: ${{ needs.calculate-version.outputs.semVer }} - + ASSEMBLYSEMVER: ${{ needs.calculate-version.outputs.assemblySemVer }} + steps: - - uses: actions/checkout@v2.4.2 - - - name: Setup MSBuild - uses: microsoft/setup-msbuild@v1.1 + - uses: actions/checkout@v4 - name: Setup NuGet - uses: NuGet/setup-nuget@v1.0.6 + uses: NuGet/setup-nuget@v2 - name: Restore dependencies run: nuget restore NFive.SDK.Server.sln - name: Build the solution - run: msbuild NFive.SDK.Server.sln /p:Configuration=Release /p:Outdir=Build + run: dotnet build -c Release -o Build /p:Version=${{env.ASSEMBLYSEMVER}} Nfx.SDK.Server.sln - name: Attach Zip as build artifact - uses: actions/upload-artifact@v3.1.0 + uses: actions/upload-artifact@v4 with: name: NFive.SDK.Server-${{ env.SEMVER }} path: Build \ No newline at end of file diff --git a/NFive.SDK.Server.csproj b/NFive.SDK.Server.csproj index 4552c99..f6f6171 100644 --- a/NFive.SDK.Server.csproj +++ b/NFive.SDK.Server.csproj @@ -2,7 +2,6 @@ netstandard2.0 - false NFive.SDK.Server.net NFive.SDK.Server true @@ -18,11 +17,32 @@ https://github.com/NFive/SDK.Server git NFive Server SDK for plugins + 0.1.4 + NFive core SDK for plugin development + README.md + icon.png + Copyright © NFive 2018-2024 + en-US + fbf29b5f-58b2-43af-872b-d31d0ad8c6c4 + + + True + \ + + + + + + True + \ + + + - + @@ -31,6 +51,6 @@ - + \ No newline at end of file diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs deleted file mode 100644 index 20e57f0..0000000 --- a/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("NFive Server SDK")] -[assembly: AssemblyDescription("NFive server SDK for plugin development")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("NFive")] -[assembly: AssemblyProduct("NFive SDK")] -[assembly: AssemblyCopyright("Copyright © NFive 2018-2021")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("5a53d22b-87f1-4b16-b54b-d0a8aeac8e5d")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: AssemblyInformationalVersion("1.0.0.0")] diff --git a/icon.png b/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..1d2da72e3f68382ba54c630ca8ffeac01f2ed72c GIT binary patch literal 5617 zcmd^Bg;Nyp68;?}4Uz&9QqtWW0!JSQM@l2z4H8ExQb$Q63X(@kiNpaCN=ZrzA|VYT zpi+E^ToEAk=hGRfYM%HB?wM)l?;fr6nZzMFfNafF=|g2AO7@(zAY-s!;aA*IYoIC9@0%>@hoXi|^sy_7Nr%ogmHFOn+g?w|k z*9o^DfFtaX;0XVE#Y;$?7r+AEGXm@sgWqpr+F_g~fF%vAvQlgjK~QioBw#c|1%~c{ zdc$`Pgdh_D_mD6ZR!~I(_I_(B;DWizj3rty_vU^jK1hauTrLfEETs>?1`!44!@~4} zVzd&g01l=Wf;4Lp(ZE7>;)1{wQxut!4M66q@QnZ#DJ-DML^+DhqJv#5G}*mcY3&`? z28963aMozH_M|9PTh}TRpG($%5_H)77ifS8$VpI-q@JM_8x@P2XwntT7U&( z;JotJQgo4^*qrc7=-cCR~yek3Z~h<^84O^i6Z&0a5t z9s!>`rQ8}!Nz9dxt!H2@JY{PbM@884e2eXRFfQ^cg?nO6tl=>q^^0TEgf}ljw=k0J)Qx zNXR(=8Qp(Vm3SdwG`sW%03AQ?J+8>4)fvDC;8AfDPrdRT;vOnAhP0rEu>(VkWsCPn ziI^QDN3Mdmj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-RO?zFN}aBvV`?6=?f6y16{tyVP6=~-6`J_q zU}9QMV$8hll3bzgbsf|MJWY~D-u7)BT+5{wv*t7sOq0$d)?8{ zzbyM+ECAiMaX_H=YDBI+{h)Gl^Bk{kq0w_1FB()gWxrymIz32fDaH#fewWaJZkc$- zXNB8ReKD?A0l{%2n(dORDNr!CI!(=(+SN15hAZNK`x%X-q;#7eC{`JA|Hz94lDZ`H zBn2~{Jmn$=jMBF!NgK{dhD1?jEZ%T<5xD1``_ChKr%|yhR4YPeU@lF~Kd6VS@=maGS2A(G&nG83Rso^CA$ChC@zx_Sjagyxo4r*8!9yT{KG!uSxIsONtEIAol*z!th#OQ3x=Jrw{Jv_d zNKm?cEcP;_$=df$m9J9P$22B96^j;sy5>qW$NcQTkRWNPfY${jOGY<8CKU;t1Ym z{4q5vL@#wj{n>(}p{Vg7^#d^EziC0&JnHz)Y(KObm96Hu!^{-vs(|4!l_=h^dWaAH zTsDW(5d%&sTd4DWW|mWtA2*Gf|NCYxNHHb))yQ)zssjrV?OO^BfTo(>qgoZ4=>GuR C>Z`f{ literal 0 HcmV?d00001 From 185cb1a9c3189e68c2c9ebe977d00c9469b5db27 Mon Sep 17 00:00:00 2001 From: all-in-simplicity <13345912+all-in-simplicity@users.noreply.github.com> Date: Sat, 17 Feb 2024 08:54:38 +0100 Subject: [PATCH 07/13] Refactoring of IClientList Allow client lookup by session key --- .github/workflows/cd.yml | 4 +--- .github/workflows/ci.yml | 6 ++---- Communications/IClientList.cs | 3 ++- NFive.SDK.Server.csproj | 9 ++++----- README.md | 4 ++-- 5 files changed, 11 insertions(+), 15 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 7f9b783..53fc2d9 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -11,7 +11,6 @@ jobs: runs-on: ubuntu-latest outputs: semVer: ${{ steps.gitversion.outputs.semVer }} - assemblySemVer: ${{ steps.gitversion.outputs.assemblySemVer }} steps: - uses: actions/checkout@v4 @@ -37,7 +36,6 @@ jobs: env: SEMVER: ${{ needs.calculate-version.outputs.semVer }} ZipName: NFive.SDK.Server-${{ needs.calculate-version.outputs.semVer }}.zip - ASSEMBLYSEMVER: ${{ needs.calculate-version.outputs.assemblySemVer }} steps: - uses: actions/checkout@v4 @@ -49,7 +47,7 @@ jobs: run: nuget restore NFive.SDK.Server.sln - name: Build the solution - run: dotnet build -c Release /p:Version=${{env.ASSEMBLYSEMVER}} -o Build NFive.SDK.Server.sln + run: dotnet build -c Release /p:Version=${{env.SEMVER}} -o Build NFive.SDK.Server.sln - uses: vimtor/action-zip@v1 with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21b6231..10e54ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,6 @@ jobs: runs-on: ubuntu-latest outputs: semVer: ${{ steps.gitversion.outputs.semVer }} - assemblySemVer: ${{ steps.gitversion.outputs.assemblySemVer }} steps: - uses: actions/checkout@v4 @@ -40,8 +39,7 @@ jobs: needs: calculate-version env: SEMVER: ${{ needs.calculate-version.outputs.semVer }} - ASSEMBLYSEMVER: ${{ needs.calculate-version.outputs.assemblySemVer }} - + steps: - uses: actions/checkout@v4 @@ -52,7 +50,7 @@ jobs: run: nuget restore NFive.SDK.Server.sln - name: Build the solution - run: dotnet build -c Release -o Build /p:Version=${{env.ASSEMBLYSEMVER}} Nfx.SDK.Server.sln + run: dotnet build -c Release -o Build /p:Version=${{env.SEMVER}} Nfx.SDK.Server.sln - name: Attach Zip as build artifact uses: actions/upload-artifact@v4 diff --git a/Communications/IClientList.cs b/Communications/IClientList.cs index d12b607..4caa386 100644 --- a/Communications/IClientList.cs +++ b/Communications/IClientList.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using JetBrains.Annotations; +using NFive.SDK.Core.Models.Player; using NFive.SDK.Server.Events; namespace NFive.SDK.Server.Communications @@ -14,7 +15,7 @@ public interface IClientList /// /// The clients. /// - List Clients { get; } + Dictionary Clients { get; } /// /// Occurs when [client added]. diff --git a/NFive.SDK.Server.csproj b/NFive.SDK.Server.csproj index f6f6171..e303799 100644 --- a/NFive.SDK.Server.csproj +++ b/NFive.SDK.Server.csproj @@ -16,14 +16,13 @@ https://github.com/NFive/SDK.Server https://github.com/NFive/SDK.Server git - NFive Server SDK for plugins - 0.1.4 - NFive core SDK for plugin development + 0.1.5 + NFive server SDK for plugin development README.md icon.png Copyright © NFive 2018-2024 en-US - fbf29b5f-58b2-43af-872b-d31d0ad8c6c4 + https://github.com/NFive @@ -42,7 +41,7 @@ - + diff --git a/README.md b/README.md index 49e29a3..e65f877 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # NFive Server SDK [![License](https://img.shields.io/github/license/NFive/SDK.Server.svg)](LICENSE) -[![Build Status](https://img.shields.io/appveyor/ci/NFive/sdk-server.svg)](https://ci.appveyor.com/project/NFive/sdk-server) -[![NuGet Version](https://img.shields.io/nuget/v/NFive/SDK.Server.svg)](https://www.nuget.org/packages/NFive.SDK.Server) +[![Build Status](https://img.shields.io/github/actions/workflow/status/NFive/SDK.Server/ci.yml)](https://github.com/NFive/SDK.Server/actions/workflows/ci.yml) +[![NuGet Version](https://img.shields.io/nuget/v/NFive.SDK.Server)](https://www.nuget.org/packages/NFive.SDK.Server/) [![Release Version](https://img.shields.io/github/release/NFive/SDK.Server/all.svg)](https://github.com/NFive/SDK.Server/releases) [NFive](https://nfive.io/) server SDK for developing plugins. From 202151a585466f82c27ca7503ff49a3ed8972b24 Mon Sep 17 00:00:00 2001 From: all-in-simplicity <13345912+all-in-simplicity@users.noreply.github.com> Date: Sat, 17 Feb 2024 08:55:29 +0100 Subject: [PATCH 08/13] Update EFContext.cs Implement ability to set context options in any child class --- Storage/EFContext.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Storage/EFContext.cs b/Storage/EFContext.cs index 057322f..b3568fc 100644 --- a/Storage/EFContext.cs +++ b/Storage/EFContext.cs @@ -38,6 +38,16 @@ protected EFContext(string connectionString) } + /// + /// Initializes a new instance of the class. + /// + /// The options for this context. + protected EFContext(DbContextOptions options) + : base(options) + { + + } + private static DbContextOptions GetOptions(string connectionString) { return new DbContextOptionsBuilder().UseMySql(connectionString).Options; From 357c7f598b8a542d973c7169b66b7a2257a20aaa Mon Sep 17 00:00:00 2001 From: all-in-simplicity <13345912+all-in-simplicity@users.noreply.github.com> Date: Sat, 17 Feb 2024 09:00:38 +0100 Subject: [PATCH 09/13] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 10e54ce..8c0cc09 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: run: nuget restore NFive.SDK.Server.sln - name: Build the solution - run: dotnet build -c Release -o Build /p:Version=${{env.SEMVER}} Nfx.SDK.Server.sln + run: dotnet build -c Release -o Build /p:Version=${{env.SEMVER}} NFive.SDK.Server.sln - name: Attach Zip as build artifact uses: actions/upload-artifact@v4 From 5e9dab3892f72196b2a7599b55936b1c3f2c2606 Mon Sep 17 00:00:00 2001 From: all-in-simplicity <13345912+all-in-simplicity@users.noreply.github.com> Date: Sat, 17 Feb 2024 09:18:54 +0100 Subject: [PATCH 10/13] Update ci.yml --- .github/workflows/ci.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c0cc09..736b75b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,15 +42,24 @@ jobs: steps: - uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 2.0.x - - name: Setup NuGet - uses: NuGet/setup-nuget@v2 + - uses: actions/cache@v4 + with: + path: ${{ github.workspace }}\.nuget\packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} + restore-keys: | + ${{ runner.os }}-nuget- - name: Restore dependencies - run: nuget restore NFive.SDK.Server.sln + run: dotnet restore NFive.SDK.Server.sln - name: Build the solution - run: dotnet build -c Release -o Build /p:Version=${{env.SEMVER}} NFive.SDK.Server.sln + run: dotnet build --no-restore -c Release -o Build /p:Version=${{env.SEMVER}} NFive.SDK.Server.sln - name: Attach Zip as build artifact uses: actions/upload-artifact@v4 From 0f7f83d41f2c86822c7697676d5f3aa78180aae9 Mon Sep 17 00:00:00 2001 From: all-in-simplicity <13345912+all-in-simplicity@users.noreply.github.com> Date: Sat, 17 Feb 2024 09:23:38 +0100 Subject: [PATCH 11/13] Update ci.yml --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 736b75b..1067c81 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,13 +23,13 @@ jobs: fetch-depth: 0 - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v0.10.2 + uses: gittools/actions/gitversion/setup@v0.11.0 with: versionSpec: "5.x" - name: Determine Version id: gitversion - uses: gittools/actions/gitversion/execute@v0.10.2 + uses: gittools/actions/gitversion/execute@v0.11.0 with: useConfigFile: true configFilePath: ./.github/version.yml @@ -38,6 +38,7 @@ jobs: runs-on: windows-latest needs: calculate-version env: + NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages SEMVER: ${{ needs.calculate-version.outputs.semVer }} steps: From 9e80a18b9ff84de6ebb4fdac8fa5b72cd18ad3eb Mon Sep 17 00:00:00 2001 From: all-in-simplicity <13345912+all-in-simplicity@users.noreply.github.com> Date: Sat, 17 Feb 2024 09:31:10 +0100 Subject: [PATCH 12/13] Update cd.yml --- .github/workflows/cd.yml | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 53fc2d9..1b40570 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -18,13 +18,13 @@ jobs: fetch-depth: 0 - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v0.10.2 + uses: gittools/actions/gitversion/setup@v0.11.0 with: versionSpec: "5.x" - name: Determine Version id: gitversion - uses: gittools/actions/gitversion/execute@v0.10.2 + uses: gittools/actions/gitversion/execute@v0.11.0 with: useConfigFile: true configFilePath: ./.github/version.yml @@ -33,21 +33,31 @@ jobs: name: Build and Release runs-on: windows-latest needs: calculate-version - env: + env: + NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages SEMVER: ${{ needs.calculate-version.outputs.semVer }} ZipName: NFive.SDK.Server-${{ needs.calculate-version.outputs.semVer }}.zip steps: - uses: actions/checkout@v4 - - name: Setup NuGet - uses: NuGet/setup-nuget@v1.0.6 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 2.0.x + + - uses: actions/cache@v4 + with: + path: ${{ github.workspace }}\.nuget\packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} + restore-keys: | + ${{ runner.os }}-nuget- - name: Restore dependencies - run: nuget restore NFive.SDK.Server.sln + run: dotnet restore NFive.SDK.Server.sln - name: Build the solution - run: dotnet build -c Release /p:Version=${{env.SEMVER}} -o Build NFive.SDK.Server.sln + run: dotnet build --no-restore -c Release /p:Version=${{env.SEMVER}} -o Build NFive.SDK.Server.sln - uses: vimtor/action-zip@v1 with: From 5b494f2c6b39ab1636383d369425ca13e4a06834 Mon Sep 17 00:00:00 2001 From: all-in-simplicity <13345912+all-in-simplicity@users.noreply.github.com> Date: Sat, 17 Feb 2024 09:41:29 +0100 Subject: [PATCH 13/13] Update cd.yml --- .github/workflows/cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 1b40570..18d29fe 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -90,4 +90,4 @@ jobs: run: dotnet pack NFive.SDK.Server.csproj -p:PackageVersion=${{ env.SEMVER }} --configuration Release - name: Push nuget package - run: dotnet nuget push **/*.nupkg --skip-duplicate --source "https://api.nuget.org/v3/index.json" --api-key ${{secrets.nuget_api_key}} \ No newline at end of file + run: dotnet nuget push **/NFive.SDK.Server.*.nupkg --skip-duplicate --source "https://api.nuget.org/v3/index.json" --api-key ${{secrets.nuget_api_key}} \ No newline at end of file