From ba9d4069559f4315c041e446e9e2dc96facf1aa2 Mon Sep 17 00:00:00 2001 From: steveski Date: Tue, 21 Jun 2022 23:44:30 +1000 Subject: [PATCH 1/9] chore: update the .NET Framework version, switched to nuget package reference and SDK style projects --- Configuration/LocaleConfiguration.cs | 16 ++-- Configuration/SteamId.cs | 10 +-- Controllers/ControllerConfiguration.cs | 15 ++-- Controllers/IControllerConfiguration.cs | 24 ++---- Diagnostics/ILogger.cs | 9 ++- Diagnostics/LogLevel.cs | 8 +- Events/CoreEvents.cs | 8 +- Extensions/NumericExtensions.cs | 6 +- Extensions/PositionExtensions.cs | 8 +- Extensions/StringExtensions.cs | 14 ++-- Extensions/Vector2Extensions.cs | 8 +- Extensions/Vector3Extensions.cs | 8 +- Helpers/GuidGenerator.cs | 47 ++++++------ Helpers/MathHelpers.cs | 4 +- Input/ControllerInput.cs | 4 +- Input/InputControl.cs | 4 +- Input/InputMethod.cs | 4 +- Input/InputModifier.cs | 6 +- Input/KeyCode.cs | 4 +- Locales/ILocaleCatalog.cs | 13 ++-- Models/Audio/RadioStation.cs | 4 +- Models/Color.cs | 6 +- Models/IIdentityModel.cs | 10 +-- Models/IdentityModel.cs | 15 ++-- Models/Player/Session.cs | 30 +++----- Models/Player/User.cs | 27 +++---- Models/Position.cs | 14 +--- Models/Vector2.cs | 8 +- Models/Vector3.cs | 6 +- NFive.SDK.Core.csproj | 98 +++---------------------- NFive.SDK.Core.nuspec | 2 +- NFive.SDK.Core.sln | 20 +++-- NFive.SDK.Core.sln.DotSettings | 1 + PluginAttribute.cs | 15 ++-- Plugins/Client.cs | 15 ++-- Plugins/Name.cs | 17 ++--- Plugins/Plugin.cs | 17 ++--- Plugins/Repository.cs | 13 ++-- Plugins/Server.cs | 14 ++-- Plugins/Version.cs | 13 ++-- Plugins/VersionRange.cs | 13 ++-- Properties/AssemblyInfo.cs | 16 ---- Utilities/Serializer.cs | 10 +-- packages.config | 5 -- 44 files changed, 220 insertions(+), 389 deletions(-) delete mode 100644 Properties/AssemblyInfo.cs delete mode 100644 packages.config diff --git a/Configuration/LocaleConfiguration.cs b/Configuration/LocaleConfiguration.cs index b597664..6b53d9b 100644 --- a/Configuration/LocaleConfiguration.cs +++ b/Configuration/LocaleConfiguration.cs @@ -1,12 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using JetBrains.Annotations; - -namespace NFive.SDK.Core.Configuration +namespace NFive.SDK.Core.Configuration { - [PublicAPI] - public class LocaleConfiguration + using JetBrains.Annotations; + using System; + using System.Collections.Generic; + using System.Globalization; + + + public class LocaleConfiguration { public List Culture { get; set; } diff --git a/Configuration/SteamId.cs b/Configuration/SteamId.cs index 50c8bc4..6da03c0 100644 --- a/Configuration/SteamId.cs +++ b/Configuration/SteamId.cs @@ -1,9 +1,9 @@ -using System; -using JetBrains.Annotations; - -namespace NFive.SDK.Core.Configuration +namespace NFive.SDK.Core.Configuration { - [PublicAPI] + using JetBrains.Annotations; + using System; + + public class SteamId { protected readonly long Value; diff --git a/Controllers/ControllerConfiguration.cs b/Controllers/ControllerConfiguration.cs index 1d88826..714f2c7 100644 --- a/Controllers/ControllerConfiguration.cs +++ b/Controllers/ControllerConfiguration.cs @@ -1,14 +1,9 @@ -using System; -using JetBrains.Annotations; - -namespace NFive.SDK.Core.Controllers +namespace NFive.SDK.Core.Controllers { - /// - /// - /// Represents the configuration that is automatically loaded into a ConfigurableController. - /// - /// - [PublicAPI] + using JetBrains.Annotations; + using System; + + [Serializable] public abstract class ControllerConfiguration : IControllerConfiguration { diff --git a/Controllers/IControllerConfiguration.cs b/Controllers/IControllerConfiguration.cs index d39db19..fc0b5fd 100644 --- a/Controllers/IControllerConfiguration.cs +++ b/Controllers/IControllerConfiguration.cs @@ -1,19 +1,7 @@ -using JetBrains.Annotations; - -namespace NFive.SDK.Core.Controllers +namespace NFive.SDK.Core.Controllers { - /// - /// Represents the configuration that is automatically loaded into a ConfigurableController. - /// - [PublicAPI] - public interface IControllerConfiguration - { - /// - /// Gets the name of the file this configuration is saved as. - /// - /// - /// The name of the file without the extension. - /// - string FileName { get; } - } -} + public interface IControllerConfiguration + { + string FileName { get; } + } +} \ No newline at end of file diff --git a/Diagnostics/ILogger.cs b/Diagnostics/ILogger.cs index 2ffb1b9..82eb1aa 100644 --- a/Diagnostics/ILogger.cs +++ b/Diagnostics/ILogger.cs @@ -1,12 +1,13 @@ -using System; -using JetBrains.Annotations; - namespace NFive.SDK.Core.Diagnostics { + using JetBrains.Annotations; + using System; + //using JetBrains.Annotations; + /// /// Provides logging interface and utility functions. /// - [PublicAPI] + public interface ILogger { /// diff --git a/Diagnostics/LogLevel.cs b/Diagnostics/LogLevel.cs index c6d6cb9..742c0fa 100644 --- a/Diagnostics/LogLevel.cs +++ b/Diagnostics/LogLevel.cs @@ -1,11 +1,13 @@ -using JetBrains.Annotations; - namespace NFive.SDK.Core.Diagnostics { + using JetBrains.Annotations; + + //using JetBrains.Annotations; + /// /// Defines available log levels. /// - [PublicAPI] + public enum LogLevel { /// diff --git a/Events/CoreEvents.cs b/Events/CoreEvents.cs index a2b4de0..52b3103 100644 --- a/Events/CoreEvents.cs +++ b/Events/CoreEvents.cs @@ -1,11 +1,11 @@ -using JetBrains.Annotations; - -namespace NFive.SDK.Core.Events +namespace NFive.SDK.Core.Events { + using JetBrains.Annotations; + /// /// Core NFive events. /// - [PublicAPI] + public static class CoreEvents { /// diff --git a/Extensions/NumericExtensions.cs b/Extensions/NumericExtensions.cs index f027451..b8ac9ef 100644 --- a/Extensions/NumericExtensions.cs +++ b/Extensions/NumericExtensions.cs @@ -1,8 +1,8 @@ -using System; -using JetBrains.Annotations; - namespace NFive.SDK.Core.Extensions { + using System; + using JetBrains.Annotations; + [PublicAPI] public static class NumericExtensions { diff --git a/Extensions/PositionExtensions.cs b/Extensions/PositionExtensions.cs index 921f5c6..8dc3959 100644 --- a/Extensions/PositionExtensions.cs +++ b/Extensions/PositionExtensions.cs @@ -1,9 +1,9 @@ -using System; -using JetBrains.Annotations; -using NFive.SDK.Core.Models; - namespace NFive.SDK.Core.Extensions { + using System; + using JetBrains.Annotations; + using NFive.SDK.Core.Models; + [PublicAPI] [Obsolete] public static class PositionExtensions diff --git a/Extensions/StringExtensions.cs b/Extensions/StringExtensions.cs index 8816ef4..8575eef 100644 --- a/Extensions/StringExtensions.cs +++ b/Extensions/StringExtensions.cs @@ -1,11 +1,11 @@ -using System.Globalization; -using System.Linq; -using System.Text.RegularExpressions; -using JetBrains.Annotations; - -namespace NFive.SDK.Core.Extensions +namespace NFive.SDK.Core.Extensions { - [PublicAPI] + using JetBrains.Annotations; + using System.Globalization; + using System.Linq; + using System.Text.RegularExpressions; + + public static class StringExtensions { public static string Pluralize(this string str, int value, string extension = "s", CultureInfo culture = null) diff --git a/Extensions/Vector2Extensions.cs b/Extensions/Vector2Extensions.cs index 2822075..ca5868f 100644 --- a/Extensions/Vector2Extensions.cs +++ b/Extensions/Vector2Extensions.cs @@ -1,9 +1,9 @@ -using System; -using JetBrains.Annotations; -using NFive.SDK.Core.Models; - namespace NFive.SDK.Core.Extensions { + using System; + using JetBrains.Annotations; + using NFive.SDK.Core.Models; + [PublicAPI] public static class Vector2Extensions { diff --git a/Extensions/Vector3Extensions.cs b/Extensions/Vector3Extensions.cs index 3753325..45fef06 100644 --- a/Extensions/Vector3Extensions.cs +++ b/Extensions/Vector3Extensions.cs @@ -1,9 +1,9 @@ -using System; -using JetBrains.Annotations; -using NFive.SDK.Core.Models; - namespace NFive.SDK.Core.Extensions { + using System; + using JetBrains.Annotations; + using NFive.SDK.Core.Models; + [PublicAPI] public static class Vector3Extensions { diff --git a/Helpers/GuidGenerator.cs b/Helpers/GuidGenerator.cs index 060f4c7..ae83589 100644 --- a/Helpers/GuidGenerator.cs +++ b/Helpers/GuidGenerator.cs @@ -1,14 +1,10 @@ -using System; -using System.Security.Cryptography; -using JetBrains.Annotations; - -namespace NFive.SDK.Core.Helpers +namespace NFive.SDK.Core.Helpers { - /// - /// Utility for generating MySQL optimized globally unique identifiers. - /// - /// TODO: Fully test and verify this helps performance. - [PublicAPI] + using JetBrains.Annotations; + using System; + //using System.Security.Cryptography; + + public static class GuidGenerator { /// @@ -17,25 +13,28 @@ public static class GuidGenerator /// The generated GUID. public static Guid GenerateTimeBasedGuid() { - var randomBytes = new byte[10]; - using (var rng = new RNGCryptoServiceProvider()) rng.GetBytes(randomBytes); + //var randomBytes = new byte[10]; + + //using (var rng = RandomNumberGenerator.Create()) rng.GetBytes(randomBytes); + + //var timestampBytes = BitConverter.GetBytes(DateTime.UtcNow.Ticks / 10000L); + //if (BitConverter.IsLittleEndian) Array.Reverse(timestampBytes); - var timestampBytes = BitConverter.GetBytes(DateTime.UtcNow.Ticks / 10000L); - if (BitConverter.IsLittleEndian) Array.Reverse(timestampBytes); + //var guidBytes = new byte[16]; - var guidBytes = new byte[16]; + //Buffer.BlockCopy(timestampBytes, 2, guidBytes, 0, 6); + //Buffer.BlockCopy(randomBytes, 0, guidBytes, 6, 10); - Buffer.BlockCopy(timestampBytes, 2, guidBytes, 0, 6); - Buffer.BlockCopy(randomBytes, 0, guidBytes, 6, 10); + //// ReSharper disable once InvertIf + //if (BitConverter.IsLittleEndian) + //{ + // Array.Reverse(guidBytes, 0, 4); + // Array.Reverse(guidBytes, 4, 2); + //} - // ReSharper disable once InvertIf - if (BitConverter.IsLittleEndian) - { - Array.Reverse(guidBytes, 0, 4); - Array.Reverse(guidBytes, 4, 2); - } + //return new Guid(guidBytes); - return new Guid(guidBytes); + return Guid.NewGuid(); } } } diff --git a/Helpers/MathHelpers.cs b/Helpers/MathHelpers.cs index 5c30c6d..2c0bb96 100644 --- a/Helpers/MathHelpers.cs +++ b/Helpers/MathHelpers.cs @@ -1,7 +1,7 @@ -using JetBrains.Annotations; - namespace NFive.SDK.Core.Helpers { + using JetBrains.Annotations; + [PublicAPI] public static class MathHelpers { diff --git a/Input/ControllerInput.cs b/Input/ControllerInput.cs index 39bf451..cbea589 100644 --- a/Input/ControllerInput.cs +++ b/Input/ControllerInput.cs @@ -1,7 +1,7 @@ -using JetBrains.Annotations; - namespace NFive.SDK.Core.Input { + using JetBrains.Annotations; + /// /// Represents the inputs on a Xbox One controller as supported by GTA. /// See Xbox support for button naming. diff --git a/Input/InputControl.cs b/Input/InputControl.cs index 81a070d..de01ef1 100644 --- a/Input/InputControl.cs +++ b/Input/InputControl.cs @@ -1,7 +1,7 @@ -using JetBrains.Annotations; - namespace NFive.SDK.Core.Input { + using JetBrains.Annotations; + /// /// Represents the native GTA input controls. /// diff --git a/Input/InputMethod.cs b/Input/InputMethod.cs index c120e29..cb6a7b8 100644 --- a/Input/InputMethod.cs +++ b/Input/InputMethod.cs @@ -1,7 +1,7 @@ -using JetBrains.Annotations; - namespace NFive.SDK.Core.Input { + using JetBrains.Annotations; + /// /// Represents the available input methods. /// diff --git a/Input/InputModifier.cs b/Input/InputModifier.cs index ac4d06f..368bd11 100644 --- a/Input/InputModifier.cs +++ b/Input/InputModifier.cs @@ -1,8 +1,8 @@ -using System; -using JetBrains.Annotations; - namespace NFive.SDK.Core.Input { + using System; + using JetBrains.Annotations; + [PublicAPI] [Flags] public enum InputModifier diff --git a/Input/KeyCode.cs b/Input/KeyCode.cs index 24ba93b..5bc4ecd 100644 --- a/Input/KeyCode.cs +++ b/Input/KeyCode.cs @@ -1,7 +1,7 @@ -using JetBrains.Annotations; - namespace NFive.SDK.Core.Input { + using JetBrains.Annotations; + [PublicAPI] public enum KeyCode { diff --git a/Locales/ILocaleCatalog.cs b/Locales/ILocaleCatalog.cs index ab2642d..32d9413 100644 --- a/Locales/ILocaleCatalog.cs +++ b/Locales/ILocaleCatalog.cs @@ -1,12 +1,9 @@ -using System.Globalization; -using JetBrains.Annotations; - -namespace NFive.SDK.Core.Locales +namespace NFive.SDK.Core.Locales { - /// - /// A GNU gettext locale catalog for a given culture. - /// - [PublicAPI] + using JetBrains.Annotations; + using System.Globalization; + + public interface ILocaleCatalog { /// Gets the catalog culture. diff --git a/Models/Audio/RadioStation.cs b/Models/Audio/RadioStation.cs index ac1116e..f7aa782 100644 --- a/Models/Audio/RadioStation.cs +++ b/Models/Audio/RadioStation.cs @@ -1,7 +1,7 @@ -using JetBrains.Annotations; - namespace NFive.SDK.Core.Models.Audio { + using JetBrains.Annotations; + /// /// GTA radio stations. /// diff --git a/Models/Color.cs b/Models/Color.cs index 884b09c..d004d29 100644 --- a/Models/Color.cs +++ b/Models/Color.cs @@ -1,8 +1,8 @@ -using System.ComponentModel.DataAnnotations.Schema; -using JetBrains.Annotations; - namespace NFive.SDK.Core.Models { + using System.ComponentModel.DataAnnotations.Schema; + using JetBrains.Annotations; + /// /// Represents an ARGB (alpha, red, green, blue) color. /// diff --git a/Models/IIdentityModel.cs b/Models/IIdentityModel.cs index 5996abf..79c3905 100644 --- a/Models/IIdentityModel.cs +++ b/Models/IIdentityModel.cs @@ -1,12 +1,12 @@ -using System; -using JetBrains.Annotations; - -namespace NFive.SDK.Core.Models +namespace NFive.SDK.Core.Models { + using JetBrains.Annotations; + using System; + /// /// Represents the key properties for a stored model. /// - [PublicAPI] + public interface IIdentityModel { /// diff --git a/Models/IdentityModel.cs b/Models/IdentityModel.cs index cb07abe..4d050dc 100644 --- a/Models/IdentityModel.cs +++ b/Models/IdentityModel.cs @@ -1,15 +1,13 @@ -using System; -using System.ComponentModel.DataAnnotations; -using JetBrains.Annotations; -using NFive.SDK.Core.Helpers; - -namespace NFive.SDK.Core.Models +namespace NFive.SDK.Core.Models { + using System; + using NFive.SDK.Core.Helpers; + /// /// /// Represents the key properties for a stored model. /// - [PublicAPI] + public abstract class IdentityModel : IIdentityModel { /// @@ -19,8 +17,6 @@ public abstract class IdentityModel : IIdentityModel /// /// The model identifier. /// - [Key] - [Required] public Guid Id { get; set; } /// @@ -30,7 +26,6 @@ public abstract class IdentityModel : IIdentityModel /// /// The timestamp of when the model was created. /// - [Required] public DateTime Created { get; set; } /// diff --git a/Models/Player/Session.cs b/Models/Player/Session.cs index dad4ea0..7573b14 100644 --- a/Models/Player/Session.cs +++ b/Models/Player/Session.cs @@ -1,15 +1,13 @@ -using System; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using JetBrains.Annotations; -using Newtonsoft.Json; - -namespace NFive.SDK.Core.Models.Player +namespace NFive.SDK.Core.Models.Player { - /// - /// Session model representing a user's connection to the server. - /// - [PublicAPI] + using JetBrains.Annotations; + using Newtonsoft.Json; + using System; + + /// + /// Session model representing a user's connection to the server. + /// + public class Session { /// @@ -18,8 +16,6 @@ public class Session /// /// The session identifier. /// - [Key] - [Required] public Guid Id { get; set; } /// @@ -28,8 +24,7 @@ public class Session /// /// The IP address of the connected client. /// - [Required] - [StringLength(47, MinimumLength = 5)] // [::1] through [0000:0000:0000:0000:0000:0000:000.000.000.000] + /// // [::1] through [0000:0000:0000:0000:0000:0000:000.000.000.000] public string IpAddress { get; set; } /// @@ -38,7 +33,6 @@ public class Session /// /// The timestamp of when the session was created. /// - [Required] public DateTime Created { get; set; } = DateTime.UtcNow; /// @@ -63,7 +57,6 @@ public class Session /// /// The reason the client disconnected. /// - [StringLength(200)] public string DisconnectReason { get; set; } /// @@ -72,7 +65,6 @@ public class Session /// /// The handle of the connected client. /// - [NotMapped] public int Handle { get; set; } /// @@ -81,8 +73,6 @@ public class Session /// /// The user identifier. /// - [Required] - [ForeignKey("User")] public Guid UserId { get; set; } /// diff --git a/Models/Player/User.cs b/Models/Player/User.cs index 2226da2..d0dd5ff 100644 --- a/Models/Player/User.cs +++ b/Models/Player/User.cs @@ -1,16 +1,14 @@ -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using JetBrains.Annotations; - -namespace NFive.SDK.Core.Models.Player +namespace NFive.SDK.Core.Models.Player { - /// - /// - /// User model representing the player on the server. - /// - /// - [PublicAPI] + using JetBrains.Annotations; + using System.Collections.Generic; + + /// + /// + /// User model representing the player on the server. + /// + /// + public class User : IdentityModel { /// @@ -19,8 +17,6 @@ public class User : IdentityModel /// /// The license. /// - [Required] - [StringLength(40, MinimumLength = 40)] public string License { get; set; } /// @@ -37,8 +33,6 @@ public class User : IdentityModel /// /// The player name. /// - [Required] - [StringLength(32, MinimumLength = 1)] // TODO: Confirm public string Name { get; set; } /// @@ -47,7 +41,6 @@ public class User : IdentityModel /// /// The sessions. /// - [InverseProperty("User")] public virtual List Sessions { get; set; } } } diff --git a/Models/Position.cs b/Models/Position.cs index 9f2dee1..11f11cd 100644 --- a/Models/Position.cs +++ b/Models/Position.cs @@ -1,14 +1,11 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using JetBrains.Annotations; - -namespace NFive.SDK.Core.Models +namespace NFive.SDK.Core.Models { + using JetBrains.Annotations; + /// /// Represents a position in 3D space. /// - [PublicAPI] - [ComplexType] + public class Position { /// @@ -17,7 +14,6 @@ public class Position /// /// The position on the X axis. /// - [Required] public float X { get; set; } /// @@ -26,7 +22,6 @@ public class Position /// /// The position on the Y axis. /// - [Required] public float Y { get; set; } /// @@ -35,7 +30,6 @@ public class Position /// /// The position on the Z axis. /// - [Required] public float Z { get; set; } /// diff --git a/Models/Vector2.cs b/Models/Vector2.cs index 5df8139..cbe2353 100644 --- a/Models/Vector2.cs +++ b/Models/Vector2.cs @@ -1,9 +1,9 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using JetBrains.Annotations; - namespace NFive.SDK.Core.Models { + using System.ComponentModel.DataAnnotations; + using System.ComponentModel.DataAnnotations.Schema; + using JetBrains.Annotations; + /// /// Represents a position in 2D space. /// diff --git a/Models/Vector3.cs b/Models/Vector3.cs index 42eae77..82da722 100644 --- a/Models/Vector3.cs +++ b/Models/Vector3.cs @@ -1,8 +1,8 @@ -using System.ComponentModel.DataAnnotations; -using JetBrains.Annotations; - namespace NFive.SDK.Core.Models { + using System.ComponentModel.DataAnnotations; + using JetBrains.Annotations; + /// /// Represents a position in 3D space. /// diff --git a/NFive.SDK.Core.csproj b/NFive.SDK.Core.csproj index 78b1ecb..79c1cc0 100644 --- a/NFive.SDK.Core.csproj +++ b/NFive.SDK.Core.csproj @@ -1,93 +1,17 @@ - - - + + - Debug - AnyCPU - {C1DE80C7-579E-4D48-AAB8-37F5C1484F86} - Library - Properties + net471 NFive.SDK.Core - NFive.SDK.Core.net - v4.5.2 - 512 - - .allowedextension - - - - false - none - false - bin\Debug - DEBUG;TRACE - prompt - 4 - - - false - none - true - bin\Release - TRACE - prompt - 4 + - - packages\JetBrains.Annotations.2021.2.0\lib\net20\JetBrains.Annotations.dll - False + + + + + $(PkgNewtonsoft_Json)\lib\portable-net40+sl5+win8+wp8+wpa81\Newtonsoft.Json.dll - - packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll - False - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + diff --git a/NFive.SDK.Core.nuspec b/NFive.SDK.Core.nuspec index f6a6be3..f678f80 100644 --- a/NFive.SDK.Core.nuspec +++ b/NFive.SDK.Core.nuspec @@ -12,6 +12,6 @@ $description$ $copyright$ nfive fivem gtav - + diff --git a/NFive.SDK.Core.sln b/NFive.SDK.Core.sln index 384d2e0..f320078 100644 --- a/NFive.SDK.Core.sln +++ b/NFive.SDK.Core.sln @@ -1,24 +1,22 @@ + Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27703.2035 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NFive.SDK.Core", "NFive.SDK.Core.csproj", "{C1DE80C7-579E-4D48-AAB8-37F5C1484F86}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NFive.SDK.Core", "NFive.SDK.Core.csproj", "{6D978D8B-7C98-48CA-9EDD-22578DB1050F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C1DE80C7-579E-4D48-AAB8-37F5C1484F86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C1DE80C7-579E-4D48-AAB8-37F5C1484F86}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C1DE80C7-579E-4D48-AAB8-37F5C1484F86}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C1DE80C7-579E-4D48-AAB8-37F5C1484F86}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {3A593D17-0FF9-43F8-9F3A-2BEE2A432C1A} + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6D978D8B-7C98-48CA-9EDD-22578DB1050F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6D978D8B-7C98-48CA-9EDD-22578DB1050F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6D978D8B-7C98-48CA-9EDD-22578DB1050F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6D978D8B-7C98-48CA-9EDD-22578DB1050F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/NFive.SDK.Core.sln.DotSettings b/NFive.SDK.Core.sln.DotSettings index ae9fefa..9bda150 100644 --- a/NFive.SDK.Core.sln.DotSettings +++ b/NFive.SDK.Core.sln.DotSettings @@ -75,6 +75,7 @@ </Entry> </TypePattern> </Patterns> + True DOF FOV HUD diff --git a/PluginAttribute.cs b/PluginAttribute.cs index 5b22d5f..47e42e5 100644 --- a/PluginAttribute.cs +++ b/PluginAttribute.cs @@ -1,13 +1,9 @@ -using System; -using JetBrains.Annotations; - -namespace NFive.SDK.Core +namespace NFive.SDK.Core { - /// - /// - /// Specifies the SDK version number the assembly was built against. - /// - [PublicAPI] + using JetBrains.Annotations; + using System; + + [AttributeUsage(AttributeTargets.Assembly)] public class PluginAttribute : Attribute { @@ -26,4 +22,5 @@ public PluginAttribute(uint target) this.Target = target; } } + } diff --git a/Plugins/Client.cs b/Plugins/Client.cs index eb55f0a..f7d91e6 100644 --- a/Plugins/Client.cs +++ b/Plugins/Client.cs @@ -1,13 +1,10 @@ -using System; -using System.Collections.Generic; -using JetBrains.Annotations; - -namespace NFive.SDK.Core.Plugins +namespace NFive.SDK.Core.Plugins { - /// - /// Client file requirements for a plugin. - /// - [PublicAPI] + using JetBrains.Annotations; + using System; + using System.Collections.Generic; + + [Serializable] public class Client { diff --git a/Plugins/Name.cs b/Plugins/Name.cs index 4fa0f99..2ad2de9 100644 --- a/Plugins/Name.cs +++ b/Plugins/Name.cs @@ -1,14 +1,11 @@ -using System; -using JetBrains.Annotations; -using Newtonsoft.Json; - -namespace NFive.SDK.Core.Plugins +namespace NFive.SDK.Core.Plugins { - /// - /// Represents a plugin name, composed of the vendor and project. - /// + using JetBrains.Annotations; + using Newtonsoft.Json; + using System; + [Serializable] - [PublicAPI] + public class Name { /// @@ -45,7 +42,7 @@ public Name(string value) var parts = value.Split('/'); - if (parts.Length != 2) throw new ArgumentException("Invalid plugin name format, plugin name must be in \"vendor/project\" format.", nameof(value)); + if (parts.Length != 2) throw new ArgumentException($"Invalid plugin name format {value}, plugin name must be in \"vendor/project\" format.", nameof(value)); this.Vendor = parts[0]; this.Project = parts[1]; diff --git a/Plugins/Plugin.cs b/Plugins/Plugin.cs index c067cad..9564bcf 100644 --- a/Plugins/Plugin.cs +++ b/Plugins/Plugin.cs @@ -1,14 +1,11 @@ -using System; -using System.Collections.Generic; -using JetBrains.Annotations; - -namespace NFive.SDK.Core.Plugins +namespace NFive.SDK.Core.Plugins { - /// - /// Represents a NFive plugin configuration. - /// - [PublicAPI] - [Serializable] + using JetBrains.Annotations; + using System; + using System.Collections.Generic; + + + [Serializable] public class Plugin { /// diff --git a/Plugins/Repository.cs b/Plugins/Repository.cs index 9d51d77..fb84f0c 100644 --- a/Plugins/Repository.cs +++ b/Plugins/Repository.cs @@ -1,12 +1,9 @@ -using System; -using JetBrains.Annotations; - -namespace NFive.SDK.Core.Plugins +namespace NFive.SDK.Core.Plugins { - /// - /// Repository configuration for a plugin. - /// - [PublicAPI] + using JetBrains.Annotations; + using System; + + [Serializable] public class Repository { diff --git a/Plugins/Server.cs b/Plugins/Server.cs index 2bb8481..913a092 100644 --- a/Plugins/Server.cs +++ b/Plugins/Server.cs @@ -1,13 +1,9 @@ -using System; -using System.Collections.Generic; -using JetBrains.Annotations; - -namespace NFive.SDK.Core.Plugins +namespace NFive.SDK.Core.Plugins { - /// - /// Server file requirements for a plugin. - /// - [PublicAPI] + using System; + using System.Collections.Generic; + + //g [Serializable] public class Server { diff --git a/Plugins/Version.cs b/Plugins/Version.cs index 518a1db..f0c835a 100644 --- a/Plugins/Version.cs +++ b/Plugins/Version.cs @@ -1,13 +1,10 @@ -using System; -using JetBrains.Annotations; - -namespace NFive.SDK.Core.Plugins +namespace NFive.SDK.Core.Plugins { - /// - /// Represents a semantic version number. - /// + using JetBrains.Annotations; + using System; + [Serializable] - [PublicAPI] + public class Version { /// diff --git a/Plugins/VersionRange.cs b/Plugins/VersionRange.cs index 41e4137..8d38f34 100644 --- a/Plugins/VersionRange.cs +++ b/Plugins/VersionRange.cs @@ -1,13 +1,10 @@ -using System; -using JetBrains.Annotations; - -namespace NFive.SDK.Core.Plugins +namespace NFive.SDK.Core.Plugins { - /// - /// Represents a semantic version range. - /// + using JetBrains.Annotations; + using System; + [Serializable] - [PublicAPI] + public class VersionRange { /// diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs deleted file mode 100644 index ed5dc08..0000000 --- a/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("NFive Core SDK")] -[assembly: AssemblyDescription("NFive core 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("1ed39a02-e017-407d-8d32-fee8a1e29264")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: AssemblyInformationalVersion("1.0.0.0")] diff --git a/Utilities/Serializer.cs b/Utilities/Serializer.cs index cfabee9..57fab02 100644 --- a/Utilities/Serializer.cs +++ b/Utilities/Serializer.cs @@ -1,12 +1,12 @@ -using JetBrains.Annotations; -using Newtonsoft.Json; - -namespace NFive.SDK.Core.Utilities +namespace NFive.SDK.Core.Utilities { + using JetBrains.Annotations; + using Newtonsoft.Json; + /// /// Utilities to convert objects to and from JSON strings. /// - [PublicAPI] + public class Serializer { /// Gets or sets the formatting option for the serializer. diff --git a/packages.config b/packages.config deleted file mode 100644 index 22cb545..0000000 --- a/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file From 25c79e3480f85760b16c74175abfb38d3eb5d8c6 Mon Sep 17 00:00:00 2001 From: Stephen York Date: Wed, 22 Jun 2022 00:29:05 +1000 Subject: [PATCH 2/9] Create ci.yml --- .github/workflows/ci.yml | 62 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..fe32812 --- /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: ./GitVersion.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.Core.sln + + - name: Build the solution + run: msbuild NFive.SDK.Core.sln /p:Configuration=Release /p:Outdir=Build + + - name: Attach Zip as build artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: NFive.SDK.Core_${{ env.SEMVER }} + path: Build From f81755cd4284e5b6b73d889126c80b856dc14548 Mon Sep 17 00:00:00 2001 From: steveski Date: Wed, 22 Jun 2022 00:49:07 +1000 Subject: [PATCH 3/9] Added cd and GitVersion --- .github/workflows/cd.yml | 82 ++++++++++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 40 ++++++++++---------- GitVersion.yml | 6 +++ 3 files changed, 108 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/cd.yml create mode 100644 GitVersion.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..a8b64b5 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,82 @@ +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: ./GitVersion.yml + + build: + name: Build and Release + runs-on: windows-latest + needs: calculate-version + env: + SEMVER: ${{ needs.calculate-version.outputs.semVer }} + ZipName: NFive.SDK.Core${{ 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.Core.sln + + - name: Build the solution + run: msbuild NFive.SDK.Core.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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe32812..664153a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,12 +3,12 @@ name: CI on: push: branches: - - '**' + - "**" tags: - - 'v*.*.*' + - "v*.*.*" pull_request: branches: - - '**' + - "**" jobs: calculate-version: @@ -18,21 +18,21 @@ jobs: 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: ./GitVersion.yml + - 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: ./GitVersion.yml build: runs-on: windows-latest @@ -48,13 +48,13 @@ jobs: - name: Setup NuGet uses: NuGet/setup-nuget@v1.0.6 - + - name: Restore dependencies run: nuget restore NFive.SDK.Core.sln - name: Build the solution run: msbuild NFive.SDK.Core.sln /p:Configuration=Release /p:Outdir=Build - + - name: Attach Zip as build artifact uses: actions/upload-artifact@v3.1.0 with: diff --git a/GitVersion.yml b/GitVersion.yml new file mode 100644 index 0000000..51a1759 --- /dev/null +++ b/GitVersion.yml @@ -0,0 +1,6 @@ +mode: ContinuousDeployment +branches: + master: + tag: beta + hotfix: + tag: useBranchName From 476bef483f864c35be4aae67ac7bbb783b705eba Mon Sep 17 00:00:00 2001 From: steveski Date: Wed, 22 Jun 2022 00:54:54 +1000 Subject: [PATCH 4/9] Removed redundant appveyor.yml --- appveyor.yml | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 978032c..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.Core.sln - verbosity: minimal - publish_nuget: true From 6f13e8cc2c1f4d7f88a5533449bc2bcf07067e8f Mon Sep 17 00:00:00 2001 From: steveski Date: Thu, 23 Jun 2022 00:27:27 +1000 Subject: [PATCH 5/9] Fixed zip filename --- .github/workflows/cd.yml | 2 +- .github/workflows/ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index a8b64b5..0868dfe 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -35,7 +35,7 @@ jobs: needs: calculate-version env: SEMVER: ${{ needs.calculate-version.outputs.semVer }} - ZipName: NFive.SDK.Core${{ needs.calculate-version.outputs.semVer }}.zip + ZipName: NFive.SDK.Core-${{ needs.calculate-version.outputs.semVer }}.zip steps: - uses: actions/checkout@v2.4.2 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 664153a..d3d785a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,5 +58,5 @@ jobs: - name: Attach Zip as build artifact uses: actions/upload-artifact@v3.1.0 with: - name: NFive.SDK.Core_${{ env.SEMVER }} + name: NFive.SDK.Core-${{ env.SEMVER }} path: Build From 3d6246064b10426568ded90873bfc0cbae96326f Mon Sep 17 00:00:00 2001 From: steveski Date: Thu, 23 Jun 2022 19:31:57 +1000 Subject: [PATCH 6/9] Added back things that went missing. --- Configuration/LocaleConfiguration.cs | 14 +++++++------- Configuration/SteamId.cs | 8 ++++---- Controllers/ControllerConfiguration.cs | 8 ++++---- Controllers/IControllerConfiguration.cs | 24 ++++++++++++++++++------ Diagnostics/ILogger.cs | 2 +- Diagnostics/LogLevel.cs | 2 +- Events/CoreEvents.cs | 4 ++-- Extensions/StringExtensions.cs | 4 ++-- Locales/ILocaleCatalog.cs | 4 ++-- Models/IIdentityModel.cs | 4 ++-- Models/IdentityModel.cs | 11 ++++++++--- Models/Player/Session.cs | 19 +++++++++++++++---- Models/Player/User.cs | 21 ++++++++++++++------- Models/Position.cs | 10 ++++++++-- Plugins/Client.cs | 4 ++-- Plugins/Name.cs | 6 +++--- Plugins/Plugin.cs | 6 +++--- Plugins/Repository.cs | 4 ++-- Plugins/Server.cs | 5 +++-- Plugins/Version.cs | 4 ++-- Plugins/VersionRange.cs | 6 +++--- Utilities/Serializer.cs | 4 ++-- 22 files changed, 108 insertions(+), 66 deletions(-) diff --git a/Configuration/LocaleConfiguration.cs b/Configuration/LocaleConfiguration.cs index 6b53d9b..6e78a7d 100644 --- a/Configuration/LocaleConfiguration.cs +++ b/Configuration/LocaleConfiguration.cs @@ -1,12 +1,12 @@ -namespace NFive.SDK.Core.Configuration +namespace NFive.SDK.Core.Configuration { - using JetBrains.Annotations; - using System; - using System.Collections.Generic; - using System.Globalization; + using JetBrains.Annotations; + using System; + using System.Collections.Generic; + using System.Globalization; - - public class LocaleConfiguration + [PublicAPI] + public class LocaleConfiguration { public List Culture { get; set; } diff --git a/Configuration/SteamId.cs b/Configuration/SteamId.cs index 6da03c0..30f7062 100644 --- a/Configuration/SteamId.cs +++ b/Configuration/SteamId.cs @@ -1,9 +1,9 @@ -namespace NFive.SDK.Core.Configuration +namespace NFive.SDK.Core.Configuration { - using JetBrains.Annotations; - using System; + using JetBrains.Annotations; + using System; - + [PublicAPI] public class SteamId { protected readonly long Value; diff --git a/Controllers/ControllerConfiguration.cs b/Controllers/ControllerConfiguration.cs index 714f2c7..3f9b7cc 100644 --- a/Controllers/ControllerConfiguration.cs +++ b/Controllers/ControllerConfiguration.cs @@ -1,9 +1,9 @@ -namespace NFive.SDK.Core.Controllers +namespace NFive.SDK.Core.Controllers { - using JetBrains.Annotations; - using System; + using JetBrains.Annotations; + using System; - + [PublicAPI] [Serializable] public abstract class ControllerConfiguration : IControllerConfiguration { diff --git a/Controllers/IControllerConfiguration.cs b/Controllers/IControllerConfiguration.cs index fc0b5fd..078a1b9 100644 --- a/Controllers/IControllerConfiguration.cs +++ b/Controllers/IControllerConfiguration.cs @@ -1,7 +1,19 @@ -namespace NFive.SDK.Core.Controllers +namespace NFive.SDK.Core.Controllers { - public interface IControllerConfiguration - { - string FileName { get; } - } -} \ No newline at end of file + using JetBrains.Annotations; + + /// + /// Represents the configuration that is automatically loaded into a ConfigurableController. + /// + [PublicAPI] + public interface IControllerConfiguration + { + /// + /// Gets the name of the file this configuration is saved as. + /// + /// + /// The name of the file without the extension. + /// + string FileName { get; } + } +} diff --git a/Diagnostics/ILogger.cs b/Diagnostics/ILogger.cs index 82eb1aa..db8961b 100644 --- a/Diagnostics/ILogger.cs +++ b/Diagnostics/ILogger.cs @@ -7,7 +7,7 @@ namespace NFive.SDK.Core.Diagnostics /// /// Provides logging interface and utility functions. /// - + [PublicAPI] public interface ILogger { /// diff --git a/Diagnostics/LogLevel.cs b/Diagnostics/LogLevel.cs index 742c0fa..c5a0e43 100644 --- a/Diagnostics/LogLevel.cs +++ b/Diagnostics/LogLevel.cs @@ -7,7 +7,7 @@ namespace NFive.SDK.Core.Diagnostics /// /// Defines available log levels. /// - + [PublicAPI] public enum LogLevel { /// diff --git a/Events/CoreEvents.cs b/Events/CoreEvents.cs index 52b3103..74b422d 100644 --- a/Events/CoreEvents.cs +++ b/Events/CoreEvents.cs @@ -1,11 +1,11 @@ -namespace NFive.SDK.Core.Events +namespace NFive.SDK.Core.Events { using JetBrains.Annotations; /// /// Core NFive events. /// - + [PublicAPI] public static class CoreEvents { /// diff --git a/Extensions/StringExtensions.cs b/Extensions/StringExtensions.cs index 8575eef..a5847d8 100644 --- a/Extensions/StringExtensions.cs +++ b/Extensions/StringExtensions.cs @@ -1,11 +1,11 @@ -namespace NFive.SDK.Core.Extensions +namespace NFive.SDK.Core.Extensions { using JetBrains.Annotations; using System.Globalization; using System.Linq; using System.Text.RegularExpressions; - + [PublicAPI] public static class StringExtensions { public static string Pluralize(this string str, int value, string extension = "s", CultureInfo culture = null) diff --git a/Locales/ILocaleCatalog.cs b/Locales/ILocaleCatalog.cs index 32d9413..35cb4a7 100644 --- a/Locales/ILocaleCatalog.cs +++ b/Locales/ILocaleCatalog.cs @@ -1,9 +1,9 @@ -namespace NFive.SDK.Core.Locales +namespace NFive.SDK.Core.Locales { using JetBrains.Annotations; using System.Globalization; - + [PublicAPI] public interface ILocaleCatalog { /// Gets the catalog culture. diff --git a/Models/IIdentityModel.cs b/Models/IIdentityModel.cs index 79c3905..af36d93 100644 --- a/Models/IIdentityModel.cs +++ b/Models/IIdentityModel.cs @@ -1,4 +1,4 @@ -namespace NFive.SDK.Core.Models +namespace NFive.SDK.Core.Models { using JetBrains.Annotations; using System; @@ -6,7 +6,7 @@ /// /// Represents the key properties for a stored model. /// - + [PublicAPI] public interface IIdentityModel { /// diff --git a/Models/IdentityModel.cs b/Models/IdentityModel.cs index 4d050dc..6636ee7 100644 --- a/Models/IdentityModel.cs +++ b/Models/IdentityModel.cs @@ -1,13 +1,15 @@ -namespace NFive.SDK.Core.Models +namespace NFive.SDK.Core.Models { using System; - using NFive.SDK.Core.Helpers; + using System.ComponentModel.DataAnnotations; + using JetBrains.Annotations; + using NFive.SDK.Core.Helpers; /// /// /// Represents the key properties for a stored model. /// - + [PublicAPI] public abstract class IdentityModel : IIdentityModel { /// @@ -17,6 +19,8 @@ public abstract class IdentityModel : IIdentityModel /// /// The model identifier. /// + [Key] + [Required] public Guid Id { get; set; } /// @@ -26,6 +30,7 @@ public abstract class IdentityModel : IIdentityModel /// /// The timestamp of when the model was created. /// + [Required] public DateTime Created { get; set; } /// diff --git a/Models/Player/Session.cs b/Models/Player/Session.cs index 7573b14..8e0f738 100644 --- a/Models/Player/Session.cs +++ b/Models/Player/Session.cs @@ -1,13 +1,15 @@ -namespace NFive.SDK.Core.Models.Player +namespace NFive.SDK.Core.Models.Player { using JetBrains.Annotations; using Newtonsoft.Json; using System; + using System.ComponentModel.DataAnnotations; + using System.ComponentModel.DataAnnotations.Schema; /// - /// Session model representing a user's connection to the server. - /// - + /// Session model representing a user's connection to the server. + /// + [PublicAPI] public class Session { /// @@ -16,6 +18,8 @@ public class Session /// /// The session identifier. /// + [Key] + [Required] public Guid Id { get; set; } /// @@ -24,6 +28,8 @@ public class Session /// /// The IP address of the connected client. /// + [Required] + [StringLength(47, MinimumLength = 5)] // [::1] through [0000:0000:0000:0000:0000:0000:000.000.000.000] /// // [::1] through [0000:0000:0000:0000:0000:0000:000.000.000.000] public string IpAddress { get; set; } @@ -33,6 +39,7 @@ public class Session /// /// The timestamp of when the session was created. /// + [Required] public DateTime Created { get; set; } = DateTime.UtcNow; /// @@ -57,6 +64,7 @@ public class Session /// /// The reason the client disconnected. /// + [StringLength(200)] public string DisconnectReason { get; set; } /// @@ -65,6 +73,7 @@ public class Session /// /// The handle of the connected client. /// + [NotMapped] public int Handle { get; set; } /// @@ -73,6 +82,8 @@ public class Session /// /// The user identifier. /// + [Required] + [ForeignKey("User")] public Guid UserId { get; set; } /// diff --git a/Models/Player/User.cs b/Models/Player/User.cs index d0dd5ff..235c0d8 100644 --- a/Models/Player/User.cs +++ b/Models/Player/User.cs @@ -1,14 +1,16 @@ -namespace NFive.SDK.Core.Models.Player +namespace NFive.SDK.Core.Models.Player { using JetBrains.Annotations; using System.Collections.Generic; + using System.ComponentModel.DataAnnotations; + using System.ComponentModel.DataAnnotations.Schema; - /// - /// - /// User model representing the player on the server. - /// - /// - + /// + /// + /// User model representing the player on the server. + /// + /// + [PublicAPI] public class User : IdentityModel { /// @@ -17,6 +19,8 @@ public class User : IdentityModel /// /// The license. /// + [Required] + [StringLength(40, MinimumLength = 40)] public string License { get; set; } /// @@ -33,6 +37,8 @@ public class User : IdentityModel /// /// The player name. /// + [Required] + [StringLength(32, MinimumLength = 1)] // TODO: Confirm public string Name { get; set; } /// @@ -41,6 +47,7 @@ public class User : IdentityModel /// /// The sessions. /// + [InverseProperty("User")] public virtual List Sessions { get; set; } } } diff --git a/Models/Position.cs b/Models/Position.cs index 11f11cd..501e753 100644 --- a/Models/Position.cs +++ b/Models/Position.cs @@ -1,11 +1,14 @@ -namespace NFive.SDK.Core.Models +namespace NFive.SDK.Core.Models { + using System.ComponentModel.DataAnnotations; + using System.ComponentModel.DataAnnotations.Schema; using JetBrains.Annotations; /// /// Represents a position in 3D space. /// - + [PublicAPI] + [ComplexType] public class Position { /// @@ -14,6 +17,7 @@ public class Position /// /// The position on the X axis. /// + [Required] public float X { get; set; } /// @@ -22,6 +26,7 @@ public class Position /// /// The position on the Y axis. /// + [Required] public float Y { get; set; } /// @@ -30,6 +35,7 @@ public class Position /// /// The position on the Z axis. /// + [Required] public float Z { get; set; } /// diff --git a/Plugins/Client.cs b/Plugins/Client.cs index f7d91e6..9771ed3 100644 --- a/Plugins/Client.cs +++ b/Plugins/Client.cs @@ -1,10 +1,10 @@ -namespace NFive.SDK.Core.Plugins +namespace NFive.SDK.Core.Plugins { using JetBrains.Annotations; using System; using System.Collections.Generic; - + [PublicAPI] [Serializable] public class Client { diff --git a/Plugins/Name.cs b/Plugins/Name.cs index 2ad2de9..978444f 100644 --- a/Plugins/Name.cs +++ b/Plugins/Name.cs @@ -1,12 +1,12 @@ -namespace NFive.SDK.Core.Plugins +namespace NFive.SDK.Core.Plugins { using JetBrains.Annotations; using Newtonsoft.Json; using System; + [PublicAPI] [Serializable] - - public class Name + public class Name { /// /// Gets or sets the plugin name vendor. diff --git a/Plugins/Plugin.cs b/Plugins/Plugin.cs index 9564bcf..2e1924b 100644 --- a/Plugins/Plugin.cs +++ b/Plugins/Plugin.cs @@ -1,11 +1,11 @@ -namespace NFive.SDK.Core.Plugins +namespace NFive.SDK.Core.Plugins { using JetBrains.Annotations; using System; using System.Collections.Generic; - - [Serializable] + [PublicAPI] + [Serializable] public class Plugin { /// diff --git a/Plugins/Repository.cs b/Plugins/Repository.cs index fb84f0c..ddc9549 100644 --- a/Plugins/Repository.cs +++ b/Plugins/Repository.cs @@ -1,9 +1,9 @@ -namespace NFive.SDK.Core.Plugins +namespace NFive.SDK.Core.Plugins { using JetBrains.Annotations; using System; - + [PublicAPI] [Serializable] public class Repository { diff --git a/Plugins/Server.cs b/Plugins/Server.cs index 913a092..5200a99 100644 --- a/Plugins/Server.cs +++ b/Plugins/Server.cs @@ -1,9 +1,10 @@ -namespace NFive.SDK.Core.Plugins +namespace NFive.SDK.Core.Plugins { using System; using System.Collections.Generic; + using JetBrains.Annotations; - //g + [PublicAPI] [Serializable] public class Server { diff --git a/Plugins/Version.cs b/Plugins/Version.cs index f0c835a..be76eee 100644 --- a/Plugins/Version.cs +++ b/Plugins/Version.cs @@ -1,10 +1,10 @@ -namespace NFive.SDK.Core.Plugins +namespace NFive.SDK.Core.Plugins { using JetBrains.Annotations; using System; + [PublicAPI] [Serializable] - public class Version { /// diff --git a/Plugins/VersionRange.cs b/Plugins/VersionRange.cs index 8d38f34..a7ec783 100644 --- a/Plugins/VersionRange.cs +++ b/Plugins/VersionRange.cs @@ -1,11 +1,11 @@ -namespace NFive.SDK.Core.Plugins +namespace NFive.SDK.Core.Plugins { using JetBrains.Annotations; using System; + [PublicAPI] [Serializable] - - public class VersionRange + public class VersionRange { /// /// Gets or sets the version range. diff --git a/Utilities/Serializer.cs b/Utilities/Serializer.cs index 57fab02..f86e88a 100644 --- a/Utilities/Serializer.cs +++ b/Utilities/Serializer.cs @@ -1,4 +1,4 @@ -namespace NFive.SDK.Core.Utilities +namespace NFive.SDK.Core.Utilities { using JetBrains.Annotations; using Newtonsoft.Json; @@ -6,7 +6,7 @@ /// /// Utilities to convert objects to and from JSON strings. /// - + [PublicAPI] public class Serializer { /// Gets or sets the formatting option for the serializer. From dddd7497e83b0586647b0d152700f166b18d25a2 Mon Sep 17 00:00:00 2001 From: steveski Date: Thu, 30 Jun 2022 23:56:39 +1000 Subject: [PATCH 7/9] Moved deepest scopre usings to outer --- Configuration/LocaleConfiguration.cs | 10 +++++----- Configuration/SteamId.cs | 6 +++--- Controllers/ControllerConfiguration.cs | 6 +++--- Controllers/IControllerConfiguration.cs | 4 ++-- Diagnostics/ILogger.cs | 7 +++---- Diagnostics/LogLevel.cs | 6 ++---- Events/CoreEvents.cs | 4 ++-- Extensions/NumericExtensions.cs | 6 +++--- Extensions/PositionExtensions.cs | 8 ++++---- Extensions/StringExtensions.cs | 12 ++++++------ Extensions/Vector2Extensions.cs | 8 ++++---- Extensions/Vector3Extensions.cs | 8 ++++---- Helpers/GuidGenerator.cs | 11 +++++------ Helpers/MathHelpers.cs | 4 ++-- Input/ControllerInput.cs | 4 ++-- Input/InputControl.cs | 4 ++-- Input/InputMethod.cs | 4 ++-- Input/InputModifier.cs | 6 +++--- Input/KeyCode.cs | 4 ++-- Locales/ILocaleCatalog.cs | 8 ++++---- Models/Audio/RadioStation.cs | 4 ++-- Models/Color.cs | 6 +++--- Models/IIdentityModel.cs | 6 +++--- Models/IdentityModel.cs | 10 +++++----- Models/Player/Session.cs | 14 +++++++------- Models/Player/User.cs | 10 +++++----- Models/Position.cs | 8 ++++---- Models/Vector2.cs | 8 ++++---- Models/Vector3.cs | 6 +++--- NFive.SDK.Core.sln.DotSettings | 2 +- PluginAttribute.cs | 5 ++--- Plugins/Client.cs | 10 +++++----- Plugins/Name.cs | 10 +++++----- Plugins/Plugin.cs | 8 ++++---- Plugins/Repository.cs | 8 ++++---- Plugins/Server.cs | 8 ++++---- Plugins/Version.cs | 8 ++++---- Plugins/VersionRange.cs | 8 ++++---- Utilities/Serializer.cs | 6 +++--- 39 files changed, 135 insertions(+), 140 deletions(-) diff --git a/Configuration/LocaleConfiguration.cs b/Configuration/LocaleConfiguration.cs index 6e78a7d..83656e1 100644 --- a/Configuration/LocaleConfiguration.cs +++ b/Configuration/LocaleConfiguration.cs @@ -1,10 +1,10 @@ +using JetBrains.Annotations; +using System; +using System.Collections.Generic; +using System.Globalization; + namespace NFive.SDK.Core.Configuration { - using JetBrains.Annotations; - using System; - using System.Collections.Generic; - using System.Globalization; - [PublicAPI] public class LocaleConfiguration { diff --git a/Configuration/SteamId.cs b/Configuration/SteamId.cs index 30f7062..7276bb4 100644 --- a/Configuration/SteamId.cs +++ b/Configuration/SteamId.cs @@ -1,8 +1,8 @@ +using JetBrains.Annotations; +using System; + namespace NFive.SDK.Core.Configuration { - using JetBrains.Annotations; - using System; - [PublicAPI] public class SteamId { diff --git a/Controllers/ControllerConfiguration.cs b/Controllers/ControllerConfiguration.cs index 3f9b7cc..f6b8297 100644 --- a/Controllers/ControllerConfiguration.cs +++ b/Controllers/ControllerConfiguration.cs @@ -1,8 +1,8 @@ +using JetBrains.Annotations; +using System; + namespace NFive.SDK.Core.Controllers { - using JetBrains.Annotations; - using System; - [PublicAPI] [Serializable] public abstract class ControllerConfiguration : IControllerConfiguration diff --git a/Controllers/IControllerConfiguration.cs b/Controllers/IControllerConfiguration.cs index 078a1b9..d39db19 100644 --- a/Controllers/IControllerConfiguration.cs +++ b/Controllers/IControllerConfiguration.cs @@ -1,7 +1,7 @@ +using JetBrains.Annotations; + namespace NFive.SDK.Core.Controllers { - using JetBrains.Annotations; - /// /// Represents the configuration that is automatically loaded into a ConfigurableController. /// diff --git a/Diagnostics/ILogger.cs b/Diagnostics/ILogger.cs index db8961b..de5f042 100644 --- a/Diagnostics/ILogger.cs +++ b/Diagnostics/ILogger.cs @@ -1,9 +1,8 @@ +using JetBrains.Annotations; +using System; + namespace NFive.SDK.Core.Diagnostics { - using JetBrains.Annotations; - using System; - //using JetBrains.Annotations; - /// /// Provides logging interface and utility functions. /// diff --git a/Diagnostics/LogLevel.cs b/Diagnostics/LogLevel.cs index c5a0e43..c6d6cb9 100644 --- a/Diagnostics/LogLevel.cs +++ b/Diagnostics/LogLevel.cs @@ -1,9 +1,7 @@ +using JetBrains.Annotations; + namespace NFive.SDK.Core.Diagnostics { - using JetBrains.Annotations; - - //using JetBrains.Annotations; - /// /// Defines available log levels. /// diff --git a/Events/CoreEvents.cs b/Events/CoreEvents.cs index 74b422d..a2b4de0 100644 --- a/Events/CoreEvents.cs +++ b/Events/CoreEvents.cs @@ -1,7 +1,7 @@ +using JetBrains.Annotations; + namespace NFive.SDK.Core.Events { - using JetBrains.Annotations; - /// /// Core NFive events. /// diff --git a/Extensions/NumericExtensions.cs b/Extensions/NumericExtensions.cs index b8ac9ef..e3359dc 100644 --- a/Extensions/NumericExtensions.cs +++ b/Extensions/NumericExtensions.cs @@ -1,8 +1,8 @@ +using JetBrains.Annotations; +using System; + namespace NFive.SDK.Core.Extensions { - using System; - using JetBrains.Annotations; - [PublicAPI] public static class NumericExtensions { diff --git a/Extensions/PositionExtensions.cs b/Extensions/PositionExtensions.cs index 8dc3959..76a9723 100644 --- a/Extensions/PositionExtensions.cs +++ b/Extensions/PositionExtensions.cs @@ -1,9 +1,9 @@ +using JetBrains.Annotations; +using NFive.SDK.Core.Models; +using System; + namespace NFive.SDK.Core.Extensions { - using System; - using JetBrains.Annotations; - using NFive.SDK.Core.Models; - [PublicAPI] [Obsolete] public static class PositionExtensions diff --git a/Extensions/StringExtensions.cs b/Extensions/StringExtensions.cs index a5847d8..45839e4 100644 --- a/Extensions/StringExtensions.cs +++ b/Extensions/StringExtensions.cs @@ -1,11 +1,11 @@ +using JetBrains.Annotations; +using System.Globalization; +using System.Linq; +using System.Text.RegularExpressions; + namespace NFive.SDK.Core.Extensions { - using JetBrains.Annotations; - using System.Globalization; - using System.Linq; - using System.Text.RegularExpressions; - - [PublicAPI] + [PublicAPI] public static class StringExtensions { public static string Pluralize(this string str, int value, string extension = "s", CultureInfo culture = null) diff --git a/Extensions/Vector2Extensions.cs b/Extensions/Vector2Extensions.cs index ca5868f..301cb52 100644 --- a/Extensions/Vector2Extensions.cs +++ b/Extensions/Vector2Extensions.cs @@ -1,9 +1,9 @@ +using JetBrains.Annotations; +using NFive.SDK.Core.Models; +using System; + namespace NFive.SDK.Core.Extensions { - using System; - using JetBrains.Annotations; - using NFive.SDK.Core.Models; - [PublicAPI] public static class Vector2Extensions { diff --git a/Extensions/Vector3Extensions.cs b/Extensions/Vector3Extensions.cs index 45fef06..ebfa319 100644 --- a/Extensions/Vector3Extensions.cs +++ b/Extensions/Vector3Extensions.cs @@ -1,9 +1,9 @@ +using JetBrains.Annotations; +using NFive.SDK.Core.Models; +using System; + namespace NFive.SDK.Core.Extensions { - using System; - using JetBrains.Annotations; - using NFive.SDK.Core.Models; - [PublicAPI] public static class Vector3Extensions { diff --git a/Helpers/GuidGenerator.cs b/Helpers/GuidGenerator.cs index ae83589..06252f3 100644 --- a/Helpers/GuidGenerator.cs +++ b/Helpers/GuidGenerator.cs @@ -1,10 +1,9 @@ -namespace NFive.SDK.Core.Helpers -{ - using JetBrains.Annotations; - using System; - //using System.Security.Cryptography; +using System; +//using System.Security.Cryptography; + - +namespace NFive.SDK.Core.Helpers +{ public static class GuidGenerator { /// diff --git a/Helpers/MathHelpers.cs b/Helpers/MathHelpers.cs index 2c0bb96..5c30c6d 100644 --- a/Helpers/MathHelpers.cs +++ b/Helpers/MathHelpers.cs @@ -1,7 +1,7 @@ +using JetBrains.Annotations; + namespace NFive.SDK.Core.Helpers { - using JetBrains.Annotations; - [PublicAPI] public static class MathHelpers { diff --git a/Input/ControllerInput.cs b/Input/ControllerInput.cs index cbea589..39bf451 100644 --- a/Input/ControllerInput.cs +++ b/Input/ControllerInput.cs @@ -1,7 +1,7 @@ +using JetBrains.Annotations; + namespace NFive.SDK.Core.Input { - using JetBrains.Annotations; - /// /// Represents the inputs on a Xbox One controller as supported by GTA. /// See Xbox support for button naming. diff --git a/Input/InputControl.cs b/Input/InputControl.cs index de01ef1..81a070d 100644 --- a/Input/InputControl.cs +++ b/Input/InputControl.cs @@ -1,7 +1,7 @@ +using JetBrains.Annotations; + namespace NFive.SDK.Core.Input { - using JetBrains.Annotations; - /// /// Represents the native GTA input controls. /// diff --git a/Input/InputMethod.cs b/Input/InputMethod.cs index cb6a7b8..c120e29 100644 --- a/Input/InputMethod.cs +++ b/Input/InputMethod.cs @@ -1,7 +1,7 @@ +using JetBrains.Annotations; + namespace NFive.SDK.Core.Input { - using JetBrains.Annotations; - /// /// Represents the available input methods. /// diff --git a/Input/InputModifier.cs b/Input/InputModifier.cs index 368bd11..a36b453 100644 --- a/Input/InputModifier.cs +++ b/Input/InputModifier.cs @@ -1,8 +1,8 @@ +using JetBrains.Annotations; +using System; + namespace NFive.SDK.Core.Input { - using System; - using JetBrains.Annotations; - [PublicAPI] [Flags] public enum InputModifier diff --git a/Input/KeyCode.cs b/Input/KeyCode.cs index 5bc4ecd..24ba93b 100644 --- a/Input/KeyCode.cs +++ b/Input/KeyCode.cs @@ -1,7 +1,7 @@ +using JetBrains.Annotations; + namespace NFive.SDK.Core.Input { - using JetBrains.Annotations; - [PublicAPI] public enum KeyCode { diff --git a/Locales/ILocaleCatalog.cs b/Locales/ILocaleCatalog.cs index 35cb4a7..cf8e621 100644 --- a/Locales/ILocaleCatalog.cs +++ b/Locales/ILocaleCatalog.cs @@ -1,9 +1,9 @@ +using JetBrains.Annotations; +using System.Globalization; + namespace NFive.SDK.Core.Locales { - using JetBrains.Annotations; - using System.Globalization; - - [PublicAPI] + [PublicAPI] public interface ILocaleCatalog { /// Gets the catalog culture. diff --git a/Models/Audio/RadioStation.cs b/Models/Audio/RadioStation.cs index f7aa782..ac1116e 100644 --- a/Models/Audio/RadioStation.cs +++ b/Models/Audio/RadioStation.cs @@ -1,7 +1,7 @@ +using JetBrains.Annotations; + namespace NFive.SDK.Core.Models.Audio { - using JetBrains.Annotations; - /// /// GTA radio stations. /// diff --git a/Models/Color.cs b/Models/Color.cs index d004d29..9591f16 100644 --- a/Models/Color.cs +++ b/Models/Color.cs @@ -1,8 +1,8 @@ +using JetBrains.Annotations; +using System.ComponentModel.DataAnnotations.Schema; + namespace NFive.SDK.Core.Models { - using System.ComponentModel.DataAnnotations.Schema; - using JetBrains.Annotations; - /// /// Represents an ARGB (alpha, red, green, blue) color. /// diff --git a/Models/IIdentityModel.cs b/Models/IIdentityModel.cs index af36d93..c7fd1e9 100644 --- a/Models/IIdentityModel.cs +++ b/Models/IIdentityModel.cs @@ -1,8 +1,8 @@ +using JetBrains.Annotations; +using System; + namespace NFive.SDK.Core.Models { - using JetBrains.Annotations; - using System; - /// /// Represents the key properties for a stored model. /// diff --git a/Models/IdentityModel.cs b/Models/IdentityModel.cs index 6636ee7..21ae31b 100644 --- a/Models/IdentityModel.cs +++ b/Models/IdentityModel.cs @@ -1,10 +1,10 @@ +using JetBrains.Annotations; +using NFive.SDK.Core.Helpers; +using System; +using System.ComponentModel.DataAnnotations; + namespace NFive.SDK.Core.Models { - using System; - using System.ComponentModel.DataAnnotations; - using JetBrains.Annotations; - using NFive.SDK.Core.Helpers; - /// /// /// Represents the key properties for a stored model. diff --git a/Models/Player/Session.cs b/Models/Player/Session.cs index 8e0f738..361e71f 100644 --- a/Models/Player/Session.cs +++ b/Models/Player/Session.cs @@ -1,12 +1,12 @@ +using JetBrains.Annotations; +using Newtonsoft.Json; +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + namespace NFive.SDK.Core.Models.Player { - using JetBrains.Annotations; - using Newtonsoft.Json; - using System; - using System.ComponentModel.DataAnnotations; - using System.ComponentModel.DataAnnotations.Schema; - - /// + /// /// Session model representing a user's connection to the server. /// [PublicAPI] diff --git a/Models/Player/User.cs b/Models/Player/User.cs index 235c0d8..74cb1de 100644 --- a/Models/Player/User.cs +++ b/Models/Player/User.cs @@ -1,10 +1,10 @@ +using JetBrains.Annotations; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + namespace NFive.SDK.Core.Models.Player { - using JetBrains.Annotations; - using System.Collections.Generic; - using System.ComponentModel.DataAnnotations; - using System.ComponentModel.DataAnnotations.Schema; - /// /// /// User model representing the player on the server. diff --git a/Models/Position.cs b/Models/Position.cs index 501e753..ff02609 100644 --- a/Models/Position.cs +++ b/Models/Position.cs @@ -1,9 +1,9 @@ +using JetBrains.Annotations; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + namespace NFive.SDK.Core.Models { - using System.ComponentModel.DataAnnotations; - using System.ComponentModel.DataAnnotations.Schema; - using JetBrains.Annotations; - /// /// Represents a position in 3D space. /// diff --git a/Models/Vector2.cs b/Models/Vector2.cs index cbe2353..5df8139 100644 --- a/Models/Vector2.cs +++ b/Models/Vector2.cs @@ -1,9 +1,9 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using JetBrains.Annotations; + namespace NFive.SDK.Core.Models { - using System.ComponentModel.DataAnnotations; - using System.ComponentModel.DataAnnotations.Schema; - using JetBrains.Annotations; - /// /// Represents a position in 2D space. /// diff --git a/Models/Vector3.cs b/Models/Vector3.cs index 82da722..0d887c2 100644 --- a/Models/Vector3.cs +++ b/Models/Vector3.cs @@ -1,8 +1,8 @@ +using JetBrains.Annotations; +using System.ComponentModel.DataAnnotations; + namespace NFive.SDK.Core.Models { - using System.ComponentModel.DataAnnotations; - using JetBrains.Annotations; - /// /// Represents a position in 3D space. /// diff --git a/NFive.SDK.Core.sln.DotSettings b/NFive.SDK.Core.sln.DotSettings index 9bda150..6efaac0 100644 --- a/NFive.SDK.Core.sln.DotSettings +++ b/NFive.SDK.Core.sln.DotSettings @@ -75,7 +75,7 @@ </Entry> </TypePattern> </Patterns> - True + False DOF FOV HUD diff --git a/PluginAttribute.cs b/PluginAttribute.cs index 47e42e5..719c646 100644 --- a/PluginAttribute.cs +++ b/PluginAttribute.cs @@ -1,7 +1,6 @@ -namespace NFive.SDK.Core +namespace NFive.SDK.Core { - using JetBrains.Annotations; - using System; + using System; [AttributeUsage(AttributeTargets.Assembly)] diff --git a/Plugins/Client.cs b/Plugins/Client.cs index 9771ed3..35610d5 100644 --- a/Plugins/Client.cs +++ b/Plugins/Client.cs @@ -1,10 +1,10 @@ +using JetBrains.Annotations; +using System; +using System.Collections.Generic; + namespace NFive.SDK.Core.Plugins { - using JetBrains.Annotations; - using System; - using System.Collections.Generic; - - [PublicAPI] + [PublicAPI] [Serializable] public class Client { diff --git a/Plugins/Name.cs b/Plugins/Name.cs index 978444f..86fa272 100644 --- a/Plugins/Name.cs +++ b/Plugins/Name.cs @@ -1,10 +1,10 @@ +using JetBrains.Annotations; +using Newtonsoft.Json; +using System; + namespace NFive.SDK.Core.Plugins { - using JetBrains.Annotations; - using Newtonsoft.Json; - using System; - - [PublicAPI] + [PublicAPI] [Serializable] public class Name { diff --git a/Plugins/Plugin.cs b/Plugins/Plugin.cs index 2e1924b..95523fe 100644 --- a/Plugins/Plugin.cs +++ b/Plugins/Plugin.cs @@ -1,9 +1,9 @@ +using JetBrains.Annotations; +using System; +using System.Collections.Generic; + namespace NFive.SDK.Core.Plugins { - using JetBrains.Annotations; - using System; - using System.Collections.Generic; - [PublicAPI] [Serializable] public class Plugin diff --git a/Plugins/Repository.cs b/Plugins/Repository.cs index ddc9549..b4db80b 100644 --- a/Plugins/Repository.cs +++ b/Plugins/Repository.cs @@ -1,9 +1,9 @@ +using JetBrains.Annotations; +using System; + namespace NFive.SDK.Core.Plugins { - using JetBrains.Annotations; - using System; - - [PublicAPI] + [PublicAPI] [Serializable] public class Repository { diff --git a/Plugins/Server.cs b/Plugins/Server.cs index 5200a99..6f194df 100644 --- a/Plugins/Server.cs +++ b/Plugins/Server.cs @@ -1,9 +1,9 @@ +using JetBrains.Annotations; +using System; +using System.Collections.Generic; + namespace NFive.SDK.Core.Plugins { - using System; - using System.Collections.Generic; - using JetBrains.Annotations; - [PublicAPI] [Serializable] public class Server diff --git a/Plugins/Version.cs b/Plugins/Version.cs index be76eee..bf8e606 100644 --- a/Plugins/Version.cs +++ b/Plugins/Version.cs @@ -1,9 +1,9 @@ +using JetBrains.Annotations; +using System; + namespace NFive.SDK.Core.Plugins { - using JetBrains.Annotations; - using System; - - [PublicAPI] + [PublicAPI] [Serializable] public class Version { diff --git a/Plugins/VersionRange.cs b/Plugins/VersionRange.cs index a7ec783..936b336 100644 --- a/Plugins/VersionRange.cs +++ b/Plugins/VersionRange.cs @@ -1,9 +1,9 @@ +using JetBrains.Annotations; +using System; + namespace NFive.SDK.Core.Plugins { - using JetBrains.Annotations; - using System; - - [PublicAPI] + [PublicAPI] [Serializable] public class VersionRange { diff --git a/Utilities/Serializer.cs b/Utilities/Serializer.cs index f86e88a..cfabee9 100644 --- a/Utilities/Serializer.cs +++ b/Utilities/Serializer.cs @@ -1,8 +1,8 @@ +using JetBrains.Annotations; +using Newtonsoft.Json; + namespace NFive.SDK.Core.Utilities { - using JetBrains.Annotations; - using Newtonsoft.Json; - /// /// Utilities to convert objects to and from JSON strings. /// From a123516f67fcc373f46824118ca6d719ec6affd5 Mon Sep 17 00:00:00 2001 From: steveski Date: Fri, 1 Jul 2022 00:23:37 +1000 Subject: [PATCH 8/9] Some cleanup based on PR comments --- Models/Player/Session.cs | 1 - NFive.SDK.Core.csproj | 1 + NFive.SDK.Core.nuspec | 2 +- NFive.SDK.Core.sln | 18 ++++++++++-------- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Models/Player/Session.cs b/Models/Player/Session.cs index 361e71f..0a5ed75 100644 --- a/Models/Player/Session.cs +++ b/Models/Player/Session.cs @@ -30,7 +30,6 @@ public class Session /// [Required] [StringLength(47, MinimumLength = 5)] // [::1] through [0000:0000:0000:0000:0000:0000:000.000.000.000] - /// // [::1] through [0000:0000:0000:0000:0000:0000:000.000.000.000] public string IpAddress { get; set; } /// diff --git a/NFive.SDK.Core.csproj b/NFive.SDK.Core.csproj index 79c1cc0..cdfda2a 100644 --- a/NFive.SDK.Core.csproj +++ b/NFive.SDK.Core.csproj @@ -3,6 +3,7 @@ net471 NFive.SDK.Core + NFive.SDK.Core.net diff --git a/NFive.SDK.Core.nuspec b/NFive.SDK.Core.nuspec index f678f80..f804298 100644 --- a/NFive.SDK.Core.nuspec +++ b/NFive.SDK.Core.nuspec @@ -12,6 +12,6 @@ $description$ $copyright$ nfive fivem gtav - + diff --git a/NFive.SDK.Core.sln b/NFive.SDK.Core.sln index f320078..e71d847 100644 --- a/NFive.SDK.Core.sln +++ b/NFive.SDK.Core.sln @@ -1,22 +1,24 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 +Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.30114.105 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NFive.SDK.Core", "NFive.SDK.Core.csproj", "{6D978D8B-7C98-48CA-9EDD-22578DB1050F}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NFive.SDK.Core", "NFive.SDK.Core.csproj", "{C1DE80C7-579E-4D48-AAB8-37F5C1484F86}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C1DE80C7-579E-4D48-AAB8-37F5C1484F86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C1DE80C7-579E-4D48-AAB8-37F5C1484F86}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C1DE80C7-579E-4D48-AAB8-37F5C1484F86}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C1DE80C7-579E-4D48-AAB8-37F5C1484F86}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6D978D8B-7C98-48CA-9EDD-22578DB1050F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6D978D8B-7C98-48CA-9EDD-22578DB1050F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6D978D8B-7C98-48CA-9EDD-22578DB1050F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6D978D8B-7C98-48CA-9EDD-22578DB1050F}.Release|Any CPU.Build.0 = Release|Any CPU + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3A593D17-0FF9-43F8-9F3A-2BEE2A432C1A} EndGlobalSection EndGlobal From 2a4e2a31b7d0cb7262c6b61f13473019bf6fa9cd Mon Sep 17 00:00:00 2001 From: steveski Date: Fri, 1 Jul 2022 22:02:05 +1000 Subject: [PATCH 9/9] Added " to plugin name and put gitversion.yml under .github folder --- GitVersion.yml => .github/GitVersion.yml | 0 .github/workflows/cd.yml | 2 +- .github/workflows/ci.yml | 2 +- Plugins/Name.cs | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename GitVersion.yml => .github/GitVersion.yml (100%) diff --git a/GitVersion.yml b/.github/GitVersion.yml similarity index 100% rename from GitVersion.yml rename to .github/GitVersion.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 0868dfe..e2cf80e 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -27,7 +27,7 @@ jobs: uses: gittools/actions/gitversion/execute@v0.9.7 with: useConfigFile: true - configFilePath: ./GitVersion.yml + configFilePath: ./.github/GitVersion.yml build: name: Build and Release diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d3d785a..5fff13f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: uses: gittools/actions/gitversion/execute@v0.9.7 with: useConfigFile: true - configFilePath: ./GitVersion.yml + configFilePath: ./.github/GitVersion.yml build: runs-on: windows-latest diff --git a/Plugins/Name.cs b/Plugins/Name.cs index 86fa272..4e9c878 100644 --- a/Plugins/Name.cs +++ b/Plugins/Name.cs @@ -42,7 +42,7 @@ public Name(string value) var parts = value.Split('/'); - if (parts.Length != 2) throw new ArgumentException($"Invalid plugin name format {value}, plugin name must be in \"vendor/project\" format.", nameof(value)); + if (parts.Length != 2) throw new ArgumentException($"Invalid plugin name format \"{value}\", plugin name must be in \"vendor/project\" format.", nameof(value)); this.Vendor = parts[0]; this.Project = parts[1];