]> git.deb.at Git - rhonda/impostor.git/commitdiff
Code cleanup
authorjs6pak <kubastaron@hotmail.com>
Wed, 24 Mar 2021 15:57:11 +0000 (16:57 +0100)
committerjs6pak <kubastaron@hotmail.com>
Wed, 24 Mar 2021 15:57:11 +0000 (16:57 +0100)
166 files changed:
src/Impostor.Api/Events/Announcements/IAnnouncementRequestEvent.cs
src/Impostor.Api/Events/Attributes/EventListenerAttribute.cs
src/Impostor.Api/Events/Game/IGameCreatedEvent.cs
src/Impostor.Api/Events/Game/IGameDestroyedEvent.cs
src/Impostor.Api/Events/Game/IGameEvent.cs
src/Impostor.Api/Events/Game/IGameStartingEvent.cs
src/Impostor.Api/Events/Game/Player/IPlayerCompletedTaskEvent.cs
src/Impostor.Api/Events/Game/Player/IPlayerEvent.cs
src/Impostor.Api/Events/IEvent.cs
src/Impostor.Api/Events/IEventCancelable.cs
src/Impostor.Api/Events/IEventListener.cs
src/Impostor.Api/Events/Managers/IEventManager.cs
src/Impostor.Api/Extensions/SpanReaderExtensions.cs
src/Impostor.Api/Extensions/SystemTypesExtensions.cs
src/Impostor.Api/Games/Extensions/GameExtensions.cs
src/Impostor.Api/Games/Extensions/GameManagerExtensions.cs
src/Impostor.Api/Games/GameCode.cs
src/Impostor.Api/Games/GameJoinError.cs
src/Impostor.Api/Games/GameJoinResult.cs
src/Impostor.Api/Games/IGame.cs
src/Impostor.Api/Games/IGameCodeFactory.cs
src/Impostor.Api/Games/Managers/IGameManager.cs
src/Impostor.Api/Innersloth/AlterGameTags.cs
src/Impostor.Api/Innersloth/ChatNoteType.cs
src/Impostor.Api/Innersloth/DeathReason.cs
src/Impostor.Api/Innersloth/GameKeywords.cs
src/Impostor.Api/Innersloth/GameOptionsData.cs
src/Impostor.Api/Innersloth/GameStates.cs
src/Impostor.Api/Innersloth/GameVersion.cs
src/Impostor.Api/Innersloth/MapFlags.cs
src/Impostor.Api/Innersloth/MapTypes.cs
src/Impostor.Api/Innersloth/SystemTypeHelpers.cs
src/Impostor.Api/Innersloth/SystemTypes.cs
src/Impostor.Api/Innersloth/TaskTypes.cs
src/Impostor.Api/Innersloth/TextBox.cs
src/Impostor.Api/Net/IClient.cs
src/Impostor.Api/Net/IClientPlayer.cs
src/Impostor.Api/Net/IHazelConnection.cs
src/Impostor.Api/Net/Inner/IInnerNetObject.cs
src/Impostor.Api/Net/Inner/Objects/Components/IInnerCustomNetworkTransform.cs
src/Impostor.Api/Net/Inner/Objects/IInnerPlayerControl.cs
src/Impostor.Api/Net/Inner/Objects/ITaskInfo.cs
src/Impostor.Api/Net/LimboStates.cs
src/Impostor.Api/Net/Manager/IClientManager.cs
src/Impostor.Api/Net/Messages/C2S/Message00HostGameC2S.cs
src/Impostor.Api/Net/Messages/C2S/Message01JoinGameC2S.cs
src/Impostor.Api/Net/Messages/C2S/Message04RemovePlayerC2S.cs
src/Impostor.Api/Net/Messages/C2S/Message08EndGameC2S.cs
src/Impostor.Api/Net/Messages/C2S/Message10AlterGameC2S.cs
src/Impostor.Api/Net/Messages/C2S/Message11KickPlayerC2S.cs
src/Impostor.Api/Net/Messages/C2S/Message16GetGameListC2S.cs
src/Impostor.Api/Net/Messages/IMessageReader.cs
src/Impostor.Api/Net/Messages/IMessageWriter.cs
src/Impostor.Api/Net/Messages/IMessageWriterProvider.cs
src/Impostor.Api/Net/Messages/MessageFlags.cs
src/Impostor.Api/Net/Messages/MessageType.cs
src/Impostor.Api/Net/Messages/S2C/Message00HostGameS2C.cs
src/Impostor.Api/Net/Messages/S2C/Message01JoinGameS2C.cs
src/Impostor.Api/Net/Messages/S2C/Message04RemovePlayerS2C.cs
src/Impostor.Api/Net/Messages/S2C/Message07JoinedGameS2C.cs
src/Impostor.Api/Net/Messages/S2C/Message10AlterGameS2C.cs
src/Impostor.Api/Net/Messages/S2C/Message11KickPlayerS2C.cs
src/Impostor.Api/Net/Messages/S2C/Message12WaitForHostS2C.cs
src/Impostor.Api/Net/Messages/S2C/Message13RedirectS2C.cs
src/Impostor.Api/Net/Messages/S2C/Message16GetGameListS2C.cs
src/Impostor.Api/Plugins/IPlugin.cs
src/Impostor.Api/Plugins/IPluginStartup.cs
src/Impostor.Api/Plugins/ImpostorPluginAttribute.cs
src/Impostor.Api/Plugins/PluginBase.cs
src/Impostor.Api/Properties/AssemblyInfo.cs
src/Impostor.Api/Reactor/PluginSide.cs
src/Impostor.Api/Unity/Mathf.cs
src/Impostor.Benchmarks/Data/MessageReader_Bytes.cs
src/Impostor.Benchmarks/Data/MessageReader_Bytes_Pooled.cs
src/Impostor.Benchmarks/Data/MessageReader_Bytes_Pooled_Improved.cs
src/Impostor.Benchmarks/Data/MessageWriter.cs
src/Impostor.Benchmarks/Data/Span/MessageReader_Span.cs
src/Impostor.Benchmarks/Tests/MessageReaderBenchmark.cs
src/Impostor.Client.App/Program.cs
src/Impostor.Hazel/Connection.cs
src/Impostor.Hazel/ConnectionListener.cs
src/Impostor.Hazel/ConnectionState.cs
src/Impostor.Hazel/ConnectionStatistics.cs
src/Impostor.Hazel/DataReceivedEventArgs.cs
src/Impostor.Hazel/DisconnectedEventArgs.cs
src/Impostor.Hazel/HazelException.cs
src/Impostor.Hazel/IPMode.cs
src/Impostor.Hazel/IRecyclable.cs
src/Impostor.Hazel/MessageReader.cs
src/Impostor.Hazel/MessageWriter.cs
src/Impostor.Hazel/NetworkConnection.cs
src/Impostor.Hazel/NetworkConnectionListener.cs
src/Impostor.Hazel/NewConnectionEventArgs.cs
src/Impostor.Hazel/ObjectPoolCustom.cs
src/Impostor.Hazel/Udp/SendOptionInternal.cs
src/Impostor.Hazel/Udp/UdpBroadcastListener.cs
src/Impostor.Hazel/Udp/UdpBroadcaster.cs
src/Impostor.Hazel/Udp/UdpClientConnection.cs
src/Impostor.Hazel/Udp/UdpConnection.KeepAlive.cs
src/Impostor.Hazel/Udp/UdpConnection.Reliable.cs
src/Impostor.Hazel/Udp/UdpConnection.cs
src/Impostor.Hazel/Udp/UdpConnectionListener.cs
src/Impostor.Hazel/Udp/UdpConnectionRateLimit.cs
src/Impostor.Hazel/Udp/UdpServerConnection.cs
src/Impostor.Patcher/Impostor.Patcher.Cli/Program.cs
src/Impostor.Patcher/Impostor.Patcher.Shared/AmongUsModifier.cs
src/Impostor.Patcher/Impostor.Patcher.Shared/Configuration.cs
src/Impostor.Patcher/Impostor.Patcher.Shared/Events/ErrorEventArgs.cs
src/Impostor.Patcher/Impostor.Patcher.Shared/Events/SavedEventArgs.cs
src/Impostor.Patcher/Impostor.Patcher.Shared/Innersloth/RegionInfo.cs
src/Impostor.Patcher/Impostor.Patcher.Shared/Innersloth/ServerInfo.cs
src/Impostor.Patcher/Impostor.Patcher.WinForms/Forms/FrmMain.Designer.cs
src/Impostor.Patcher/Impostor.Patcher.WinForms/Forms/FrmMain.cs
src/Impostor.Patcher/Impostor.Patcher.WinForms/Program.cs
src/Impostor.Plugins.Debugger/DebugPlugin.cs
src/Impostor.Plugins.Debugger/DebugPluginStartup.cs
src/Impostor.Plugins.Example/ExamplePlugin.cs
src/Impostor.Plugins.Example/Handlers/PlayerEventListener.cs
src/Impostor.Server/Config/DisconnectMessages.cs
src/Impostor.Server/Constants.cs
src/Impostor.Server/Events/MultiDisposable.cs
src/Impostor.Server/Events/Register/RegisteredEventListener.cs
src/Impostor.Server/Events/Register/TemporaryEventRegister.cs
src/Impostor.Server/Extensions/NodeLocatorExtensions.cs
src/Impostor.Server/Extensions/TypeExtensions.cs
src/Impostor.Server/Net/Factories/IClientFactory.cs
src/Impostor.Server/Net/GameCodeFactory.cs
src/Impostor.Server/Net/Inner/GameObject.cs
src/Impostor.Server/Net/Inner/InnerNetObject.cs
src/Impostor.Server/Net/Inner/Objects/Components/InnerCustomNetworkTransform.cs
src/Impostor.Server/Net/Inner/Objects/Components/InnerPlayerPhysics.cs
src/Impostor.Server/Net/Inner/Objects/InnerLobbyBehaviour.cs
src/Impostor.Server/Net/Inner/Objects/InnerMeetingHud.cs
src/Impostor.Server/Net/Inner/Objects/Systems/IActivatable.cs
src/Impostor.Server/Net/Inner/Objects/Systems/ISystemType.cs
src/Impostor.Server/Net/Inner/Objects/Systems/ShipStatus/HudOverrideSystemType.cs
src/Impostor.Server/Net/Inner/Objects/Systems/ShipStatus/LifeSuppSystemType.cs
src/Impostor.Server/Net/Inner/Objects/Systems/ShipStatus/MedScanSystem.cs
src/Impostor.Server/Net/Inner/Objects/Systems/ShipStatus/ReactorSystemType.cs
src/Impostor.Server/Net/Inner/Objects/Systems/ShipStatus/SabotageSystemType.cs
src/Impostor.Server/Net/Inner/Objects/Systems/ShipStatus/SecurityCameraSystemType.cs
src/Impostor.Server/Net/Inner/Objects/Systems/ShipStatus/SwitchSystem.cs
src/Impostor.Server/Net/Inner/SpawnFlags.cs
src/Impostor.Server/Net/Manager/ClientManager.Api.cs
src/Impostor.Server/Net/Manager/GameManager.cs
src/Impostor.Server/Net/Redirector/ClientRedirector.cs
src/Impostor.Server/Net/Redirector/INodeProvider.cs
src/Impostor.Server/Net/Redirector/NodeProviderConfig.cs
src/Impostor.Server/Net/State/Game.Data.cs
src/Impostor.Server/Net/State/Game.Outgoing.cs
src/Impostor.Server/Plugins/IAssemblyInformation.cs
src/Impostor.Server/Plugins/LoadedAssemblyInformation.cs
src/Impostor.Server/Plugins/PluginConfig.cs
src/Impostor.Server/Plugins/PluginLoaderService.cs
src/Impostor.Server/Properties/AssemblyInfo.cs
src/Impostor.Server/Recorder/PacketRecorder.cs
src/Impostor.Server/Recorder/PacketSerializationContextPooledObjectPolicy.cs
src/Impostor.Server/Recorder/ServerReplayVersion.cs
src/Impostor.Tests/Events/EventManagerTests.cs
src/Impostor.Tests/GameCodeTests.cs
src/Impostor.Tests/Hazel/MessageReaderTests.cs
src/Impostor.Tests/Hazel/MessageWriterTests.cs
src/Impostor.Tools.Proxy/HexUtils.cs
src/Impostor.Tools.Proxy/Program.cs
src/Impostor.Tools.ServerReplay/Mocks/MockGameCodeFactory.cs
src/Impostor.Tools.ServerReplay/Program.cs

index b4eaa015268e4822a7c6369c011e8f5e45182a76..a0e54452df854aec24195f148e42a6c60bb45878 100644 (file)
@@ -3,40 +3,40 @@ using Impostor.Api.Innersloth;
 namespace Impostor.Api.Events.Announcements
 {
     /// <summary>
-    /// Event fired after client requests a announcement.
+    ///     Event fired after client requests a announcement.
     /// </summary>
     public interface IAnnouncementRequestEvent : IEvent
     {
         public interface IResponse
         {
             /// <summary>
-            /// Gets or sets FreeWeekendState, currently unused by the client.
+            ///     Gets or sets FreeWeekendState, currently unused by the client.
             /// </summary>
             public FreeWeekendState FreeWeekendState { get; set; }
 
             /// <summary>
-            /// Gets or sets a value indicating whether announcement should be loaded from client's cache, can save some bytes.
+            ///     Gets or sets a value indicating whether announcement should be loaded from client's cache, can save some bytes.
             /// </summary>
             public bool UseCached { get; set; }
 
             /// <summary>
-            /// Gets or sets announcement, should be null when <see cref="UseCached"/> is set to true.
+            ///     Gets or sets announcement, should be null when <see cref="UseCached" /> is set to true.
             /// </summary>
             public Announcement? Announcement { get; set; }
         }
 
         /// <summary>
-        /// Gets client's last announcement id.
+        ///     Gets client's last announcement id.
         /// </summary>
         public int Id { get; }
 
         /// <summary>
-        /// Gets client's language.
+        ///     Gets client's language.
         /// </summary>
         public Language Language { get; }
 
         /// <summary>
-        /// Gets or sets plugin made response.
+        ///     Gets or sets plugin made response.
         /// </summary>
         public IResponse Response { get; set; }
     }
index b31d2d1a7c31df46386fb8dbe7d1298b877ca7ec..9289fa5f8ec6591f80cf2e088068fbc9d2f1f151 100644 (file)
@@ -27,8 +27,8 @@ namespace Impostor.Api.Events
         public Type? Event { get; set; }
 
         /// <summary>
-        ///     If set to true, the listener will be called regardless of the <see cref="IEventCancelable.IsCancelled"/>.
+        ///     If set to true, the listener will be called regardless of the <see cref="IEventCancelable.IsCancelled" />.
         /// </summary>
         public bool IgnoreCancelled { get; set; }
     }
-}
\ No newline at end of file
+}
index ef45f1dbe19c2aa1ff462934c08d9c6e74dce01f..48c8d7ccadec055ea727e313739966ee31c18ca2 100644 (file)
@@ -3,7 +3,7 @@
 namespace Impostor.Api.Events
 {
     /// <summary>
-    ///     Called whenever a new <see cref="IGame"/> is created.
+    ///     Called whenever a new <see cref="IGame" /> is created.
     /// </summary>
     public interface IGameCreatedEvent : IGameEvent
     {
index 7ff7b460d93cb2d3ac3afb3d24f33d0fd6e025e7..e598aaea42ebdd4ee7429aa29f7dc5b740aaa52d 100644 (file)
@@ -3,7 +3,7 @@
 namespace Impostor.Api.Events
 {
     /// <summary>
-    ///     Called whenever a new <see cref="IGame"/> is destroyed.
+    ///     Called whenever a new <see cref="IGame" /> is destroyed.
     /// </summary>
     public interface IGameDestroyedEvent : IGameEvent
     {
index c9ae5790d7877590ee041161929a1490ee0e5d88..c188af3fe174fccb4a2463381b7f111ceb3b8351 100644 (file)
@@ -5,7 +5,7 @@ namespace Impostor.Api.Events
     public interface IGameEvent : IEvent
     {
         /// <summary>
-        ///     Gets the <see cref="IGame"/> this event belongs to.
+        ///     Gets the <see cref="IGame" /> this event belongs to.
         /// </summary>
         IGame Game { get; }
     }
index 5998bf24942bf61fe3d81871d4fd402abfde43b0..3ba450ea5a52dec4fd6732be941d350baef36989 100644 (file)
@@ -3,7 +3,7 @@
     /// <summary>
     ///     Called when the game is going to start.
     ///     When this is called, not all players are initialized properly yet.
-    ///     If you want to get correct player states, use <see cref="IGameStartedEvent"/>.
+    ///     If you want to get correct player states, use <see cref="IGameStartedEvent" />.
     /// </summary>
     public interface IGameStartingEvent : IGameEvent
     {
index 78ccd2d6a3cbd19ce0247406acc625841a0e849a..a5e322855283d50d7f2487731bd5d8c616551cd1 100644 (file)
@@ -1,5 +1,4 @@
-using Impostor.Api.Innersloth;
-using Impostor.Api.Net.Inner.Objects;
+using Impostor.Api.Net.Inner.Objects;
 
 namespace Impostor.Api.Events.Player
 {
index 247fe645b091cd33d55b978c37ab03f2c23b068c..d8269ffbb327a286db918555a35af55dc805c1b0 100644 (file)
@@ -6,14 +6,14 @@ namespace Impostor.Api.Events.Player
     public interface IPlayerEvent : IGameEvent
     {
         /// <summary>
-        ///     Gets the <see cref="IClientPlayer"/> that triggered this <see cref="IPlayerEvent"/>.
+        ///     Gets the <see cref="IClientPlayer" /> that triggered this <see cref="IPlayerEvent" />.
         /// </summary>
         IClientPlayer ClientPlayer { get; }
 
         /// <summary>
-        ///     Gets the networked <see cref="IInnerPlayerControl"/> that triggered this <see cref="IPlayerEvent"/>.
-        ///     This <see cref="IInnerPlayerControl"/> belongs to the <see cref="IClientPlayer"/>.
+        ///     Gets the networked <see cref="IInnerPlayerControl" /> that triggered this <see cref="IPlayerEvent" />.
+        ///     This <see cref="IInnerPlayerControl" /> belongs to the <see cref="IClientPlayer" />.
         /// </summary>
         IInnerPlayerControl PlayerControl { get; }
     }
-}
\ No newline at end of file
+}
index 796898e1af6ed74a022e0a82d3b78d84cca260b1..3bdb3a67034c7dd4a305d5e3e14ada3f33f7303a 100644 (file)
@@ -3,4 +3,4 @@
     public interface IEvent
     {
     }
-}
\ No newline at end of file
+}
index 319f02a22da3827f0f22dfd080c023ae10831fc7..d6d1ca6699cc5d2181f4c12167287cc6455b2f52 100644 (file)
@@ -7,4 +7,4 @@
         /// </summary>
         bool IsCancelled { get; set; }
     }
-}
\ No newline at end of file
+}
index 76392fcc5fc8db544010886a849fcbd59f1201b7..f3e8e41020cd5b2a05b17e69eef3c70745f8ed6d 100644 (file)
@@ -3,4 +3,4 @@
     public interface IEventListener
     {
     }
-}
\ No newline at end of file
+}
index 07a7f7cf134a98ee39ea65e936e612eda8b9497c..35fb9bbcc292fa991cbc59d7cbaceadc5e672c65 100644 (file)
@@ -16,20 +16,20 @@ namespace Impostor.Api.Events.Managers
             where TListener : IEventListener;
 
         /// <summary>
-        ///     Returns true if an event with the type <see cref="TEvent"/> is registered.
+        ///     Returns true if an event with the type <see cref="TEvent" /> is registered.
         /// </summary>
-        /// <returns>True if the <see cref="TEvent"/> is registered.</returns>
+        /// <returns>True if the <see cref="TEvent" /> is registered.</returns>
         /// <typeparam name="TEvent">Type of the event.</typeparam>
         bool IsRegistered<TEvent>()
             where TEvent : IEvent;
 
         /// <summary>
-        ///     Call all the event listeners for the type <see cref="TEvent"/>.
+        ///     Call all the event listeners for the type <see cref="TEvent" />.
         /// </summary>
         /// <param name="event">The event argument.</param>
         /// <typeparam name="TEvent">Type of the event.</typeparam>
-        /// <returns>A <see cref="ValueTask"/> representing the asynchronous operation.</returns>
+        /// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
         ValueTask CallAsync<TEvent>(TEvent @event)
             where TEvent : IEvent;
     }
-}
\ No newline at end of file
+}
index c103ee7bc261b684ce46d4e09f8abc3e72c85bea..242f0549673344c5cd037ad6c39821cfa7287eb5 100644 (file)
@@ -5,7 +5,7 @@ using System.Runtime.CompilerServices;
 namespace Impostor.Api
 {
     /// <summary>
-    /// Priovides a StreamReader-like api throught extensions
+    ///     Priovides a StreamReader-like api throught extensions
     /// </summary>
     public static class SpanReaderExtensions
     {
@@ -53,7 +53,7 @@ namespace Impostor.Api
         }
 
         /// <summary>
-        /// Advances the position of <see cref="input"/> by the size of <see cref="T"/>.
+        ///     Advances the position of <see cref="input" /> by the size of <see cref="T" />.
         /// </summary>
         /// <typeparam name="T">Type that will be read.</typeparam>
         /// <param name="input">input "stream"/span.</param>
@@ -67,4 +67,4 @@ namespace Impostor.Api
             return original;
         }
     }
-}
\ No newline at end of file
+}
index 68f1efda1e9fa14a7eac51ade7c7a4a24246074f..4238b4d0dcb55eebeb19d21e2d99b28af861bf48 100644 (file)
@@ -9,4 +9,4 @@ namespace Impostor.Api
             return SystemTypeHelpers.Names[(int)type];
         }
     }
-}
\ No newline at end of file
+}
index a73697815109b7c6bb724a1f63afc889a6f625f3..e30050f948d1ca59190d0bd5a855a066d57728bd 100644 (file)
@@ -39,4 +39,4 @@ namespace Impostor.Api.Games
             return game.SendToAsync(writer, player.Client);
         }
     }
-}
\ No newline at end of file
+}
index 6a95b3d4a5de26b69d55a0a93e2070bc17db125b..de9a0669299482872a29e104b1f14c64e994eda0 100644 (file)
@@ -11,4 +11,4 @@ namespace Impostor.Api.Games
             return manager.Games.Count(game => map.HasFlag((MapFlags)(1 << (byte)game.Options.Map)));
         }
     }
-}
\ No newline at end of file
+}
index 2c30e7e9d47d2df4120dbf4f85777fb0a96c61cd..e24c28a48ec7831c98331d92260c107952b0ca4c 100644 (file)
@@ -48,19 +48,19 @@ namespace Impostor.Api.Games
 
         public static GameCode From(string value) => new GameCode(value);
 
-        /// <inheritdoc/>
+        /// <inheritdoc />
         public bool Equals(GameCode other)
         {
             return Code == other.Code && Value == other.Value;
         }
 
-        /// <inheritdoc/>
+        /// <inheritdoc />
         public override bool Equals(object? obj)
         {
             return obj is GameCode other && Equals(other);
         }
 
-        /// <inheritdoc/>
+        /// <inheritdoc />
         public override int GetHashCode()
         {
             return HashCode.Combine(Code, Value);
@@ -71,4 +71,4 @@ namespace Impostor.Api.Games
             return Code;
         }
     }
-}
\ No newline at end of file
+}
index 4889ea965bc3c646001e9d77b45f89faccd23c44..7fcb0f9460e8d2a0781f4557ca081fe154c5a85f 100644 (file)
@@ -41,8 +41,8 @@
         ///     Custom error by a plugin.
         /// </summary>
         /// <remarks>
-        ///     A custom message can be set in <see cref="GameJoinResult.Message"/>.
+        ///     A custom message can be set in <see cref="GameJoinResult.Message" />.
         /// </remarks>
         Custom,
     }
-}
\ No newline at end of file
+}
index b33a2b669591a0bda8155f3567c4523a466fde57..4b25c8f318630377deb1017e5305dc43321516f7 100644 (file)
@@ -45,4 +45,4 @@ namespace Impostor.Api.Games
             return new GameJoinResult(error);
         }
     }
-}
\ No newline at end of file
+}
index 58e92085f2a86837262510e93dd56a06a8c46b51..ecc11f811df767a01a5a41c4c871a1d7043c38c8 100644 (file)
@@ -29,7 +29,7 @@ namespace Impostor.Api.Games
         bool IsPublic { get; }
 
         /// <summary>
-        /// Gets or sets display name on game list.
+        ///     Gets or sets display name on game list.
         /// </summary>
         string? DisplayName { get; set; }
 
@@ -43,28 +43,27 @@ namespace Impostor.Api.Games
             where T : IInnerNetObject;
 
         /// <summary>
-        ///     Adds an <see cref="IPAddress"/> to the ban list of this game.
-        ///     Prevents all future joins from this <see cref="IPAddress"/>.
-        ///
-        ///     This does not kick the player with that <see cref="IPAddress"/> from the lobby.
+        ///     Adds an <see cref="IPAddress" /> to the ban list of this game.
+        ///     Prevents all future joins from this <see cref="IPAddress" />.
+        ///     This does not kick the player with that <see cref="IPAddress" /> from the lobby.
         /// </summary>
         /// <param name="ipAddress">
-        ///     The <see cref="IPAddress"/> to ban.
+        ///     The <see cref="IPAddress" /> to ban.
         /// </param>
         void BanIp(IPAddress ipAddress);
 
         /// <summary>
-        ///     Syncs the internal <see cref="GameOptionsData"/> to all players.
+        ///     Syncs the internal <see cref="GameOptionsData" /> to all players.
         ///     Necessary to do if you modified it, otherwise it won't be used.
         /// </summary>
-        /// <returns>A <see cref="ValueTask"/> representing the asynchronous operation.</returns>
+        /// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
         ValueTask SyncSettingsAsync();
 
         /// <summary>
         ///     Sets game's privacy.
         /// </summary>
         /// <param name="isPublic">Privacy to set.</param>
-        /// <returns>A <see cref="ValueTask"/> representing the asynchronous operation.</returns>
+        /// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
         ValueTask SetPrivacyAsync(bool isPublic);
 
         /// <summary>
@@ -72,7 +71,7 @@ namespace Impostor.Api.Games
         /// </summary>
         /// <param name="writer">Message to send.</param>
         /// <param name="states">Required limbo state of the player.</param>
-        /// <returns>A <see cref="ValueTask"/> representing the asynchronous operation.</returns>
+        /// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
         ValueTask SendToAllAsync(IMessageWriter writer, LimboStates states = LimboStates.NotLimbo);
 
         /// <summary>
@@ -81,7 +80,7 @@ namespace Impostor.Api.Games
         /// <param name="writer">Message to send.</param>
         /// <param name="senderId">The player to exclude from sending the message.</param>
         /// <param name="states">Required limbo state of the player.</param>
-        /// <returns>A <see cref="ValueTask"/> representing the asynchronous operation.</returns>
+        /// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
         ValueTask SendToAllExceptAsync(IMessageWriter writer, int senderId, LimboStates states = LimboStates.NotLimbo);
 
         /// <summary>
@@ -89,7 +88,7 @@ namespace Impostor.Api.Games
         /// </summary>
         /// <param name="writer">Message to send.</param>
         /// <param name="id">ID of the client.</param>
-        /// <returns>A <see cref="ValueTask"/> representing the asynchronous operation.</returns>
+        /// <returns>A <see cref="ValueTask" /> representing the asynchronous operation.</returns>
         ValueTask SendToAsync(IMessageWriter writer, int id);
     }
 }
index f264fe0040ce635c1ddf690189b4939820197ad6..38f047fb55f9e8443b37546e1bee58a52084d3c8 100644 (file)
@@ -4,4 +4,4 @@
     {
         GameCode Create();
     }
-}
\ No newline at end of file
+}
index 7ee403fd28da5f44265e83b073c03d995da16eff..cdf8558cf7332559cfc7f36ea0510cfab75e4847 100644 (file)
@@ -12,4 +12,4 @@ namespace Impostor.Api.Games.Managers
 
         ValueTask<IGame> CreateAsync(GameOptionsData options);
     }
-}
\ No newline at end of file
+}
index 46d1b2ee0a6d546214a45fa594a935481664e64f..a1d9c425d7e444360b20f2a2b8e699ed7e7e4f67 100644 (file)
@@ -4,4 +4,4 @@
     {
         ChangePrivacy = 1,
     }
-}
\ No newline at end of file
+}
index c163601776431f7beb298ce6671c0005cb803681..697b0311f61b9fadd94330301d2b6a4dfba013e4 100644 (file)
@@ -4,4 +4,4 @@
     {
         DidVote = 0,
     }
-}
\ No newline at end of file
+}
index a07ac0566b2c29cadcb6e609f2cd0981da812314..8b8a430ffeeb8301e9ceeb5132f88a38c657a263 100644 (file)
@@ -6,4 +6,4 @@
         Kill = 1,
         Disconnect = 2,
     }
-}
\ No newline at end of file
+}
index bbb463f7f789ffa3c5638d5a32bc0e2fdc93bca5..4b3c67055f02c2cb45b23d471c0b4be2ba999994 100644 (file)
@@ -16,4 +16,4 @@ namespace Impostor.Api.Innersloth
         Polish = 128,
         English = 256,
     }
-}
\ No newline at end of file
+}
index 3d648445e478a6b7a5943300a995003ca9bbea83..5530c8878e9a0d47c5718116ba2f7016ba950e46 100644 (file)
@@ -7,130 +7,130 @@ namespace Impostor.Api.Innersloth
     public class GameOptionsData
     {
         /// <summary>
-        /// The latest major version of the game client.
+        ///     The latest major version of the game client.
         /// </summary>
         public const int LatestVersion = 4;
 
         /// <summary>
-        /// Gets or sets host's version of the game.
+        ///     Gets or sets host's version of the game.
         /// </summary>
         public byte Version { get; set; } = LatestVersion;
 
         /// <summary>
-        /// Gets or sets the maximum amount of players for this lobby.
+        ///     Gets or sets the maximum amount of players for this lobby.
         /// </summary>
         public byte MaxPlayers { get; set; } = 10;
 
         /// <summary>
-        /// Gets or sets the language of the lobby as per <see cref="GameKeywords"/> enum.
+        ///     Gets or sets the language of the lobby as per <see cref="GameKeywords" /> enum.
         /// </summary>
         public GameKeywords Keywords { get; set; } = GameKeywords.English;
 
         /// <summary>
-        /// Gets or sets the Map selected for this lobby.
+        ///     Gets or sets the Map selected for this lobby.
         /// </summary>
         public MapTypes Map { get; set; } = MapTypes.Skeld;
 
         /// <summary>
-        /// Gets or sets the Player speed modifier.
+        ///     Gets or sets the Player speed modifier.
         /// </summary>
         public float PlayerSpeedMod { get; set; } = 1f;
 
         /// <summary>
-        /// Gets or sets the Light modifier for the players that are members of the crew as a multiplier value.
+        ///     Gets or sets the Light modifier for the players that are members of the crew as a multiplier value.
         /// </summary>
         public float CrewLightMod { get; set; } = 1f;
 
         /// <summary>
-        /// Gets or sets the Light modifier for the players that are Impostors as a multiplier value.
+        ///     Gets or sets the Light modifier for the players that are Impostors as a multiplier value.
         /// </summary>
         public float ImpostorLightMod { get; set; } = 1f;
 
         /// <summary>
-        /// Gets or sets the Impostor cooldown to kill in seconds.
+        ///     Gets or sets the Impostor cooldown to kill in seconds.
         /// </summary>
         public float KillCooldown { get; set; } = 15f;
 
         /// <summary>
-        /// Gets or sets the number of common tasks.
+        ///     Gets or sets the number of common tasks.
         /// </summary>
         public int NumCommonTasks { get; set; } = 1;
 
         /// <summary>
-        /// Gets or sets the number of long tasks.
+        ///     Gets or sets the number of long tasks.
         /// </summary>
         public int NumLongTasks { get; set; } = 1;
 
         /// <summary>
-        /// Gets or sets the number of short tasks.
+        ///     Gets or sets the number of short tasks.
         /// </summary>
         public int NumShortTasks { get; set; } = 2;
 
         /// <summary>
-        /// Gets or sets the maximum amount of emergency meetings each player can call during the game in seconds.
+        ///     Gets or sets the maximum amount of emergency meetings each player can call during the game in seconds.
         /// </summary>
         public int NumEmergencyMeetings { get; set; } = 1;
 
         /// <summary>
-        /// Gets or sets the cooldown between each time any player can call an emergency meeting in seconds.
+        ///     Gets or sets the cooldown between each time any player can call an emergency meeting in seconds.
         /// </summary>
         public int EmergencyCooldown { get; set; } = 15;
 
         /// <summary>
-        /// Gets or sets the number of impostors for this lobby.
+        ///     Gets or sets the number of impostors for this lobby.
         /// </summary>
         public int NumImpostors { get; set; } = 1;
 
         /// <summary>
-        /// Gets or sets a value indicating whether ghosts (dead crew members) can do tasks.
+        ///     Gets or sets a value indicating whether ghosts (dead crew members) can do tasks.
         /// </summary>
         public bool GhostsDoTasks { get; set; } = true;
 
         /// <summary>
-        /// Gets or sets the Kill as per values in <see cref="KillDistances"/>.
+        ///     Gets or sets the Kill as per values in <see cref="KillDistances" />.
         /// </summary>
         public KillDistances KillDistance { get; set; } = KillDistances.Normal;
 
         /// <summary>
-        /// Gets or sets the time for discussion before voting time in seconds.
+        ///     Gets or sets the time for discussion before voting time in seconds.
         /// </summary>
         public int DiscussionTime { get; set; } = 15;
 
         /// <summary>
-        /// Gets or sets the time for voting in seconds.
+        ///     Gets or sets the time for voting in seconds.
         /// </summary>
         public int VotingTime { get; set; } = 120;
 
         /// <summary>
-        /// Gets or sets a value indicating whether an ejected player is an impostor or not.
+        ///     Gets or sets a value indicating whether an ejected player is an impostor or not.
         /// </summary>
         public bool ConfirmImpostor { get; set; } = true;
 
         /// <summary>
-        /// Gets or sets a value indicating whether players are able to see tasks being performed by other players.
+        ///     Gets or sets a value indicating whether players are able to see tasks being performed by other players.
         /// </summary>
         /// <remarks>
-        /// By being set to true, tasks such as Empty Garbage, Submit Scan, Clear asteroids, Prime shields execution will be visible to other players.
+        ///     By being set to true, tasks such as Empty Garbage, Submit Scan, Clear asteroids, Prime shields execution will be visible to other players.
         /// </remarks>
         public bool VisualTasks { get; set; } = true;
 
         /// <summary>
-        /// Gets or sets a value indicating whether the vote is anonymous.
+        ///     Gets or sets a value indicating whether the vote is anonymous.
         /// </summary>
         public bool AnonymousVotes { get; set; }
 
         /// <summary>
-        /// Gets or sets the task bar update mode as per values in <see cref="Innersloth.TaskBarUpdate"/>.
+        ///     Gets or sets the task bar update mode as per values in <see cref="Innersloth.TaskBarUpdate" />.
         /// </summary>
         public TaskBarUpdate TaskBarUpdate { get; set; } = TaskBarUpdate.Always;
 
         /// <summary>
-        /// Gets or sets a value indicating whether the GameOptions are the default ones.
+        ///     Gets or sets a value indicating whether the GameOptions are the default ones.
         /// </summary>
         public bool IsDefaults { get; set; } = true;
 
         /// <summary>
-        /// Deserialize a packet/message to a new GameOptionsData object.
+        ///     Deserialize a packet/message to a new GameOptionsData object.
         /// </summary>
         /// <param name="reader">Message reader object containing the raw message.</param>
         /// <returns>GameOptionsData object.</returns>
@@ -142,7 +142,7 @@ namespace Impostor.Api.Innersloth
         }
 
         /// <summary>
-        /// Serializes this instance of GameOptionsData object to a specified BinaryWriter.
+        ///     Serializes this instance of GameOptionsData object to a specified BinaryWriter.
         /// </summary>
         /// <param name="writer">The stream to write the message to.</param>
         /// <param name="version">The version of the game.</param>
@@ -198,7 +198,7 @@ namespace Impostor.Api.Innersloth
         }
 
         /// <summary>
-        /// Deserialize a ReadOnlyMemory object to this instance of the GameOptionsData object.
+        ///     Deserialize a ReadOnlyMemory object to this instance of the GameOptionsData object.
         /// </summary>
         /// <param name="memory">Memory containing the message/packet.</param>
         public void Deserialize(ReadOnlyMemory<byte> memory)
index f5aaa9cc502feffcb02b7b5bae73b9450093a1fb..8e791de7d997540dc5bcbf4bb6791412c629238b 100644 (file)
@@ -8,4 +8,4 @@
         Ended = 3,
         Destroyed = 4,
     }
-}
\ No newline at end of file
+}
index c11933ee304e0ad1169e679be2e0af20fbc7d14f..5015589596b36721f8dc28fe8b55983959ba18c5 100644 (file)
@@ -7,4 +7,4 @@ namespace Impostor.Api.Innersloth
             return (year * 25000) + (month * 1800) + (day * 50) + rev;
         }
     }
-}
\ No newline at end of file
+}
index ad462a2732d51c6d67d19831b231c5ce0330305e..9b0d8f02a718f98a9f00b23364adc4a1c67dd745 100644 (file)
@@ -9,4 +9,4 @@ namespace Impostor.Api.Innersloth
         MiraHQ = 2,
         Polus = 4,
     }
-}
\ No newline at end of file
+}
index 2b5ede98d3416d7ce5fd5ea977e863a8f28cee50..2706933aaac46f376b3fc585f07e9d6744682cdb 100644 (file)
@@ -6,4 +6,4 @@
         MiraHQ = 1,
         Polus = 2,
     }
-}
\ No newline at end of file
+}
index ad88c28aff132fbf16aa3db0a6c8d065fe2a1cdd..e9ba29becce264590f4a79836fd14a35209c38aa 100644 (file)
@@ -20,9 +20,9 @@ namespace Impostor.Api.Innersloth
                     SystemTypes.LifeSupp => "O2",
                     SystemTypes.LowerEngine => "Lower Engine",
                     SystemTypes.LockerRoom => "Locker Room",
-                    _ => x.ToString()
+                    _ => x.ToString(),
                 };
             }).ToArray();
         }
     }
-}
\ No newline at end of file
+}
index 5de8bc94d58012ab9c65d33e1d2c2cc47b8d7b95..6a072e771e9fc40b6ab2f6ed323cc30bab4996d0 100644 (file)
@@ -39,7 +39,7 @@
         Sabotage = 17,
 
         /// <summary>
-        /// Decontam on Mira and bottom decontam on Polus
+        ///     Decontam on Mira and bottom decontam on Polus
         /// </summary>
         Decontamination = 18,
 
@@ -58,7 +58,7 @@
         Dropship = 25,
 
         /// <summary>
-        /// Top decontam on Polus
+        ///     Top decontam on Polus
         /// </summary>
         Decontamination2 = 26,
 
index 8b15354a425552cade1b7cbc7e4696cc39f5d01e..d4794796cab417bee327a4071e3195d2aadd17be 100644 (file)
@@ -46,4 +46,4 @@
         RecordTemperature = 41,
         RebootWifi = 42,
     }
-}
\ No newline at end of file
+}
index 9533d83ac3e16f12df2bbe4cf0e63017e69ac359..1928ce28326d7edae47841d6cb4dc480ea95a109 100644 (file)
@@ -7,4 +7,4 @@
             return i == ' ' || (i >= 'A' && i <= 'Z') || (i >= 'a' && i <= 'z') || (i >= '0' && i <= '9') || (i >= 'À' && i <= 'ÿ') || (i >= 'Ѐ' && i <= 'џ') || (i >= 'ㄱ' && i <= 'ㆎ') || (i >= '가' && i <= '힣');
         }
     }
-}
\ No newline at end of file
+}
index 1ba594470ef932587f4b283e73bf324f144b32d3..790b1c0b8f11c1bd7714d1493abae0242d3bfe5b 100644 (file)
@@ -29,7 +29,7 @@ namespace Impostor.Api.Net
         string Name { get; }
 
         /// <summary>
-        /// Gets mods sent by client in modded handshake.
+        ///     Gets mods sent by client in modded handshake.
         /// </summary>
         ISet<Mod> Mods { get; }
 
@@ -57,7 +57,7 @@ namespace Impostor.Api.Net
         IDictionary<object, object> Items { get; }
 
         /// <summary>
-        ///     Gets or sets the current game data of the <see cref="IClient"/>.
+        ///     Gets or sets the current game data of the <see cref="IClient" />.
         /// </summary>
         IClientPlayer? Player { get; }
 
@@ -68,16 +68,16 @@ namespace Impostor.Api.Net
         ValueTask HandleDisconnectAsync(string reason);
 
         /// <summary>
-        ///     Disconnect the client with a <see cref="DisconnectReason"/>.
+        ///     Disconnect the client with a <see cref="DisconnectReason" />.
         /// </summary>
         /// <param name="reason">
         ///     The message to show to the player.
         /// </param>
         /// <param name="message">
-        ///     Only used when <see cref="reason"/> is set to <see cref="DisconnectReason.Custom"/>.
+        ///     Only used when <see cref="reason" /> is set to <see cref="DisconnectReason.Custom" />.
         /// </param>
         /// <returns>
-        ///     A <see cref="ValueTask"/> representing the asynchronous operation.
+        ///     A <see cref="ValueTask" /> representing the asynchronous operation.
         /// </returns>
         ValueTask DisconnectAsync(DisconnectReason reason, string? message = null);
     }
index 60702101e73e96e801ec3f98cbefff4cea3e8df1..f11c8737561461f60701c8bd04f73214056788b5 100644 (file)
@@ -6,7 +6,7 @@ using Impostor.Api.Net.Inner.Objects;
 namespace Impostor.Api.Net
 {
     /// <summary>
-    ///     Represents a player in <see cref="IGame"/>.
+    ///     Represents a player in <see cref="IGame" />.
     /// </summary>
     public interface IClientPlayer
     {
@@ -16,7 +16,7 @@ namespace Impostor.Api.Net
         IClient Client { get; }
 
         /// <summary>
-        ///     Gets the game where the <see cref="IClientPlayer"/> belongs to.
+        ///     Gets the game where the <see cref="IClientPlayer" /> belongs to.
         /// </summary>
         IGame Game { get; }
 
@@ -30,10 +30,10 @@ namespace Impostor.Api.Net
         public bool IsHost { get; }
 
         /// <summary>
-        ///     Checks if the specified <see cref="IInnerNetObject"/> is owned by <see cref="IClientPlayer"/>.
+        ///     Checks if the specified <see cref="IInnerNetObject" /> is owned by <see cref="IClientPlayer" />.
         /// </summary>
-        /// <param name="netObject">The <see cref="IInnerNetObject"/>.</param>
-        /// <returns>Returns true if owned by <see cref="IClientPlayer"/>.</returns>
+        /// <param name="netObject">The <see cref="IInnerNetObject" />.</param>
+        /// <returns>Returns true if owned by <see cref="IClientPlayer" />.</returns>
         bool IsOwner(IInnerNetObject netObject);
 
         ValueTask KickAsync();
index 4e6c4b3fd03479a18e2a03a816f9f7c3b31d6c17..c012bd1921bad6b6d7d30cf0ff9ccd9be5fcf463 100644 (file)
@@ -38,4 +38,4 @@ namespace Impostor.Api.Net
         /// <returns></returns>
         ValueTask DisconnectAsync(string? reason);
     }
-}
\ No newline at end of file
+}
index c1713779906fb8b6a580f78124e3b09aad31b52c..8cfadb8e6019ffdd3520ec40d3bd2499bf03e6e5 100644 (file)
@@ -6,4 +6,4 @@
 
         public int OwnerId { get; }
     }
-}
\ No newline at end of file
+}
index 2dd470947d3aa16947194e8c6c4640e0f91af977..5ad4763c775ba8d0a4f402e59d276efb772a1696 100644 (file)
@@ -16,7 +16,7 @@ namespace Impostor.Api.Net.Inner.Objects.Components
         Vector2 Velocity { get; }
 
         /// <summary>
-        ///     Snaps the current to the given position <see cref="IInnerPlayerControl"/>.
+        ///     Snaps the current to the given position <see cref="IInnerPlayerControl" />.
         /// </summary>
         /// <param name="position">The target position.</param>
         /// <returns>Task that must be awaited.</returns>
index 0ee065ad8edd3403f1e7c1c11769850865526ae0..711f878b4cba8a2033f40a4698454405010b7131 100644 (file)
@@ -7,30 +7,30 @@ namespace Impostor.Api.Net.Inner.Objects
     public interface IInnerPlayerControl : IInnerNetObject
     {
         /// <summary>
-        ///     Gets the <see cref="PlayerId"/> assigned by the client of the host of the game.
+        ///     Gets the <see cref="PlayerId" /> assigned by the client of the host of the game.
         /// </summary>
         byte PlayerId { get; }
 
         /// <summary>
-        ///     Gets the <see cref="IInnerPlayerPhysics"/> of the <see cref="IInnerPlayerControl"/>.
+        ///     Gets the <see cref="IInnerPlayerPhysics" /> of the <see cref="IInnerPlayerControl" />.
         ///     Contains vent logic.
         /// </summary>
         IInnerPlayerPhysics Physics { get; }
 
         /// <summary>
-        ///     Gets the <see cref="IInnerCustomNetworkTransform"/> of the <see cref="IInnerPlayerControl"/>.
+        ///     Gets the <see cref="IInnerCustomNetworkTransform" /> of the <see cref="IInnerPlayerControl" />.
         ///     Contains position data about the player.
         /// </summary>
         IInnerCustomNetworkTransform NetworkTransform { get; }
 
         /// <summary>
-        ///     Gets the <see cref="IInnerPlayerInfo"/> of the <see cref="IInnerPlayerControl"/>.
+        ///     Gets the <see cref="IInnerPlayerInfo" /> of the <see cref="IInnerPlayerControl" />.
         ///     Contains metadata about the player.
         /// </summary>
         IInnerPlayerInfo PlayerInfo { get; }
 
         /// <summary>
-        ///     Sets the name of the current <see cref="IInnerPlayerControl"/>.
+        ///     Sets the name of the current <see cref="IInnerPlayerControl" />.
         ///     Visible to all players.
         /// </summary>
         /// <param name="name">A name for the player.</param>
@@ -38,7 +38,7 @@ namespace Impostor.Api.Net.Inner.Objects
         ValueTask SetNameAsync(string name);
 
         /// <summary>
-        ///     Sets the color of the current <see cref="IInnerPlayerControl"/>.
+        ///     Sets the color of the current <see cref="IInnerPlayerControl" />.
         ///     Visible to all players.
         /// </summary>
         /// <param name="colorType">A color for the player.</param>
@@ -46,7 +46,7 @@ namespace Impostor.Api.Net.Inner.Objects
         ValueTask SetColorAsync(ColorType colorType);
 
         /// <summary>
-        ///     Sets the hat of the current <see cref="IInnerPlayerControl"/>.
+        ///     Sets the hat of the current <see cref="IInnerPlayerControl" />.
         ///     Visible to all players.
         /// </summary>
         /// <param name="hatType">An hat for the player.</param>
@@ -54,7 +54,7 @@ namespace Impostor.Api.Net.Inner.Objects
         ValueTask SetHatAsync(HatType hatType);
 
         /// <summary>
-        ///     Sets the pet of the current <see cref="IInnerPlayerControl"/>.
+        ///     Sets the pet of the current <see cref="IInnerPlayerControl" />.
         ///     Visible to all players.
         /// </summary>
         /// <param name="petType">A pet for the player.</param>
@@ -62,7 +62,7 @@ namespace Impostor.Api.Net.Inner.Objects
         ValueTask SetPetAsync(PetType petType);
 
         /// <summary>
-        ///     Sets the skin of the current <see cref="IInnerPlayerControl"/>.
+        ///     Sets the skin of the current <see cref="IInnerPlayerControl" />.
         ///     Visible to all players.
         /// </summary>
         /// <param name="skinType">A skin for the player.</param>
@@ -70,7 +70,7 @@ namespace Impostor.Api.Net.Inner.Objects
         ValueTask SetSkinAsync(SkinType skinType);
 
         /// <summary>
-        ///     Send a chat message as the current <see cref="IInnerPlayerControl"/>.
+        ///     Send a chat message as the current <see cref="IInnerPlayerControl" />.
         ///     Visible to all players.
         /// </summary>
         /// <param name="text">The message to send.</param>
@@ -78,7 +78,7 @@ namespace Impostor.Api.Net.Inner.Objects
         ValueTask SendChatAsync(string text);
 
         /// <summary>
-        ///     Send a chat message as the current <see cref="IInnerPlayerControl"/>.
+        ///     Send a chat message as the current <see cref="IInnerPlayerControl" />.
         ///     Visible to only the current.
         /// </summary>
         /// <param name="text">The message to send.</param>
@@ -90,7 +90,7 @@ namespace Impostor.Api.Net.Inner.Objects
         ValueTask SendChatToPlayerAsync(string text, IInnerPlayerControl? player = null);
 
         /// <summary>
-        ///     Murder <paramref name="target"/> player.
+        ///     Murder <paramref name="target" /> player.
         /// </summary>
         /// <param name="target">Target player to murder.</param>
         /// <exception cref="ImpostorProtocolException">Thrown when player is not the impostor.</exception>
index 2b6dd86f0561288ce152e0c188b442874f747359..f4e54b1519f77ecf4bf4787f3ab3ca937266803e 100644 (file)
@@ -1,5 +1,4 @@
 using Impostor.Api.Innersloth;
-using Impostor.Api.Net.Messages;
 
 namespace Impostor.Api.Net.Inner.Objects
 {
index 44c493e814f9f98418e3b0cf2529af7ae59ef53b..5d1242d4b55ad669a1c33b25255b5f7e79af4661 100644 (file)
@@ -10,4 +10,4 @@ namespace Impostor.Api.Net
         WaitingForHost = 4,
         All = PreSpawn | NotLimbo | WaitingForHost,
     }
-}
\ No newline at end of file
+}
index 92bf89f0d97dead94a1fe14ff879b14f9f8d019a..737e42f3742ea4c95a9b0d7ca861793aa0c06d8d 100644 (file)
@@ -6,4 +6,4 @@ namespace Impostor.Api.Net.Manager
     {
         IEnumerable<IClient> Clients { get; }
     }
-}
\ No newline at end of file
+}
index 7d7ee558501a3cbbc1c1d0c02770155df23e5931..e81e861f65169a1f447a438d9167edf151a8b55e 100644 (file)
@@ -14,9 +14,9 @@ namespace Impostor.Api.Net.Messages.C2S
         /// <summary>
         ///     Deserialize a packet.
         /// </summary>
-        /// <param name="reader"><see cref="IMessageReader"/> with <see cref="IMessageReader.Tag"/> 0.</param>
+        /// <param name="reader"><see cref="IMessageReader" /> with <see cref="IMessageReader.Tag" /> 0.</param>
         /// <param name="chatType">The chat type selected in the client of the player.</param>
-        /// <returns>Deserialized <see cref="GameOptionsData"/>.</returns>
+        /// <returns>Deserialized <see cref="GameOptionsData" />.</returns>
         public static GameOptionsData Deserialize(IMessageReader reader, out ChatType chatType)
         {
             var gameOptionsData = GameOptionsData.DeserializeCreate(reader);
index 58a85120d47928c16df88d04a97a778791b46db2..e7771e7c9ab99c3b647edebf899324388f9f5d7c 100644 (file)
@@ -1,4 +1,5 @@
-using Impostor.Api.Games;
+using System;
+using Impostor.Api.Games;
 
 namespace Impostor.Api.Net.Messages.C2S
 {
@@ -6,7 +7,7 @@ namespace Impostor.Api.Net.Messages.C2S
     {
         public static void Serialize(IMessageWriter writer)
         {
-            throw new System.NotImplementedException();
+            throw new NotImplementedException();
         }
 
         public static void Deserialize(IMessageReader reader, out GameCode gameCode)
index 99cdcfa7f207713365614a6d5698b64980d54806..a3bcedfcbba8f6de49827c8d3d24e5a6c97ec547 100644 (file)
@@ -1,10 +1,12 @@
-namespace Impostor.Api.Net.Messages.C2S
+using System;
+
+namespace Impostor.Api.Net.Messages.C2S
 {
     public class Message04RemovePlayerC2S
     {
         public static void Serialize(IMessageWriter writer)
         {
-            throw new System.NotImplementedException();
+            throw new NotImplementedException();
         }
 
         public static void Deserialize(IMessageReader reader, out int playerId, out byte reason)
@@ -13,4 +15,4 @@
             reason = reader.ReadByte();
         }
     }
-}
\ No newline at end of file
+}
index 7ca5e3a61f5cf29f2f715ba8a43e3a43ea5a139e..d264294cfac6b0e1dbbbe8c4c3c19c73dc7e8d49 100644 (file)
@@ -1,4 +1,5 @@
-using Impostor.Api.Innersloth;
+using System;
+using Impostor.Api.Innersloth;
 
 namespace Impostor.Api.Net.Messages.C2S
 {
@@ -6,7 +7,7 @@ namespace Impostor.Api.Net.Messages.C2S
     {
         public static void Serialize(IMessageWriter writer)
         {
-            throw new System.NotImplementedException();
+            throw new NotImplementedException();
         }
 
         public static void Deserialize(IMessageReader reader, out GameOverReason gameOverReason)
@@ -15,4 +16,4 @@ namespace Impostor.Api.Net.Messages.C2S
             reader.ReadBoolean(); // showAd
         }
     }
-}
\ No newline at end of file
+}
index 330f3b5ba9091ef073f199be24032bf9ccdcb52d..57db66902f1023f56f2332891d932424118a6a7b 100644 (file)
@@ -1,4 +1,5 @@
-using Impostor.Api.Innersloth;
+using System;
+using Impostor.Api.Innersloth;
 
 namespace Impostor.Api.Net.Messages.C2S
 {
@@ -6,7 +7,7 @@ namespace Impostor.Api.Net.Messages.C2S
     {
         public static void Serialize(IMessageWriter writer)
         {
-            throw new System.NotImplementedException();
+            throw new NotImplementedException();
         }
 
         public static void Deserialize(IMessageReader reader, out AlterGameTags gameTag, out bool isPublic)
@@ -17,4 +18,4 @@ namespace Impostor.Api.Net.Messages.C2S
             isPublic = slice.ReadBoolean();
         }
     }
-}
\ No newline at end of file
+}
index 7c5b8b980743013bf91ceb643e8fdd6c200d58cf..acafcee06a48464a511385c1091ca1888f090c2e 100644 (file)
@@ -1,10 +1,12 @@
-namespace Impostor.Api.Net.Messages.C2S
+using System;
+
+namespace Impostor.Api.Net.Messages.C2S
 {
     public class Message11KickPlayerC2S
     {
         public static void Serialize(IMessageWriter writer)
         {
-            throw new System.NotImplementedException();
+            throw new NotImplementedException();
         }
 
         public static void Deserialize(IMessageReader reader, out int playerId, out bool isBan)
@@ -13,4 +15,4 @@
             isBan = reader.ReadBoolean();
         }
     }
-}
\ No newline at end of file
+}
index bc32d5eee68a2001a7038c6b0852da8f3bd6f0cf..72be48d7aa24f9a8f1d06573dc802b90cb69a0d7 100644 (file)
@@ -1,4 +1,5 @@
-using Impostor.Api.Innersloth;
+using System;
+using Impostor.Api.Innersloth;
 
 namespace Impostor.Api.Net.Messages.C2S
 {
@@ -6,7 +7,7 @@ namespace Impostor.Api.Net.Messages.C2S
     {
         public static void Serialize(IMessageWriter writer)
         {
-            throw new System.NotImplementedException();
+            throw new NotImplementedException();
         }
 
         public static void Deserialize(IMessageReader reader, out GameOptionsData options, out ChatType chatType)
index 1eb82d1f3c4bc76817e4187fd9491d0d34b00267..397ad5adbbaa1cd9d42058f646375cae02749fe9 100644 (file)
@@ -18,7 +18,7 @@ namespace Impostor.Api.Net.Messages
         byte[] Buffer { get; }
 
         /// <summary>
-        ///     Gets the offset of our current <see cref="IMessageReader"/> in the entire <see cref="Buffer"/>.
+        ///     Gets the offset of our current <see cref="IMessageReader" /> in the entire <see cref="Buffer" />.
         /// </summary>
         int Offset { get; }
 
index 0f4b7faddb35aceacc57e1aca92897fc27f537f8..fd500adcd815a7bd266c2a17325d05fa5eca7749 100644 (file)
@@ -74,7 +74,7 @@ namespace Impostor.Api.Net.Messages
         void Write(string value);
 
         /// <summary>
-        ///     Writes a <see cref="IPAddress"/> to the message.
+        ///     Writes a <see cref="IPAddress" /> to the message.
         /// </summary>
         /// <param name="value">Value to write.</param>
         void Write(IPAddress value);
index f39893930ddf06c1b63616e49e8da5c45dc03fa0..cf920042683e9b0b3dceea70631ca7dffd763d27 100644 (file)
@@ -3,14 +3,14 @@
     public interface IMessageWriterProvider
     {
         /// <summary>
-        ///     Retrieves a <see cref="IMessageWriter"/> from the internal pool.
-        ///     Make sure to call <see cref="IMessageWriter.Dispose"/> when you are done!
+        ///     Retrieves a <see cref="IMessageWriter" /> from the internal pool.
+        ///     Make sure to call <see cref="IMessageWriter.Dispose" /> when you are done!
         /// </summary>
         /// <param name="sendOption">
-        ///     Whether to send the message as <see cref="MessageType.Reliable"/> or <see cref="MessageType.Unreliable"/>.
+        ///     Whether to send the message as <see cref="MessageType.Reliable" /> or <see cref="MessageType.Unreliable" />.
         ///     Reliable packets will ensure delivery while unreliable packets may be lost.
         /// </param>
-        /// <returns>A <see cref="IMessageWriter"/> from the pool.</returns>
+        /// <returns>A <see cref="IMessageWriter" /> from the pool.</returns>
         IMessageWriter Get(MessageType sendOption = MessageType.Unreliable);
     }
 }
index aea0c60dbe48390a89ead7c7399cd16788297a21..2ebf475dcc1887f6ec2947717b9f495e1f2b44ce 100644 (file)
@@ -19,4 +19,4 @@
         public const byte GetGameList = 9;
         public const byte GetGameListV2 = 16;
     }
-}
\ No newline at end of file
+}
index 16043585d58426f3414eaf319946649f830b6c62..50acb5246c445b4ae2cd2303ad4847ddc76b0e23 100644 (file)
@@ -29,4 +29,4 @@ namespace Impostor.Api.Net.Messages
         /// </remarks>
         Reliable,
     }
-}
\ No newline at end of file
+}
index 8402d1007d5134b8e730228c2db89bb3cb01ae1f..8fef2251e4a6e6e9f857e3ca679fcba2e35877d5 100644 (file)
@@ -17,4 +17,4 @@ namespace Impostor.Api.Net.Messages.S2C
             throw new NotImplementedException();
         }
     }
-}
\ No newline at end of file
+}
index c45520105a5cd204aa55d38e1881faedf8fbf633..74fdc40552e6729a4f8e0736431387122ee58a55 100644 (file)
@@ -44,7 +44,7 @@ namespace Impostor.Api.Net.Messages.S2C
 
         public static void Deserialize(IMessageReader reader)
         {
-            throw new System.NotImplementedException();
+            throw new NotImplementedException();
         }
     }
-}
\ No newline at end of file
+}
index 77b447d05dabefa7c7e5eb24766b854f8b263a09..bcdca04869a6ba08b2fd7efa54a5975515d962da 100644 (file)
@@ -1,4 +1,5 @@
-using Impostor.Api.Innersloth;
+using System;
+using Impostor.Api.Innersloth;
 
 namespace Impostor.Api.Net.Messages.S2C
 {
@@ -23,7 +24,7 @@ namespace Impostor.Api.Net.Messages.S2C
 
         public static void Deserialize(IMessageReader reader)
         {
-            throw new System.NotImplementedException();
+            throw new NotImplementedException();
         }
     }
-}
\ No newline at end of file
+}
index da6eb40ca9f6aa4e988f22031c9012dd04b74914..857fea1b873730c7867ca6a9859a012a61d3bb21 100644 (file)
@@ -1,4 +1,6 @@
-namespace Impostor.Api.Net.Messages.S2C
+using System;
+
+namespace Impostor.Api.Net.Messages.S2C
 {
     public static class Message07JoinedGameS2C
     {
@@ -25,7 +27,7 @@
 
         public static void Deserialize(IMessageReader reader)
         {
-            throw new System.NotImplementedException();
+            throw new NotImplementedException();
         }
     }
-}
\ No newline at end of file
+}
index fa155dfab80cba651e36c94e1e4f1e6ad2c518d0..40c949d3aab7cbf2f71c3e4b9eca5f21739ec006 100644 (file)
@@ -1,4 +1,5 @@
-using Impostor.Api.Innersloth;
+using System;
+using Impostor.Api.Innersloth;
 
 namespace Impostor.Api.Net.Messages.S2C
 {
@@ -20,7 +21,7 @@ namespace Impostor.Api.Net.Messages.S2C
 
         public static void Deserialize(IMessageReader reader)
         {
-            throw new System.NotImplementedException();
+            throw new NotImplementedException();
         }
     }
-}
\ No newline at end of file
+}
index 1e2b6efc122cd08dcfe42341fc19b06c553a357e..7ffdb7b5e8fccbc93098ebb23cd25b58f698d6bf 100644 (file)
@@ -1,4 +1,6 @@
-namespace Impostor.Api.Net.Messages.S2C
+using System;
+
+namespace Impostor.Api.Net.Messages.S2C
 {
     public class Message11KickPlayerS2C
     {
@@ -18,7 +20,7 @@
 
         public static void Deserialize(IMessageReader reader)
         {
-            throw new System.NotImplementedException();
+            throw new NotImplementedException();
         }
     }
-}
\ No newline at end of file
+}
index 5964b1c55d39c1ca54f20ae0c50d8f5eb9e9cc31..8cf9046f924fe2845576958674050c4cddac372c 100644 (file)
@@ -1,4 +1,6 @@
-namespace Impostor.Api.Net.Messages.S2C
+using System;
+
+namespace Impostor.Api.Net.Messages.S2C
 {
     public class Message12WaitForHostS2C
     {
@@ -17,7 +19,7 @@
 
         public static void Deserialize(IMessageReader reader)
         {
-            throw new System.NotImplementedException();
+            throw new NotImplementedException();
         }
     }
-}
\ No newline at end of file
+}
index 4b93b0eefc1d54300b1e9b1d33571c4d1a47e4ca..0576c71d568931b5d272c55ecae54b08549b34d2 100644 (file)
@@ -1,4 +1,5 @@
-using System.Net;
+using System;
+using System.Net;
 
 namespace Impostor.Api.Net.Messages.S2C
 {
@@ -19,7 +20,7 @@ namespace Impostor.Api.Net.Messages.S2C
 
         public static void Deserialize(IMessageReader reader)
         {
-            throw new System.NotImplementedException();
+            throw new NotImplementedException();
         }
     }
-}
\ No newline at end of file
+}
index 7b641929bc5ee9e51b0cb4afe99c26f366b82247..a09259ba67bb732a1a3057103a1db177266adce9 100644 (file)
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
 using Impostor.Api.Games;
 
 namespace Impostor.Api.Net.Messages.S2C
@@ -33,7 +34,7 @@ namespace Impostor.Api.Net.Messages.S2C
 
         public static void Deserialize(IMessageReader reader)
         {
-            throw new System.NotImplementedException();
+            throw new NotImplementedException();
         }
     }
 }
index fd0f38f07b822f16dd43b72b7652f2a9588c956f..9f1efcf5852643038dbc70572f2b3db146e57d3d 100644 (file)
@@ -11,4 +11,4 @@ namespace Impostor.Api.Plugins
 
         ValueTask ReloadAsync();
     }
-}
\ No newline at end of file
+}
index aa6a35f82fad0cb2619370c6150a4b0f03c8ed75..e9d8585736d281ffdaeb2be0ba9ca29387424568 100644 (file)
@@ -9,4 +9,4 @@ namespace Impostor.Api.Plugins
 
         void ConfigureServices(IServiceCollection services);
     }
-}
\ No newline at end of file
+}
index b31bd4789846ac0a453d9b3f3b691836653b23c5..e2d6b024953af8f84aa30d452d9fbf105719999b 100644 (file)
@@ -21,4 +21,4 @@ namespace Impostor.Api.Plugins
 
         public string Version { get; }
     }
-}
\ No newline at end of file
+}
index 03843638f556a7dea5bf8b79a98213979cd08689..9d6f2b4f373c819d0096578b9d62f8d5a900457c 100644 (file)
@@ -19,4 +19,4 @@ namespace Impostor.Api.Plugins
             return default;
         }
     }
-}
\ No newline at end of file
+}
index c02e44aff7c259230adcfb29d3236b30236030d6..30143b8fab99610ec749f0506878b9aba88952a4 100644 (file)
@@ -1,3 +1,3 @@
 using System.Runtime.CompilerServices;
 
-[assembly:InternalsVisibleTo("Impostor.Server")]
\ No newline at end of file
+[assembly: InternalsVisibleTo("Impostor.Server")]
index 30c588c7ea969c0d1a116014d9057d9095ba00c3..2118299bff845f32749290894a5f9f878d59f503 100644 (file)
@@ -1,22 +1,22 @@
 namespace Impostor.Api.Reactor
 {
     /// <summary>
-    /// Plugin side used in modded handshake
+    ///     Plugin side used in modded handshake
     /// </summary>
     public enum PluginSide : byte
     {
         /// <summary>
-        /// Required by both sides, reject connection if missing on the other side
+        ///     Required by both sides, reject connection if missing on the other side
         /// </summary>
         Both,
 
         /// <summary>
-        /// Required only by client
+        ///     Required only by client
         /// </summary>
         ClientOnly,
 
         /// <summary>
-        /// Required only by server
+        ///     Required only by server
         /// </summary>
         ServerOnly,
     }
index c907f816af72871ca28042b7cd5270956ffbcf7d..5ab93c74314cad422111378f7576ed39543c57fe 100644 (file)
@@ -3,13 +3,13 @@
     public static class Mathf
     {
         /// <summary>
-        ///   <para>Clamps the given value between the given minimum float and maximum float values.  Returns the given value if it is within the min and max range.</para>
+        ///     <para>Clamps the given value between the given minimum float and maximum float values.  Returns the given value if it is within the min and max range.</para>
         /// </summary>
         /// <param name="value">The floating point value to restrict inside the range defined by the min and max values.</param>
         /// <param name="min">The minimum floating point value to compare against.</param>
         /// <param name="max">The maximum floating point value to compare against.</param>
         /// <returns>
-        ///   <para>The float result between the min and max values.</para>
+        ///     <para>The float result between the min and max values.</para>
         /// </returns>
         public static float Clamp(float value, float min, float max)
         {
@@ -26,7 +26,7 @@
         }
 
         /// <summary>
-        ///   <para>Clamps value between 0 and 1 and returns value.</para>
+        ///     <para>Clamps value between 0 and 1 and returns value.</para>
         /// </summary>
         /// <param name="value">Value.</param>
         /// <returns>Clamped value.</returns>
         }
 
         /// <summary>
-        ///   <para>Linearly interpolates between a and b by t.</para>
+        ///     <para>Linearly interpolates between a and b by t.</para>
         /// </summary>
         /// <param name="a">The start value.</param>
         /// <param name="b">The end value.</param>
         /// <param name="t">The interpolation value between the two floats.</param>
         /// <returns>
-        ///   <para>The interpolated float result between the two float values.</para>
+        ///     <para>The interpolated float result between the two float values.</para>
         /// </returns>
         public static float Lerp(float a, float b, float t) => a + ((b - a) * Clamp01(t));
 
index 2aba724ebe13dba77632e3755cdb69cf15a8d03f..7788f0e8a33aa879768597903dcf2f7ebe9cebe0 100644 (file)
@@ -41,7 +41,7 @@ namespace Impostor.Benchmarks.Data
 
         public bool ReadBoolean()
         {
-            byte val = FastByte();
+            var val = FastByte();
             return val != 0;
         }
 
@@ -88,7 +88,7 @@ namespace Impostor.Benchmarks.Data
             float output = 0;
             fixed (byte* bufPtr = &this.Buffer[Position])
             {
-                byte* outPtr = (byte*)&output;
+                var outPtr = (byte*)&output;
 
                 *outPtr = *bufPtr;
                 *(outPtr + 1) = *(bufPtr + 1);
@@ -134,13 +134,13 @@ namespace Impostor.Benchmarks.Data
 
         public uint ReadPackedUInt32()
         {
-            bool readMore = true;
-            int shift = 0;
+            var readMore = true;
+            var shift = 0;
             uint output = 0;
 
             while (readMore)
             {
-                byte b = FastByte();
+                var b = FastByte();
                 if (b >= 0x80)
                 {
                     readMore = true;
index 11033362654021c303cd158c8020723c5753d0f0..3c88ffb7cf8cbbba20f911a5c49eaca11e965f25 100644 (file)
@@ -65,7 +65,7 @@ namespace Impostor.Benchmarks.Data
 
         public bool ReadBoolean()
         {
-            byte val = FastByte();
+            var val = FastByte();
             return val != 0;
         }
 
@@ -112,7 +112,7 @@ namespace Impostor.Benchmarks.Data
             float output = 0;
             fixed (byte* bufPtr = &this.Buffer[Position])
             {
-                byte* outPtr = (byte*)&output;
+                var outPtr = (byte*)&output;
 
                 *outPtr = *bufPtr;
                 *(outPtr + 1) = *(bufPtr + 1);
@@ -158,13 +158,13 @@ namespace Impostor.Benchmarks.Data
 
         public uint ReadPackedUInt32()
         {
-            bool readMore = true;
-            int shift = 0;
+            var readMore = true;
+            var shift = 0;
             uint output = 0;
 
             while (readMore)
             {
-                byte b = FastByte();
+                var b = FastByte();
                 if (b >= 0x80)
                 {
                     readMore = true;
index 006684797b1284c1328549e640e0c3651c2d4a7f..cb5d18dc6f2b416024679fe3701df41197148e01 100644 (file)
@@ -1,10 +1,6 @@
 using System;
 using System.Buffers.Binary;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.IO;
 using System.Runtime.CompilerServices;
-using System.Text;
 using Microsoft.Extensions.ObjectPool;
 
 namespace Impostor.Benchmarks.Data
index 42f452ac7b30d23a535e99366ee9d4def79e4dee..b55b7970e4a76fd93f8bf3fb7e9b6d67cd8e279d 100644 (file)
@@ -32,7 +32,7 @@ namespace Impostor.Benchmarks.Data
         {
             if (includeHeader)
             {
-                byte[] output = new byte[this.Length];
+                var output = new byte[this.Length];
                 System.Buffer.BlockCopy(this.Buffer, 0, output, 0, this.Length);
                 return output;
             }
@@ -41,17 +41,17 @@ namespace Impostor.Benchmarks.Data
                 switch (this.SendOption)
                 {
                     case MessageType.Reliable:
-                        {
-                            byte[] output = new byte[this.Length - 3];
-                            System.Buffer.BlockCopy(this.Buffer, 3, output, 0, this.Length - 3);
-                            return output;
-                        }
+                    {
+                        var output = new byte[this.Length - 3];
+                        System.Buffer.BlockCopy(this.Buffer, 3, output, 0, this.Length - 3);
+                        return output;
+                    }
                     case MessageType.Unreliable:
-                        {
-                            byte[] output = new byte[this.Length - 1];
-                            System.Buffer.BlockCopy(this.Buffer, 1, output, 0, this.Length - 1);
-                            return output;
-                        }
+                    {
+                        var output = new byte[this.Length - 1];
+                        System.Buffer.BlockCopy(this.Buffer, 1, output, 0, this.Length - 1);
+                        return output;
+                    }
                     default:
                         throw new ArgumentOutOfRangeException();
                 }
@@ -87,7 +87,7 @@ namespace Impostor.Benchmarks.Data
         public void EndMessage()
         {
             var lastMessageStart = messageStarts.Pop();
-            ushort length = (ushort)(this.Position - lastMessageStart - 3); // Minus length and type byte
+            var length = (ushort)(this.Position - lastMessageStart - 3); // Minus length and type byte
             this.Buffer[lastMessageStart] = (byte)length;
             this.Buffer[lastMessageStart + 1] = (byte)(length >> 8);
         }
@@ -173,7 +173,7 @@ namespace Impostor.Benchmarks.Data
         {
             fixed (byte* ptr = &this.Buffer[this.Position])
             {
-                byte* valuePtr = (byte*)&value;
+                var valuePtr = (byte*)&value;
 
                 *ptr = *valuePtr;
                 *(ptr + 1) = *(valuePtr + 1);
@@ -260,7 +260,7 @@ namespace Impostor.Benchmarks.Data
         {
             do
             {
-                byte b = (byte)(value & 0xFF);
+                var b = (byte)(value & 0xFF);
                 if (value >= 0x80)
                 {
                     b |= 0x80;
@@ -275,7 +275,7 @@ namespace Impostor.Benchmarks.Data
 
         public void Write(MessageWriter msg, bool includeHeader)
         {
-            int offset = 0;
+            var offset = 0;
             if (!includeHeader)
             {
                 switch (msg.SendOption)
@@ -298,8 +298,8 @@ namespace Impostor.Benchmarks.Data
             byte b;
             unsafe
             {
-                int i = 1;
-                byte* bp = (byte*)&i;
+                var i = 1;
+                var bp = (byte*)&i;
                 b = *bp;
             }
 
index 5636dbed09a42f0e060906888fffc9f0be6ddc9b..3a7edecb8a4b32cce352a853e63cd43b47bd316e 100644 (file)
@@ -1,6 +1,5 @@
 using System;
 using System.Buffers.Binary;
-using Impostor.Hazel;
 
 namespace Impostor.Benchmarks.Data.Span
 {
index abf16428b55012fa047c36590856d4f6455585d2..dbaf2279dec9893808dae6bfe3a8838f456f7e39 100644 (file)
@@ -4,10 +4,8 @@ using BenchmarkDotNet.Attributes;
 using Impostor.Benchmarks.Data;
 using Impostor.Benchmarks.Data.Pool;
 using Impostor.Benchmarks.Extensions;
-using Impostor.Hazel;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.ObjectPool;
-using MessageWriter = Impostor.Benchmarks.Data.MessageWriter;
 
 namespace Impostor.Benchmarks.Tests
 {
@@ -24,7 +22,7 @@ namespace Impostor.Benchmarks.Tests
             message.StartMessage(1);
             message.Write((ushort)3100);
             message.Write((byte)100);
-            message.Write((int) int.MaxValue);
+            message.Write((int)int.MaxValue);
             message.WritePacked(int.MaxValue);
             message.EndMessage();
 
index aa8866adec43427b5c8756a7cf3dbb9b4f03cb61..ba039a57290c919937b21fe51f215baade242f95 100644 (file)
@@ -1,5 +1,4 @@
-using System;
-using System.Net;
+using System.Net;
 using System.Threading;
 using System.Threading.Tasks;
 using Impostor.Api.Innersloth;
@@ -31,7 +30,7 @@ namespace Impostor.Client.App
             Message00HostGameC2S.Serialize(writeGameCreate, new GameOptionsData
             {
                 MaxPlayers = 4,
-                NumImpostors = 2
+                NumImpostors = 2,
             });
 
             // TODO: ObjectPool for MessageReaders
index dec8cfecb280e9d16b526abc3bb518dea733865f..23d7f4b69ed9a7f17ff6c4a96239c8229fb2bdd1 100644 (file)
@@ -11,7 +11,7 @@ namespace Impostor.Hazel
     /// </summary>
     /// <remarks>
     ///     <para>
-    ///         Connection is the base class for all connections that Hazel can make. It provides common functionality and a 
+    ///         Connection is the base class for all connections that Hazel can make. It provides common functionality and a
     ///         standard interface to allow connections to be swapped easily.
     ///     </para>
     ///     <para>
@@ -29,7 +29,7 @@ namespace Impostor.Hazel
     ///         </list>
     ///     </para>
     /// </remarks>
-    /// <threadsafety static="true" instance="true"/>
+    /// <threadsafety static="true" instance="true" />
     public abstract class Connection : IDisposable
     {
         private static readonly ILogger Logger = Log.ForContext<Connection>();
@@ -39,34 +39,34 @@ namespace Impostor.Hazel
         /// </summary>
         /// <remarks>
         ///     <para>
-        ///         DataReceived is invoked everytime a message is received from the end point of this connection, the message 
-        ///         that was received can be found in the <see cref="DataReceivedEventArgs"/> alongside other information from the 
+        ///         DataReceived is invoked everytime a message is received from the end point of this connection, the message
+        ///         that was received can be found in the <see cref="DataReceivedEventArgs" /> alongside other information from the
         ///         event.
         ///     </para>
         ///     <include file="DocInclude/common.xml" path="docs/item[@name='Event_Thread_Safety_Warning']/*" />
         /// </remarks>
         /// <example>
-        ///     <code language="C#" source="DocInclude/TcpClientExample.cs"/>
+        ///     <code language="C#" source="DocInclude/TcpClientExample.cs" />
         /// </example>
         public Func<DataReceivedEventArgs, ValueTask> DataReceived;
 
         public int TestLagMs = -1;
         public int TestDropRate = 0;
         protected int testDropCount = 0;
-        
+
         /// <summary>
         ///     Called when the end point disconnects or an error occurs.
         /// </summary>
         /// <remarks>
         ///     <para>
-        ///         Disconnected is invoked when the connection is closed due to an exception occuring or because the remote 
-        ///         end point disconnected. If it was invoked due to an exception occuring then the exception is available 
-        ///         in the <see cref="DisconnectedEventArgs"/> passed with the event.
+        ///         Disconnected is invoked when the connection is closed due to an exception occuring or because the remote
+        ///         end point disconnected. If it was invoked due to an exception occuring then the exception is available
+        ///         in the <see cref="DisconnectedEventArgs" /> passed with the event.
         ///     </para>
         ///     <include file="DocInclude/common.xml" path="docs/item[@name='Event_Thread_Safety_Warning']/*" />
         /// </remarks>
         /// <example>
-        ///     <code language="C#" source="DocInclude/TcpClientExample.cs"/>
+        ///     <code language="C#" source="DocInclude/TcpClientExample.cs" />
         /// </example>
         public Func<DisconnectedEventArgs, ValueTask> Disconnected;
 
@@ -74,8 +74,8 @@ namespace Impostor.Hazel
         ///     The remote end point of this Connection.
         /// </summary>
         /// <remarks>
-        ///     This is the end point that this connection is connected to (i.e. the other device). This returns an abstract 
-        ///     <see cref="ConnectionEndPoint"/> which can then be cast to an appropriate end point depending on the 
+        ///     This is the end point that this connection is connected to (i.e. the other device). This returns an abstract
+        ///     <see cref="ConnectionEndPoint" /> which can then be cast to an appropriate end point depending on the
         ///     connection type.
         /// </remarks>
         public IPEndPoint EndPoint { get; protected set; }
@@ -95,7 +95,7 @@ namespace Impostor.Hazel
         /// </summary>
         /// <remarks>
         ///     All implementers should be aware that when this is set to ConnectionState.Connected it will
-        ///     release all threads that are blocked on <see cref="WaitOnConnect"/>.
+        ///     release all threads that are blocked on <see cref="WaitOnConnect" />.
         /// </remarks>
         public ConnectionState State
         {
@@ -103,7 +103,7 @@ namespace Impostor.Hazel
             {
                 return this._state;
             }
-            
+
             protected set
             {
                 this._state = value;
@@ -113,13 +113,13 @@ namespace Impostor.Hazel
 
         protected ConnectionState _state;
         protected virtual void SetState(ConnectionState state) { }
-        
+
         /// <summary>
         ///     Constructor that initializes the ConnecitonStatistics object.
         /// </summary>
         /// <remarks>
-        ///     This constructor initialises <see cref="Statistics"/> with empty statistics and sets <see cref="State"/> to 
-        ///     <see cref="ConnectionState.NotConnected"/>.
+        ///     This constructor initialises <see cref="Statistics" /> with empty statistics and sets <see cref="State" /> to
+        ///     <see cref="ConnectionState.NotConnected" />.
         /// </remarks>
         protected Connection()
         {
@@ -128,21 +128,21 @@ namespace Impostor.Hazel
         }
 
         /// <summary>
-        ///     Sends a number of bytes to the end point of the connection using the specified <see cref="MessageType"/>.
+        ///     Sends a number of bytes to the end point of the connection using the specified <see cref="MessageType" />.
         /// </summary>
         /// <param name="msg">The message to send.</param>
         /// <remarks>
         ///     <include file="DocInclude/common.xml" path="docs/item[@name='Connection_SendBytes_General']/*" />
         ///     <para>
         ///         The messageType parameter is only a request to use those options and the actual method used to send the
-        ///         data is up to the implementation. There are circumstances where this parameter may be ignored but in 
+        ///         data is up to the implementation. There are circumstances where this parameter may be ignored but in
         ///         general any implementer should aim to always follow the user's request.
         ///     </para>
         /// </remarks>
         public abstract ValueTask SendAsync(IMessageWriter msg);
 
         /// <summary>
-        ///     Sends a number of bytes to the end point of the connection using the specified <see cref="MessageType"/>.
+        ///     Sends a number of bytes to the end point of the connection using the specified <see cref="MessageType" />.
         /// </summary>
         /// <param name="bytes">The bytes of the message to send.</param>
         /// <param name="messageType">The option specifying how the message should be sent.</param>
@@ -150,7 +150,7 @@ namespace Impostor.Hazel
         ///     <include file="DocInclude/common.xml" path="docs/item[@name='Connection_SendBytes_General']/*" />
         ///     <para>
         ///         The messageType parameter is only a request to use those options and the actual method used to send the
-        ///         data is up to the implementation. There are circumstances where this parameter may be ignored but in 
+        ///         data is up to the implementation. There are circumstances where this parameter may be ignored but in
         ///         general any implementer should aim to always follow the user's request.
         ///     </para>
         /// </remarks>
@@ -167,9 +167,9 @@ namespace Impostor.Hazel
         ///     Invokes the DataReceived event.
         /// </summary>
         /// <param name="msg">The bytes received.</param>
-        /// <param name="messageType">The <see cref="MessageType"/> the message was received with.</param>
+        /// <param name="messageType">The <see cref="MessageType" /> the message was received with.</param>
         /// <remarks>
-        ///     Invokes the <see cref="DataReceived"/> event on this connection to alert subscribers a new message has been
+        ///     Invokes the <see cref="DataReceived" /> event on this connection to alert subscribers a new message has been
         ///     received. The bytes and the send option that the message was sent with should be passed in to give to the
         ///     subscribers.
         /// </remarks>
@@ -197,8 +197,8 @@ namespace Impostor.Hazel
         /// <param name="e">The exception, if any, that occurred to cause this.</param>
         /// <param name="reader">Extra disconnect data</param>
         /// <remarks>
-        ///     Invokes the <see cref="Disconnected"/> event to alert subscribres this connection has been disconnected either 
-        ///     by the end point or because an error occurred. If an error occurred the error should be passed in in order to 
+        ///     Invokes the <see cref="Disconnected" /> event to alert subscribres this connection has been disconnected either
+        ///     by the end point or because an error occurred. If an error occurred the error should be passed in in order to
         ///     pass to the subscribers, otherwise null can be passed in.
         /// </remarks>
         protected async ValueTask InvokeDisconnected(string e, IMessageReader reader)
@@ -219,11 +219,11 @@ namespace Impostor.Hazel
         }
 
         /// <summary>
-        /// For times when you want to force the disconnect handler to fire as well as close it.
-        /// If you only want to close it, just use Dispose.
+        ///     For times when you want to force the disconnect handler to fire as well as close it.
+        ///     If you only want to close it, just use Dispose.
         /// </summary>
         public abstract ValueTask Disconnect(string reason, MessageWriter writer = null);
-        
+
         /// <summary>
         ///     Disposes of this NetworkConnection.
         /// </summary>
index 116f657e47d462ac85419292fd2f59bf53800d4d..6c2f942ffd467a742ab8dd9ca506be0a3d9bc74f 100644 (file)
@@ -10,16 +10,16 @@ namespace Impostor.Hazel
     /// </summary>
     /// <remarks>
     ///     <para>
-    ///         ConnectionListeners are server side objects that listen for clients and create matching server side connections 
+    ///         ConnectionListeners are server side objects that listen for clients and create matching server side connections
     ///         for each client in a similar way to TCP does. These connections should be ready for communication immediately.
     ///     </para>
     ///     <para>
-    ///         Each time a client connects the <see cref="NewConnection"/> event will be invoked to alert all subscribers to
-    ///         the new connection. A disconnected event is then present on the <see cref="Connection"/> that is passed to the
+    ///         Each time a client connects the <see cref="NewConnection" /> event will be invoked to alert all subscribers to
+    ///         the new connection. A disconnected event is then present on the <see cref="Connection" /> that is passed to the
     ///         subscribers.
     ///     </para>
     /// </remarks>
-    /// <threadsafety static="true" instance="true"/>
+    /// <threadsafety static="true" instance="true" />
     public abstract class ConnectionListener : IAsyncDisposable
     {
         private static readonly ILogger Logger = Log.ForContext<ConnectionListener>();
@@ -29,18 +29,18 @@ namespace Impostor.Hazel
         /// </summary>
         /// <remarks>
         ///     <para>
-        ///         NewConnection is invoked each time a client connects to the listener. The 
-        ///         <see cref="NewConnectionEventArgs"/> contains the new <see cref="Connection"/> for communication with this
+        ///         NewConnection is invoked each time a client connects to the listener. The
+        ///         <see cref="NewConnectionEventArgs" /> contains the new <see cref="Connection" /> for communication with this
         ///         client.
         ///     </para>
         ///     <para>
-        ///         Hazel may or may not store connections so it is your responsibility to keep track and properly Dispose of 
-        ///         connections to your server. 
+        ///         Hazel may or may not store connections so it is your responsibility to keep track and properly Dispose of
+        ///         connections to your server.
         ///     </para>
         ///     <include file="DocInclude/common.xml" path="docs/item[@name='Event_Thread_Safety_Warning']/*" />
         /// </remarks>
         /// <example>
-        ///     <code language="C#" source="DocInclude/TcpListenerExample.cs"/>
+        ///     <code language="C#" source="DocInclude/TcpListenerExample.cs" />
         /// </example>
         public Func<NewConnectionEventArgs, ValueTask> NewConnection;
 
@@ -49,15 +49,15 @@ namespace Impostor.Hazel
         /// </summary>
         /// <remarks>
         ///     <para>
-        ///         This instructs the listener to begin listening for new clients connecting to the server. When a new client 
-        ///         connects the <see cref="NewConnection"/> event will be invoked containing the connection to the new client.
+        ///         This instructs the listener to begin listening for new clients connecting to the server. When a new client
+        ///         connects the <see cref="NewConnection" /> event will be invoked containing the connection to the new client.
         ///     </para>
         ///     <para>
-        ///         To stop listening you should call <see cref="DisposeAsync()"/>.
+        ///         To stop listening you should call <see cref="DisposeAsync()" />.
         ///     </para>
         /// </remarks>
         /// <example>
-        ///     <code language="C#" source="DocInclude/TcpListenerExample.cs"/>
+        ///     <code language="C#" source="DocInclude/TcpListenerExample.cs" />
         /// </example>
         public abstract Task StartAsync();
 
@@ -67,7 +67,7 @@ namespace Impostor.Hazel
         /// <param name="msg">The user sent bytes that were received as part of the handshake.</param>
         /// <param name="connection">The connection to pass in the arguments.</param>
         /// <remarks>
-        ///     Implementers should call this to invoke the <see cref="NewConnection"/> event before data is received so that
+        ///     Implementers should call this to invoke the <see cref="NewConnection" /> event before data is received so that
         ///     subscribers do not miss any data that may have been sent immediately after connecting.
         /// </remarks>
         internal async Task InvokeNewConnection(IMessageReader msg, Connection connection)
index 5dd7c6a0767bcfc28fd90de26a92cd4a53f80620..c9fd4de0f9c97be599a23629774a030216c8f552 100644 (file)
@@ -1,7 +1,7 @@
 namespace Impostor.Hazel
 {
     /// <summary>
-    ///     Represents the state a <see cref="Connection"/> is currently in.
+    ///     Represents the state a <see cref="Connection" /> is currently in.
     /// </summary>
     public enum ConnectionState
     {
@@ -9,7 +9,7 @@
         ///     The Connection has either not been established yet or has been disconnected.
         /// </summary>
         NotConnected,
-        
+
         /// <summary>
         ///     The Connection is currently connecting to an endpoint.
         /// </summary>
index 48026208e24a3af5a8cce446874842cfc9e36727..cd7567cf01ac962930e870b58462012bf6b51c88 100644 (file)
@@ -2,12 +2,13 @@
 using System.Threading;
 
 [assembly: InternalsVisibleTo("Hazel.Tests")]
+
 namespace Impostor.Hazel
 {
     /// <summary>
-    ///     Holds statistics about the traffic through a <see cref="Connection"/>.
+    ///     Holds statistics about the traffic through a <see cref="Connection" />.
     /// </summary>
-    /// <threadsafety static="true" instance="true"/>
+    /// <threadsafety static="true" instance="true" />
     public class ConnectionStatistics
     {
         private const int ExpectedMTU = 1200;
@@ -27,8 +28,8 @@ namespace Impostor.Hazel
         ///     The number of messages sent larger than 576 bytes. This is smaller than most default MTUs.
         /// </summary>
         /// <remarks>
-        ///     This is the number of unreliable messages that were sent from the <see cref="Connection"/>, incremented 
-        ///     each time that LogUnreliableSend is called by the Connection. Messages that caused an error are not 
+        ///     This is the number of unreliable messages that were sent from the <see cref="Connection" />, incremented
+        ///     each time that LogUnreliableSend is called by the Connection. Messages that caused an error are not
         ///     counted and messages are only counted once all other operations in the send are complete.
         /// </remarks>
         public int FragmentableMessagesSent
@@ -48,8 +49,8 @@ namespace Impostor.Hazel
         ///     The number of unreliable messages sent.
         /// </summary>
         /// <remarks>
-        ///     This is the number of unreliable messages that were sent from the <see cref="Connection"/>, incremented 
-        ///     each time that LogUnreliableSend is called by the Connection. Messages that caused an error are not 
+        ///     This is the number of unreliable messages that were sent from the <see cref="Connection" />, incremented
+        ///     each time that LogUnreliableSend is called by the Connection. Messages that caused an error are not
         ///     counted and messages are only counted once all other operations in the send are complete.
         /// </remarks>
         public int UnreliableMessagesSent
@@ -69,8 +70,8 @@ namespace Impostor.Hazel
         ///     The number of reliable messages sent.
         /// </summary>
         /// <remarks>
-        ///     This is the number of reliable messages that were sent from the <see cref="Connection"/>, incremented 
-        ///     each time that LogReliableSend is called by the Connection. Messages that caused an error are not 
+        ///     This is the number of reliable messages that were sent from the <see cref="Connection" />, incremented
+        ///     each time that LogReliableSend is called by the Connection. Messages that caused an error are not
         ///     counted and messages are only counted once all other operations in the send are complete.
         /// </remarks>
         public int ReliableMessagesSent
@@ -90,8 +91,8 @@ namespace Impostor.Hazel
         ///     The number of fragmented messages sent.
         /// </summary>
         /// <remarks>
-        ///     This is the number of fragmented messages that were sent from the <see cref="Connection"/>, incremented 
-        ///     each time that LogFragmentedSend is called by the Connection. Messages that caused an error are not 
+        ///     This is the number of fragmented messages that were sent from the <see cref="Connection" />, incremented
+        ///     each time that LogFragmentedSend is called by the Connection. Messages that caused an error are not
         ///     counted and messages are only counted once all other operations in the send are complete.
         /// </remarks>
         public int FragmentedMessagesSent
@@ -111,8 +112,8 @@ namespace Impostor.Hazel
         ///     The number of acknowledgement messages sent.
         /// </summary>
         /// <remarks>
-        ///     This is the number of acknowledgements that were sent from the <see cref="Connection"/>, incremented 
-        ///     each time that LogAcknowledgementSend is called by the Connection. Messages that caused an error are not 
+        ///     This is the number of acknowledgements that were sent from the <see cref="Connection" />, incremented
+        ///     each time that LogAcknowledgementSend is called by the Connection. Messages that caused an error are not
         ///     counted and messages are only counted once all other operations in the send are complete.
         /// </remarks>
         public int AcknowledgementMessagesSent
@@ -132,8 +133,8 @@ namespace Impostor.Hazel
         ///     The number of hello messages sent.
         /// </summary>
         /// <remarks>
-        ///     This is the number of hello messages that were sent from the <see cref="Connection"/>, incremented 
-        ///     each time that LogHelloSend is called by the Connection. Messages that caused an error are not 
+        ///     This is the number of hello messages that were sent from the <see cref="Connection" />, incremented
+        ///     each time that LogHelloSend is called by the Connection. Messages that caused an error are not
         ///     counted and messages are only counted once all other operations in the send are complete.
         /// </remarks>
         public int HelloMessagesSent
@@ -154,12 +155,12 @@ namespace Impostor.Hazel
         /// </summary>
         /// <remarks>
         ///     <para>
-        ///         This is the number of bytes of data (i.e. user bytes) that were sent from the <see cref="Connection"/>, 
-        ///         accumulated each time that LogSend is called by the Connection. Messages that caused an error are not 
+        ///         This is the number of bytes of data (i.e. user bytes) that were sent from the <see cref="Connection" />,
+        ///         accumulated each time that LogSend is called by the Connection. Messages that caused an error are not
         ///         counted and messages are only counted once all other operations in the send are complete.
         ///     </para>
         ///     <para>
-        ///         For the number of bytes including protocol bytes see <see cref="TotalBytesSent"/>.
+        ///         For the number of bytes including protocol bytes see <see cref="TotalBytesSent" />.
         ///     </para>
         /// </remarks>
         public long DataBytesSent
@@ -180,13 +181,13 @@ namespace Impostor.Hazel
         /// </summary>
         /// <remarks>
         ///     <para>
-        ///         This is the total number of bytes (the data bytes plus protocol bytes) that were sent from the 
-        ///         <see cref="Connection"/>, accumulated each time that LogSend is called by the Connection. Messages that 
-        ///         caused an error are not counted and messages are only counted once all other operations in the send are 
+        ///         This is the total number of bytes (the data bytes plus protocol bytes) that were sent from the
+        ///         <see cref="Connection" />, accumulated each time that LogSend is called by the Connection. Messages that
+        ///         caused an error are not counted and messages are only counted once all other operations in the send are
         ///         complete.
         ///     </para>
         ///     <para>
-        ///         For the number of data bytes excluding protocol bytes see <see cref="DataBytesSent"/>.
+        ///         For the number of data bytes excluding protocol bytes see <see cref="DataBytesSent" />.
         ///     </para>
         /// </remarks>
         public long TotalBytesSent
@@ -212,12 +213,12 @@ namespace Impostor.Hazel
                 return UnreliableMessagesReceived + ReliableMessagesReceived + FragmentedMessagesReceived + AcknowledgementMessagesReceived + helloMessagesReceived;
             }
         }
-        
+
         /// <summary>
         ///     The number of unreliable messages received.
         /// </summary>
         /// <remarks>
-        ///     This is the number of unreliable messages that were received by the <see cref="Connection"/>, incremented
+        ///     This is the number of unreliable messages that were received by the <see cref="Connection" />, incremented
         ///     each time that LogUnreliableReceive is called by the Connection. Messages are counted before the receive event is invoked.
         /// </remarks>
         public int UnreliableMessagesReceived
@@ -237,7 +238,7 @@ namespace Impostor.Hazel
         ///     The number of reliable messages received.
         /// </summary>
         /// <remarks>
-        ///     This is the number of reliable messages that were received by the <see cref="Connection"/>, incremented
+        ///     This is the number of reliable messages that were received by the <see cref="Connection" />, incremented
         ///     each time that LogReliableReceive is called by the Connection. Messages are counted before the receive event is invoked.
         /// </remarks>
         public int ReliableMessagesReceived
@@ -257,7 +258,7 @@ namespace Impostor.Hazel
         ///     The number of fragmented messages received.
         /// </summary>
         /// <remarks>
-        ///     This is the number of fragmented messages that were received by the <see cref="Connection"/>, incremented
+        ///     This is the number of fragmented messages that were received by the <see cref="Connection" />, incremented
         ///     each time that LogFragmentedReceive is called by the Connection. Messages are counted before the receive event is invoked.
         /// </remarks>
         public int FragmentedMessagesReceived
@@ -277,7 +278,7 @@ namespace Impostor.Hazel
         ///     The number of acknowledgement messages received.
         /// </summary>
         /// <remarks>
-        ///     This is the number of acknowledgement messages that were received by the <see cref="Connection"/>, incremented
+        ///     This is the number of acknowledgement messages that were received by the <see cref="Connection" />, incremented
         ///     each time that LogAcknowledgemntReceive is called by the Connection. Messages are counted before the receive event is invoked.
         /// </remarks>
         public int AcknowledgementMessagesReceived
@@ -297,7 +298,7 @@ namespace Impostor.Hazel
         ///     The number of ping messages received.
         /// </summary>
         /// <remarks>
-        ///     This is the number of hello messages that were received by the <see cref="Connection"/>, incremented
+        ///     This is the number of hello messages that were received by the <see cref="Connection" />, incremented
         ///     each time that LogHelloReceive is called by the Connection. Messages are counted before the receive event is invoked.
         /// </remarks>
         public int PingMessagesReceived
@@ -317,7 +318,7 @@ namespace Impostor.Hazel
         ///     The number of hello messages received.
         /// </summary>
         /// <remarks>
-        ///     This is the number of hello messages that were received by the <see cref="Connection"/>, incremented
+        ///     This is the number of hello messages that were received by the <see cref="Connection" />, incremented
         ///     each time that LogHelloReceive is called by the Connection. Messages are counted before the receive event is invoked.
         /// </remarks>
         public int HelloMessagesReceived
@@ -338,12 +339,12 @@ namespace Impostor.Hazel
         /// </summary>
         /// <remarks>
         ///     <para>
-        ///         This is the number of bytes of data (i.e. user bytes) that were received by the <see cref="Connection"/>, 
+        ///         This is the number of bytes of data (i.e. user bytes) that were received by the <see cref="Connection" />,
         ///         accumulated each time that LogReceive is called by the Connection. Messages are counted before the receive
         ///         event is invoked.
         ///     </para>
         ///     <para>
-        ///         For the number of bytes including protocol bytes see <see cref="TotalBytesReceived"/>.
+        ///         For the number of bytes including protocol bytes see <see cref="TotalBytesReceived" />.
         ///     </para>
         /// </remarks>
         public long DataBytesReceived
@@ -364,12 +365,12 @@ namespace Impostor.Hazel
         /// </summary>
         /// <remarks>
         ///     <para>
-        ///         This is the total number of bytes (the data bytes plus protocol bytes) that were received by the 
-        ///         <see cref="Connection"/>, accumulated each time that LogReceive is called by the Connection. Messages are 
+        ///         This is the total number of bytes (the data bytes plus protocol bytes) that were received by the
+        ///         <see cref="Connection" />, accumulated each time that LogReceive is called by the Connection. Messages are
         ///         counted before the receive event is invoked.
         ///     </para>
         ///     <para>
-        ///         For the number of data bytes excluding protocol bytes see <see cref="DataBytesReceived"/>.
+        ///         For the number of data bytes excluding protocol bytes see <see cref="DataBytesReceived" />.
         ///     </para>
         /// </remarks>
         public long TotalBytesReceived
index 9176d8d935ec88dd32897cce5d31eab7ac28bc9a..d2259e58eca59440c6ccfb965da38017f74b0c9f 100644 (file)
@@ -12,10 +12,10 @@ namespace Impostor.Hazel
         public readonly IMessageReader Message;
 
         /// <summary>
-        ///     The <see cref="Type"/> the data was sent with.
+        ///     The <see cref="Type" /> the data was sent with.
         /// </summary>
         public readonly MessageType Type;
-        
+
         public DataReceivedEventArgs(Connection sender, IMessageReader msg, MessageType type)
         {
             this.Sender = sender;
index d46df4b9c9a319e5ea4925eaf16fc2a53af83dcd..4872aea9785b79116d55850ea18dd32fe2ce57f3 100644 (file)
@@ -6,13 +6,13 @@ namespace Impostor.Hazel
     public class DisconnectedEventArgs : EventArgs
     {
         /// <summary>
-        /// Optional disconnect reason. May be null.
+        ///     Optional disconnect reason. May be null.
         /// </summary>
         public readonly string Reason;
 
         /// <summary>
-        /// Optional data sent with a disconnect message. May be null. 
-        /// You must not recycle this. If you need the message outside of a callback, you should copy it.
+        ///     Optional data sent with a disconnect message. May be null.
+        ///     You must not recycle this. If you need the message outside of a callback, you should copy it.
         /// </summary>
         public readonly IMessageReader Message;
 
index 8c6fc3c12984200a0e2493611e4154fd4ee72347..81c8017a89b9d2eae0f6a542551b9fe28e367c9b 100644 (file)
@@ -8,14 +8,12 @@ namespace Impostor.Hazel
     [Serializable]
     public class HazelException : Exception
     {
-        internal HazelException(string msg) : base (msg)
+        internal HazelException(string msg) : base(msg)
         {
-
         }
 
-        internal HazelException(string msg, Exception e) : base (msg, e)
+        internal HazelException(string msg, Exception e) : base(msg, e)
         {
-
         }
     }
 }
index 5eb6679e56b417c1f334359d068df858b85f5a97..3f4395841ceead40528370f4a0c4d73fd3c84a55 100644 (file)
@@ -4,8 +4,8 @@
     ///     Represents the IP version that a connection or listener will use.
     /// </summary>
     /// <remarks>
-    ///     If you wand a client to connect or be able to connect using IPv6 then you should use <see cref="IPv4AndIPv6"/>, 
-    ///     this sets the underlying sockets to use IPv6 but still allow IPv4 sockets to connect for backwards compatability 
+    ///     If you wand a client to connect or be able to connect using IPv6 then you should use <see cref="IPv4AndIPv6" />,
+    ///     this sets the underlying sockets to use IPv6 but still allow IPv4 sockets to connect for backwards compatability
     ///     and hence it is the default IPMode in most cases.
     /// </remarks>
     public enum IPMode
@@ -16,9 +16,9 @@
         IPv4,
 
         /// <summary>
-        ///     Instruction to use IPv6 only, IPv4 connections will not be able to connect. IPv4 addresses can be connected 
+        ///     Instruction to use IPv6 only, IPv4 connections will not be able to connect. IPv4 addresses can be connected
         ///     by converting to IPv6 addresses.
         /// </summary>
-        IPv6
+        IPv6,
     }
 }
index 69be1225b5580a158ba0ff209499d95344b65269..0ddc04cd1b143748115c91d2c4b36c643b26cb71 100644 (file)
@@ -3,7 +3,7 @@
     /// <summary>
     ///     Interface for all items that can be returned to an object pool.
     /// </summary>
-    /// <threadsafety static="true" instance="true"/>
+    /// <threadsafety static="true" instance="true" />
     public interface IRecyclable
     {
         /// <summary>
index 317e45b1ee1a2c2898ebe5e5bf5ab5ba470370e5..969e41b04d0305c1b0fd3a35e0ce1d5094903b56 100644 (file)
@@ -78,7 +78,7 @@ namespace Impostor.Hazel
 
         public bool ReadBoolean()
         {
-            byte val = FastByte();
+            var val = FastByte();
             return val != 0;
         }
 
@@ -159,13 +159,13 @@ namespace Impostor.Hazel
 
         public uint ReadPackedUInt32()
         {
-            bool readMore = true;
-            int shift = 0;
+            var readMore = true;
+            var shift = 0;
             uint output = 0;
 
             while (readMore)
             {
-                byte b = FastByte();
+                var b = FastByte();
                 if (b >= 0x80)
                 {
                     readMore = true;
@@ -185,8 +185,8 @@ namespace Impostor.Hazel
 
         public void CopyTo(IMessageWriter writer)
         {
-            writer.Write((ushort) Length);
-            writer.Write((byte) Tag);
+            writer.Write((ushort)Length);
+            writer.Write((byte)Tag);
             writer.Write(Buffer.AsMemory(Offset, Length));
         }
 
@@ -213,7 +213,7 @@ namespace Impostor.Hazel
 
             System.Buffer.BlockCopy(Buffer, offsetEnd, Buffer, offsetStart, lengthToCopy);
 
-            ((MessageReader) message).Parent.AdjustLength(message.Offset, message.Length + 3);
+            ((MessageReader)message).Parent.AdjustLength(message.Offset, message.Length + 3);
         }
 
         private void AdjustLength(int offset, int amount)
@@ -255,9 +255,9 @@ namespace Impostor.Hazel
         public Vector2 ReadVector2()
         {
             const float range = 50f;
-            
-            var x = ReadUInt16() / (float) ushort.MaxValue;
-            var y = ReadUInt16() / (float) ushort.MaxValue;
+
+            var x = ReadUInt16() / (float)ushort.MaxValue;
+            var y = ReadUInt16() / (float)ushort.MaxValue;
 
             return new Vector2(Mathf.Lerp(-range, range, x), Mathf.Lerp(-range, range, y));
         }
index a7b57e78e7c3e3ea599dc824d6d959f0efda6364..bb71a71b50a3008ca44de2cce22ce7b8a57052ec 100644 (file)
@@ -1,12 +1,11 @@
-using Impostor.Api.Games;
-using Impostor.Api.Net.Messages;
-
-using System;
+using System;
 using System.Collections.Generic;
 using System.Net;
 using System.Numerics;
 using System.Text;
+using Impostor.Api.Games;
 using Impostor.Api.Net.Inner;
+using Impostor.Api.Net.Messages;
 using Impostor.Api.Unity;
 
 namespace Impostor.Hazel
@@ -39,7 +38,7 @@ namespace Impostor.Hazel
         {
             if (includeHeader)
             {
-                byte[] output = new byte[this.Length];
+                var output = new byte[this.Length];
                 System.Buffer.BlockCopy(this.Buffer, 0, output, 0, this.Length);
                 return output;
             }
@@ -48,17 +47,17 @@ namespace Impostor.Hazel
                 switch (this.SendOption)
                 {
                     case MessageType.Reliable:
-                        {
-                            byte[] output = new byte[this.Length - 3];
-                            System.Buffer.BlockCopy(this.Buffer, 3, output, 0, this.Length - 3);
-                            return output;
-                        }
+                    {
+                        var output = new byte[this.Length - 3];
+                        System.Buffer.BlockCopy(this.Buffer, 3, output, 0, this.Length - 3);
+                        return output;
+                    }
                     case MessageType.Unreliable:
-                        {
-                            byte[] output = new byte[this.Length - 1];
-                            System.Buffer.BlockCopy(this.Buffer, 1, output, 0, this.Length - 1);
-                            return output;
-                        }
+                    {
+                        var output = new byte[this.Length - 1];
+                        System.Buffer.BlockCopy(this.Buffer, 1, output, 0, this.Length - 1);
+                        return output;
+                    }
                     default:
                         throw new ArgumentOutOfRangeException();
                 }
@@ -67,7 +66,6 @@ namespace Impostor.Hazel
             throw new NotImplementedException();
         }
 
-        ///
         /// <param name="sendOption">The option specifying how the message should be sent.</param>
         public static MessageWriter Get(MessageType sendOption = MessageType.Unreliable)
         {
@@ -106,8 +104,8 @@ namespace Impostor.Hazel
 
         public void Write(Vector2 vector)
         {
-            Write((ushort)(Mathf.ReverseLerp(vector.X) * (double) ushort.MaxValue));
-            Write((ushort)(Mathf.ReverseLerp(vector.Y) * (double) ushort.MaxValue));
+            Write((ushort)(Mathf.ReverseLerp(vector.X) * (double)ushort.MaxValue));
+            Write((ushort)(Mathf.ReverseLerp(vector.Y) * (double)ushort.MaxValue));
         }
 
         ///
@@ -122,7 +120,7 @@ namespace Impostor.Hazel
         public void EndMessage()
         {
             var lastMessageStart = messageStarts.Pop();
-            ushort length = (ushort)(this.Position - lastMessageStart - 3); // Minus length and type byte
+            var length = (ushort)(this.Position - lastMessageStart - 3); // Minus length and type byte
             this.Buffer[lastMessageStart] = (byte)length;
             this.Buffer[lastMessageStart + 1] = (byte)(length >> 8);
         }
@@ -215,7 +213,7 @@ namespace Impostor.Hazel
         {
             fixed (byte* ptr = &this.Buffer[this.Position])
             {
-                byte* valuePtr = (byte*)&value;
+                var valuePtr = (byte*)&value;
 
                 *ptr = *valuePtr;
                 *(ptr + 1) = *(valuePtr + 1);
@@ -302,7 +300,7 @@ namespace Impostor.Hazel
         {
             do
             {
-                byte b = (byte)(value & 0xFF);
+                var b = (byte)(value & 0xFF);
                 if (value >= 0x80)
                 {
                     b |= 0x80;
@@ -317,7 +315,7 @@ namespace Impostor.Hazel
 
         public void Write(MessageWriter msg, bool includeHeader)
         {
-            int offset = 0;
+            var offset = 0;
             if (!includeHeader)
             {
                 switch (msg.SendOption)
@@ -340,8 +338,8 @@ namespace Impostor.Hazel
             byte b;
             unsafe
             {
-                int i = 1;
-                byte* bp = (byte*)&i;
+                var i = 1;
+                var bp = (byte*)&i;
                 b = *bp;
             }
 
index 9e81c5cc074252b16b8c9da546a7d63897c1f713..b530f017d170794a8412db40655db63afd12889d 100644 (file)
@@ -12,17 +12,17 @@ namespace Impostor.Hazel
         ReceivedZeroBytes,
         PingsWithoutResponse,
         ReliablePacketWithoutResponse,
-        ConnectionDisconnected
+        ConnectionDisconnected,
     }
 
     /// <summary>
-    ///     Abstract base class for a <see cref="Connection"/> to a remote end point via a network protocol like TCP or UDP.
+    ///     Abstract base class for a <see cref="Connection" /> to a remote end point via a network protocol like TCP or UDP.
     /// </summary>
-    /// <threadsafety static="true" instance="true"/>
+    /// <threadsafety static="true" instance="true" />
     public abstract class NetworkConnection : Connection
     {
         /// <summary>
-        /// An event that gives us a chance to send well-formed disconnect messages to clients when an internal disconnect happens.
+        ///     An event that gives us a chance to send well-formed disconnect messages to clients when an internal disconnect happens.
         /// </summary>
         public Func<HazelInternalErrors, MessageWriter> OnInternalDisconnect;
 
@@ -30,8 +30,8 @@ namespace Impostor.Hazel
         ///     The remote end point of this connection.
         /// </summary>
         /// <remarks>
-        ///     This is the end point of the other device given as an <see cref="System.Net.EndPoint"/> rather than a generic
-        ///     <see cref="ConnectionEndPoint"/> as the base <see cref="Connection"/> does.
+        ///     This is the end point of the other device given as an <see cref="System.Net.EndPoint" /> rather than a generic
+        ///     <see cref="ConnectionEndPoint" /> as the base <see cref="Connection" /> does.
         /// </remarks>
         public IPEndPoint RemoteEndPoint { get; protected set; }
 
@@ -67,14 +67,14 @@ namespace Impostor.Hazel
         }
 
         /// <summary>
-        /// Called when socket is disconnected internally
+        ///     Called when socket is disconnected internally
         /// </summary>
         internal async ValueTask DisconnectInternal(HazelInternalErrors error, string reason)
         {
             var handler = this.OnInternalDisconnect;
             if (handler != null)
             {
-                MessageWriter messageToRemote = handler(error);
+                var messageToRemote = handler(error);
                 if (messageToRemote != null)
                 {
                     try
index e1d7ffaf84ded796ba55dd53a5599b5344021cc8..e2824b1c913629c8fb2b3464219783a9e3a44ea2 100644 (file)
@@ -3,9 +3,9 @@
 namespace Impostor.Hazel
 {
     /// <summary>
-    ///     Abstract base class for a <see cref="ConnectionListener"/> for network based connections.
+    ///     Abstract base class for a <see cref="ConnectionListener" /> for network based connections.
     /// </summary>
-    /// <threadsafety static="true" instance="true"/>
+    /// <threadsafety static="true" instance="true" />
     public abstract class NetworkConnectionListener : ConnectionListener
     {
         /// <summary>
index be9e7a214c98f43c92f192660668545c32e7497b..77ec05de2b5c69a77cc109fce222f46bf345b021 100644 (file)
@@ -5,13 +5,13 @@ namespace Impostor.Hazel
     public struct NewConnectionEventArgs
     {
         /// <summary>
-        /// The data received from the client in the handshake.
-        /// This data is yours. Remember to recycle it.
+        ///     The data received from the client in the handshake.
+        ///     This data is yours. Remember to recycle it.
         /// </summary>
         public readonly IMessageReader HandshakeData;
 
         /// <summary>
-        /// The <see cref="Connection"/> to the new client.
+        ///     The <see cref="Connection" /> to the new client.
         /// </summary>
         public readonly Connection Connection;
 
index 5c9ef9b40468416f0e6e8249b9891fd7ffd82d8b..f1256eb61f396e638b72ebe68ee443ccf2b8e0a5 100644 (file)
@@ -8,7 +8,7 @@ namespace Impostor.Hazel
     ///     A fairly simple object pool for items that will be created a lot.
     /// </summary>
     /// <typeparam name="T">The type that is pooled.</typeparam>
-    /// <threadsafety static="true" instance="true"/>
+    /// <threadsafety static="true" instance="true" />
     public sealed class ObjectPoolCustom<T> where T : IRecyclable
     {
         private int numberCreated;
@@ -32,7 +32,7 @@ namespace Impostor.Hazel
         /// </summary>
         /// <returns></returns>
         private readonly Func<T> objectFactory;
-        
+
         /// <summary>
         ///     Internal constructor for our ObjectPool.
         /// </summary>
@@ -48,7 +48,7 @@ namespace Impostor.Hazel
         internal T GetObject()
         {
 #if HAZEL_BAG
-            if (!pool.TryTake(out T item))
+            if (!pool.TryTake(out var item))
             {
                 Interlocked.Increment(ref numberCreated);
                 item = objectFactory.Invoke();
@@ -85,7 +85,7 @@ namespace Impostor.Hazel
         /// <param name="item">The item to return.</param>
         internal void PutObject(T item)
         {
-            if (inuse.TryRemove(item, out bool b))
+            if (inuse.TryRemove(item, out var b))
             {
 #if HAZEL_BAG
                 pool.Add(item);
index c0c4e2127e823e36352f6ffae31f88ee31fe6a0e..11baa854ff8513ee7fd150589afd62918cb361b3 100644 (file)
@@ -11,7 +11,7 @@
         Hello = 8,
 
         /// <summary>
-        /// A single byte of continued existence
+        ///     A single byte of continued existence
         /// </summary>
         Ping = 12,
 
index ed7b68dbd47d5206adbf698b6b26d574af503785..3c768efc387646d1d17b6f9ebf6282ca5a6aded5 100644 (file)
@@ -89,21 +89,21 @@ namespace Impostor.Hazel.Udp
                 return;
             }
 
-            if (numBytes < 3 
+            if (numBytes < 3
                 || buffer[0] != 4 || buffer[1] != 2)
             {
                 this.StartListen();
                 return;
             }
 
-            IPEndPoint ipEnd = (IPEndPoint)endpt;
-            string data = UTF8Encoding.UTF8.GetString(buffer, 2, numBytes - 2);
-            int dataHash = data.GetHashCode();
+            var ipEnd = (IPEndPoint)endpt;
+            var data = UTF8Encoding.UTF8.GetString(buffer, 2, numBytes - 2);
+            var dataHash = data.GetHashCode();
 
             lock (packets)
             {
-                bool found = false;
-                for (int i = 0; i < this.packets.Count; ++i)
+                var found = false;
+                for (var i = 0; i < this.packets.Count; ++i)
                 {
                     var pkt = this.packets[i];
                     if (pkt == null || pkt.Data == null)
@@ -146,11 +146,17 @@ namespace Impostor.Hazel.Udp
         {
             if (this.socket != null)
             {
-                try { this.socket.Shutdown(SocketShutdown.Both); } catch { }
-                try { this.socket.Close(); } catch { }
-                try { this.socket.Dispose(); } catch { }
+                try { this.socket.Shutdown(SocketShutdown.Both); }
+                catch { }
+
+                try { this.socket.Close(); }
+                catch { }
+
+                try { this.socket.Dispose(); }
+                catch { }
+
                 this.socket = null;
             }
         }
     }
-}
\ No newline at end of file
+}
index 5fa1ccac255ac37351a12e52ec9d9abfb428132a..32f0e187ae939d5e49c3770bc65b781f8bde7583 100644 (file)
@@ -26,7 +26,7 @@ namespace Impostor.Hazel.Udp
         ///
         public void SetData(string data)
         {
-            int len = UTF8Encoding.UTF8.GetByteCount(data);
+            var len = UTF8Encoding.UTF8.GetByteCount(data);
             this.data = new byte[len + 2];
             this.data[0] = 4;
             this.data[1] = 2;
@@ -69,11 +69,17 @@ namespace Impostor.Hazel.Udp
         {
             if (this.socket != null)
             {
-                try { this.socket.Shutdown(SocketShutdown.Both); } catch { }
-                try { this.socket.Close(); } catch { }
-                try { this.socket.Dispose(); } catch { }
+                try { this.socket.Shutdown(SocketShutdown.Both); }
+                catch { }
+
+                try { this.socket.Close(); }
+                catch { }
+
+                try { this.socket.Dispose(); }
+                catch { }
+
                 this.socket = null;
             }
         }
     }
-}
\ No newline at end of file
+}
index 5125ebe8034522a2e4c8b6b08d73ba81fe34c3c0..cb27e2400cdb3ad80c4f023c108df17e446b1354 100644 (file)
@@ -1,9 +1,7 @@
 using System;
-using System.Buffers;
 using System.Net;
 using System.Net.Sockets;
 using System.Threading;
-using System.Threading.Channels;
 using System.Threading.Tasks;
 using Impostor.Api.Net.Messages;
 using Microsoft.Extensions.ObjectPool;
@@ -14,7 +12,7 @@ namespace Impostor.Hazel.Udp
     /// <summary>
     ///     Represents a client's connection to a server that uses the UDP protocol.
     /// </summary>
-    /// <inheritdoc/>
+    /// <inheritdoc />
     public sealed class UdpClientConnection : UdpConnection
     {
         private static readonly ILogger Logger = Log.ForContext<UdpClientConnection>();
@@ -31,7 +29,7 @@ namespace Impostor.Hazel.Udp
         /// <summary>
         ///     Creates a new UdpClientConnection.
         /// </summary>
-        /// <param name="remoteEndPoint">A <see cref="NetworkEndPoint"/> to connect to.</param>
+        /// <param name="remoteEndPoint">A <see cref="NetworkEndPoint" /> to connect to.</param>
         public UdpClientConnection(IPEndPoint remoteEndPoint, ObjectPool<MessageReader> readerPool, IPMode ipMode = IPMode.IPv4) : base(null, readerPool)
         {
             EndPoint = remoteEndPoint;
@@ -40,7 +38,7 @@ namespace Impostor.Hazel.Udp
 
             _socket = new UdpClient
             {
-                DontFragment = false
+                DontFragment = false,
             };
 
             _reliablePacketTimer = new Timer(ManageReliablePacketsInternal, null, 100, Timeout.Infinite);
@@ -213,8 +211,11 @@ namespace Impostor.Hazel.Udp
         {
             State = ConnectionState.NotConnected;
 
-            try { _socket.Close(); } catch { }
-            try { _socket.Dispose(); } catch { }
+            try { _socket.Close(); }
+            catch { }
+
+            try { _socket.Dispose(); }
+            catch { }
 
             _reliablePacketTimer.Dispose();
             _connectWaitLock.Dispose();
index a73291bc4e1b68d9b764763fe60656822ecd145e..e8303a4e77e0d9c9a148aeb2d9bc99b589376ac4 100644 (file)
@@ -8,7 +8,6 @@ namespace Impostor.Hazel.Udp
 {
     partial class UdpConnection
     {
-
         /// <summary>
         ///     Class to hold packet data
         /// </summary>
@@ -58,6 +57,7 @@ namespace Impostor.Hazel.Udp
                 ResetKeepAliveTimer();
             }
         }
+
         private int keepAliveInterval = 1500;
 
         public int MissingPingsUntilDisconnect { get; set; } = 6;
@@ -109,9 +109,9 @@ namespace Impostor.Hazel.Udp
         // pings should cause a disconnect.
         private async ValueTask SendPing()
         {
-            ushort id = (ushort)Interlocked.Increment(ref lastIDAllocated);
+            var id = (ushort)Interlocked.Increment(ref lastIDAllocated);
 
-            byte[] bytes = new byte[3];
+            var bytes = new byte[3];
             bytes[0] = (byte)UdpSendOption.Ping;
             bytes[1] = (byte)(id >> 8);
             bytes[2] = (byte)id;
@@ -164,4 +164,4 @@ namespace Impostor.Hazel.Udp
             }
         }
     }
-}
\ No newline at end of file
+}
index 7f439269d2001d8c280b661e987914402343fed8..9c13f22df966cd90563278d388a6ef0510118ee2 100644 (file)
@@ -15,25 +15,25 @@ namespace Impostor.Hazel.Udp
         /// </summary>
         /// <remarks>
         ///     <para>
-        ///         For reliable delivery data is resent at specified intervals unless an acknowledgement is received from the 
+        ///         For reliable delivery data is resent at specified intervals unless an acknowledgement is received from the
         ///         receiving device. The ResendTimeout specifies the interval between the packets being resent, each time a packet
-        ///         is resent the interval is increased for that packet until the duration exceeds the <see cref="DisconnectTimeout"/> value.
+        ///         is resent the interval is increased for that packet until the duration exceeds the <see cref="DisconnectTimeout" /> value.
         ///     </para>
         ///     <para>
-        ///         Setting this to its default of 0 will mean the timeout is 2 times the value of the average ping, usually 
+        ///         Setting this to its default of 0 will mean the timeout is 2 times the value of the average ping, usually
         ///         resulting in a more dynamic resend that responds to endpoints on slower or faster connections.
         ///     </para>
         /// </remarks>
         public volatile int ResendTimeout = 0;
 
         /// <summary>
-        /// Max number of times to resend. 0 == no limit
+        ///     Max number of times to resend. 0 == no limit
         /// </summary>
         public volatile int ResendLimit = 0;
 
         /// <summary>
-        /// A compounding multiplier to back off resend timeout.
-        /// Applied to ping before first timeout when ResendTimeout == 0.
+        ///     A compounding multiplier to back off resend timeout.
+        ///     Applied to ping before first timeout when ResendTimeout == 0.
         /// </summary>
         public volatile float ResendPingMultiplier = 2;
 
@@ -48,7 +48,7 @@ namespace Impostor.Hazel.Udp
         internal ConcurrentDictionary<ushort, Packet> reliableDataPacketsSent = new ConcurrentDictionary<ushort, Packet>();
 
         /// <summary>
-        ///     Packet ids that have not been received, but are expected. 
+        ///     Packet ids that have not been received, but are expected.
         /// </summary>
         private HashSet<ushort> reliableDataPacketsMissing = new HashSet<ushort>();
 
@@ -63,7 +63,7 @@ namespace Impostor.Hazel.Udp
         ///     Returns the average ping to this endpoint.
         /// </summary>
         /// <remarks>
-        ///     This returns the average ping for a one-way trip as calculated from the reliable packets that have been sent 
+        ///     This returns the average ping for a one-way trip as calculated from the reliable packets that have been sent
         ///     and acknowledged by the endpoint.
         /// </remarks>
         public float AveragePingMs = 500;
@@ -72,7 +72,7 @@ namespace Impostor.Hazel.Udp
         ///     The maximum times a message should be resent before marking the endpoint as disconnected.
         /// </summary>
         /// <remarks>
-        ///     Reliable packets will be resent at an interval defined in <see cref="ResendTimeout"/> for the number of times
+        ///     Reliable packets will be resent at an interval defined in <see cref="ResendTimeout" /> for the number of times
         ///     specified here. Once a packet has been retransmitted this number of times and has not been acknowledged the
         ///     connection will be marked as disconnected and the <see cref="Connection.Disconnected">Disconnected</see> event
         ///     will be invoked.
@@ -136,10 +136,10 @@ namespace Impostor.Hazel.Udp
                 var connection = this.Connection;
                 if (!this.Acknowledged && connection != null)
                 {
-                    long lifetime = this.Stopwatch.ElapsedMilliseconds;
+                    var lifetime = this.Stopwatch.ElapsedMilliseconds;
                     if (lifetime >= connection.DisconnectTimeout)
                     {
-                        if (connection.reliableDataPacketsSent.TryRemove(this.Id, out Packet self))
+                        if (connection.reliableDataPacketsSent.TryRemove(this.Id, out var self))
                         {
                             await connection.DisconnectInternal(HazelInternalErrors.ReliablePacketWithoutResponse, $"Reliable packet {self.Id} (size={this.Length}) was not ack'd after {lifetime}ms ({self.Retransmissions} resends)");
 
@@ -155,7 +155,7 @@ namespace Impostor.Hazel.Udp
                         if (connection.ResendLimit != 0
                             && this.Retransmissions > connection.ResendLimit)
                         {
-                            if (connection.reliableDataPacketsSent.TryRemove(this.Id, out Packet self))
+                            if (connection.reliableDataPacketsSent.TryRemove(this.Id, out var self))
                             {
                                 await connection.DisconnectInternal(HazelInternalErrors.ReliablePacketWithoutResponse, $"Reliable packet {self.Id} (size={this.Length}) was not ack'd after {self.Retransmissions} resends ({lifetime}ms)");
 
@@ -196,12 +196,12 @@ namespace Impostor.Hazel.Udp
 
         internal async ValueTask<int> ManageReliablePackets()
         {
-            int output = 0;
+            var output = 0;
             if (this.reliableDataPacketsSent.Count > 0)
             {
                 foreach (var kvp in this.reliableDataPacketsSent)
                 {
-                    Packet pkt = kvp.Value;
+                    var pkt = kvp.Value;
 
                     try
                     {
@@ -222,12 +222,12 @@ namespace Impostor.Hazel.Udp
         /// <param name="ackCallback">The callback to make once the packet has been acknowledged.</param>
         protected void AttachReliableID(byte[] buffer, int offset, int sendLength, Action ackCallback = null)
         {
-            ushort id = (ushort)Interlocked.Increment(ref lastIDAllocated);
+            var id = (ushort)Interlocked.Increment(ref lastIDAllocated);
 
             buffer[offset] = (byte)(id >> 8);
             buffer[offset + 1] = (byte)id;
 
-            Packet packet = Packet.GetObject();
+            var packet = Packet.GetObject();
             packet.Set(
                 id,
                 this,
@@ -260,7 +260,7 @@ namespace Impostor.Hazel.Udp
             //Inform keepalive not to send for a while
             ResetKeepAliveTimer();
 
-            byte[] bytes = new byte[data.Length + 3];
+            var bytes = new byte[data.Length + 3];
 
             //Add message type
             bytes[0] = sendOption;
@@ -333,35 +333,35 @@ namespace Impostor.Hazel.Udp
              * 
              * So...
              */
-            
+
             var result = true;
 
             lock (reliableDataPacketsMissing)
             {
                 //Calculate overwritePointer
-                ushort overwritePointer = (ushort)(reliableReceiveLast - 32768);
+                var overwritePointer = (ushort)(reliableReceiveLast - 32768);
 
                 //Calculate if it is a new packet by examining if it is within the range
                 bool isNew;
                 if (overwritePointer < reliableReceiveLast)
-                    isNew = id > reliableReceiveLast || id <= overwritePointer;     //Figure (2)
+                    isNew = id > reliableReceiveLast || id <= overwritePointer; //Figure (2)
                 else
-                    isNew = id > reliableReceiveLast && id <= overwritePointer;     //Figure (3)
-                
+                    isNew = id > reliableReceiveLast && id <= overwritePointer; //Figure (3)
+
                 //If it's new or we've not received anything yet
                 if (isNew)
                 {
                     // Mark items between the most recent receive and the id received as missing
                     if (id > reliableReceiveLast)
                     {
-                        for (ushort i = (ushort)(reliableReceiveLast + 1); i < id; i++)
+                        for (var i = (ushort)(reliableReceiveLast + 1); i < id; i++)
                         {
                             reliableDataPacketsMissing.Add(i);
                         }
                     }
                     else
                     {
-                        int cnt = (ushort.MaxValue - reliableReceiveLast) + id;
+                        var cnt = (ushort.MaxValue - reliableReceiveLast) + id;
                         for (ushort i = 1; i < cnt; ++i)
                         {
                             reliableDataPacketsMissing.Add((ushort)(i + reliableReceiveLast));
@@ -371,7 +371,7 @@ namespace Impostor.Hazel.Udp
                     //Update the most recently received
                     reliableReceiveLast = id;
                 }
-                
+
                 //Else it could be a missing packet
                 else
                 {
@@ -382,7 +382,7 @@ namespace Impostor.Hazel.Udp
                     }
                 }
             }
-            
+
             //Send an acknowledgement
             await SendAck(id);
 
@@ -397,13 +397,13 @@ namespace Impostor.Hazel.Udp
         {
             this.pingsSinceAck = 0;
 
-            ushort id = (ushort)((bytes[1] << 8) + bytes[2]);
+            var id = (ushort)((bytes[1] << 8) + bytes[2]);
             AcknowledgeMessageId(id);
 
             if (bytes.Length == 4)
             {
-                byte recentPackets = bytes[3];
-                for (int i = 1; i <= 8; ++i)
+                var recentPackets = bytes[3];
+                for (var i = 1; i <= 8; ++i)
                 {
                     if ((recentPackets & 1) != 0)
                     {
@@ -420,7 +420,7 @@ namespace Impostor.Hazel.Udp
         private void AcknowledgeMessageId(ushort id)
         {
             // Dispose of timer and remove from dictionary
-            if (reliableDataPacketsSent.TryRemove(id, out Packet packet))
+            if (reliableDataPacketsSent.TryRemove(id, out var packet))
             {
                 float rt = packet.Stopwatch.ElapsedMilliseconds;
 
@@ -432,7 +432,7 @@ namespace Impostor.Hazel.Udp
                     this.AveragePingMs = Math.Max(50, this.AveragePingMs * .7f + rt * .3f);
                 }
             }
-            else if (this.activePingPackets.TryRemove(id, out PingPacket pingPkt))
+            else if (this.activePingPackets.TryRemove(id, out var pingPkt))
             {
                 float rt = pingPkt.Stopwatch.ElapsedMilliseconds;
 
@@ -455,7 +455,7 @@ namespace Impostor.Hazel.Udp
             byte recentPackets = 0;
             lock (this.reliableDataPacketsMissing)
             {
-                for (int i = 1; i <= 8; ++i)
+                for (var i = 1; i <= 8; ++i)
                 {
                     if (!this.reliableDataPacketsMissing.Contains((ushort)(id - i)))
                     {
@@ -464,12 +464,12 @@ namespace Impostor.Hazel.Udp
                 }
             }
 
-            byte[] bytes = new byte[]
+            var bytes = new byte[]
             {
                 (byte)UdpSendOption.Acknowledgement,
                 (byte)(id >> 8),
                 (byte)(id >> 0),
-                recentPackets
+                recentPackets,
             };
 
             try
index 5288d3ce225d909a2458062b7af93598996bf78a..4106bfe14e23852c590f8472fd34ee0494f73ae8 100644 (file)
@@ -34,7 +34,7 @@ namespace Impostor.Hazel.Udp
             Pipeline = Channel.CreateUnbounded<byte[]>(new UnboundedChannelOptions
             {
                 SingleReader = true,
-                SingleWriter = true
+                SingleWriter = true,
             });
         }
 
@@ -113,13 +113,13 @@ namespace Impostor.Hazel.Udp
         /// <param name="length"></param>
         protected abstract ValueTask WriteBytesToConnection(byte[] bytes, int length);
 
-        /// <inheritdoc/>
+        /// <inheritdoc />
         public override async ValueTask SendAsync(IMessageWriter msg)
         {
             if (this._state != ConnectionState.Connected)
                 throw new InvalidOperationException("Could not send data as this Connection is not connected. Did you disconnect?");
 
-            byte[] buffer = new byte[msg.Length];
+            var buffer = new byte[msg.Length];
             Buffer.BlockCopy(msg.Buffer, 0, buffer, 0, msg.Length);
 
             switch (msg.SendOption)
@@ -139,13 +139,13 @@ namespace Impostor.Hazel.Udp
             }
         }
 
-        /// <inheritdoc/>
+        /// <inheritdoc />
         /// <remarks>
         ///     <include file="DocInclude/common.xml" path="docs/item[@name='Connection_SendBytes_General']/*" />
         ///     <para>
-        ///         Udp connections can currently send messages using <see cref="SendOption.None"/> and
-        ///         <see cref="SendOption.Reliable"/>. Fragmented messages are not currently supported and will default to
-        ///         <see cref="SendOption.None"/> until implemented.
+        ///         Udp connections can currently send messages using <see cref="SendOption.None" /> and
+        ///         <see cref="SendOption.Reliable" />. Fragmented messages are not currently supported and will default to
+        ///         <see cref="SendOption.None" /> until implemented.
         ///     </para>
         /// </remarks>
         public override async ValueTask SendBytes(byte[] bytes, MessageType sendOption = MessageType.Unreliable)
@@ -153,12 +153,12 @@ namespace Impostor.Hazel.Udp
             //Add header information and send
             await HandleSend(bytes, (byte)sendOption);
         }
-        
+
         /// <summary>
         ///     Handles the reliable/fragmented sending from this connection.
         /// </summary>
         /// <param name="data">The data being sent.</param>
-        /// <param name="sendOption">The <see cref="SendOption"/> specified as its byte value.</param>
+        /// <param name="sendOption">The <see cref="SendOption" /> specified as its byte value.</param>
         /// <param name="ackCallback">The callback to invoke when this packet is acknowledged.</param>
         /// <returns>The bytes that should actually be sent.</returns>
         protected async ValueTask HandleSend(byte[] data, byte sendOption, Action ackCallback = null)
@@ -170,7 +170,7 @@ namespace Impostor.Hazel.Udp
                 case (byte)UdpSendOption.Hello:
                     await ReliableSend(sendOption, data, ackCallback);
                     break;
-                                    
+
                 //Treat all else as unreliable
                 default:
                     await UnreliableSend(sendOption, data);
@@ -226,14 +226,16 @@ namespace Impostor.Hazel.Udp
                     {
                         await DisconnectRemote("The remote sent a disconnect request", reader);
                     }
+
                     break;
-                    
+
                 //Treat everything else as unreliable
                 default:
                     using (var reader = message.Copy(1))
                     {
                         await InvokeDataReceived(reader, MessageType.Unreliable);
                     }
+
                     Statistics.LogUnreliableReceive(message.Length - 1, message.Length);
                     break;
             }
@@ -258,7 +260,7 @@ namespace Impostor.Hazel.Udp
         /// <param name="length"></param>
         async ValueTask UnreliableSend(byte sendOption, byte[] data, int offset, int length)
         {
-            byte[] bytes = new byte[length + 1];
+            var bytes = new byte[length + 1];
 
             //Add message type
             bytes[0] = sendOption;
@@ -293,8 +295,8 @@ namespace Impostor.Hazel.Udp
 
             return HandleSend(actualBytes, (byte)UdpSendOption.Hello, acknowledgeCallback);
         }
-                
-        /// <inheritdoc/>
+
+        /// <inheritdoc />
         protected override void Dispose(bool disposing)
         {
             if (disposing)
index 573a00cbfad59f98eed9c936db7b52e30241ef96..782bf613720b608677aac23164620bfa0fa48582 100644 (file)
@@ -4,7 +4,6 @@ using System.Collections.Concurrent;
 using System.Net;
 using System.Net.Sockets;
 using System.Threading;
-using System.Threading.Channels;
 using System.Threading.Tasks;
 using Microsoft.Extensions.ObjectPool;
 using Serilog;
@@ -20,11 +19,12 @@ namespace Impostor.Hazel.Udp
         private static readonly ILogger Logger = Log.ForContext<UdpConnectionListener>();
 
         /// <summary>
-        /// A callback for early connection rejection. 
-        /// * Return false to reject connection.
-        /// * A null response is ok, we just won't send anything.
+        ///     A callback for early connection rejection.
+        ///     * Return false to reject connection.
+        ///     * A null response is ok, we just won't send anything.
         /// </summary>
         public AcceptConnectionCheck AcceptConnection;
+
         public delegate bool AcceptConnectionCheck(IPEndPoint endPoint, byte[] input, out byte[] response);
 
         private readonly UdpClient _socket;
@@ -37,7 +37,7 @@ namespace Impostor.Hazel.Udp
         private Task _executingTask;
 
         /// <summary>
-        ///     Creates a new UdpConnectionListener for the given <see cref="IPAddress"/>, port and <see cref="IPMode"/>.
+        ///     Creates a new UdpConnectionListener for the given <see cref="IPAddress" />, port and <see cref="IPMode" />.
         /// </summary>
         /// <param name="endPoint">The endpoint to listen on.</param>
         /// <param name="ipMode"></param>
@@ -72,7 +72,7 @@ namespace Impostor.Hazel.Udp
         }
 
         public int ConnectionCount => this._allConnections.Count;
-        
+
         private async void ManageReliablePackets(object state)
         {
             foreach (var kvp in _allConnections)
index 64881d3daf2b46934c6621f76665906137aa8c39..b90d7b15ff69cbd965182feef859c8bd6ac84779 100644 (file)
@@ -72,4 +72,4 @@ namespace Impostor.Hazel.Udp
             _timer.Dispose();
         }
     }
-}
\ No newline at end of file
+}
index 8d3426e38a2917f165a9ebac8ccd2590cc6472b7..8c6cc067a2b0f3a9f808d1f72b3b2d7ad36f44b4 100644 (file)
@@ -9,14 +9,14 @@ namespace Impostor.Hazel.Udp
     /// <summary>
     ///     Represents a servers's connection to a client that uses the UDP protocol.
     /// </summary>
-    /// <inheritdoc/>
+    /// <inheritdoc />
     internal sealed class UdpServerConnection : UdpConnection
     {
         /// <summary>
         ///     The connection listener that we use the socket of.
         /// </summary>
         /// <remarks>
-        ///     Udp server connections utilize the same socket in the listener for sends/receives, this is the listener that 
+        ///     Udp server connections utilize the same socket in the listener for sends/receives, this is the listener that
         ///     created this connection and is hence the listener this conenction sends and receives via.
         /// </remarks>
         public UdpConnectionListener Listener { get; private set; }
@@ -63,7 +63,7 @@ namespace Impostor.Hazel.Udp
                 if (this._state != ConnectionState.Connected) return false;
                 this._state = ConnectionState.NotConnected;
             }
-            
+
             var bytes = EmptyDisconnectBytes;
             if (data != null && data.Length > 0)
             {
index 76653a1b5fa99fdfba94d691b7fdde9d9e9c82d1..26c00d9cc1847b00eb1bdd93236c140108420360 100644 (file)
@@ -23,7 +23,7 @@ namespace Impostor.Patcher.Cli
                     "--name",
                     () => AmongUsModifier.DefaultRegionName,
                     "Name for server region"
-                )
+                ),
             };
 
             rootCommand.Handler = CommandHandler.Create<string, string>((address, name) =>
index 7c1ced2630fabcb2ec846e00fd78a767ddbe1b59..d3b6de7e59b3b362ad92128e441600ceae48a6f6 100644 (file)
@@ -63,7 +63,7 @@ namespace Impostor.Patcher.Shared
 
             var libraries = new List<string>
             {
-                steamApps
+                steamApps,
             };
 
             var vdf = Path.Combine(steamApps, "libraryfolders.vdf");
@@ -174,7 +174,7 @@ namespace Impostor.Patcher.Shared
                 var ip = ipAddress.ToString();
                 var region = new RegionInfo(RegionName, ip, new[]
                 {
-                    new ServerInfo($"{RegionName}-Master-1", ip, port)
+                    new ServerInfo($"{RegionName}-Master-1", ip, port),
                 });
 
                 region.Serialize(writer);
@@ -246,4 +246,4 @@ namespace Impostor.Patcher.Shared
         public event EventHandler<ErrorEventArgs> Error;
         public event EventHandler<SavedEventArgs> Saved;
     }
-}
\ No newline at end of file
+}
index b256156cd2e63ef52206ed9ccee1767d63960a6b..56bf297437475c1efc647aa89aaf045d10312302 100644 (file)
@@ -62,4 +62,4 @@ namespace Impostor.Patcher.Shared
             }
         }
     }
-}
\ No newline at end of file
+}
index 7211d5d35b17bc28a832bedfbf1cfe5d3cbf93be..b7925d3d1a81deb2551de95d5fe0abf2440d1b06 100644 (file)
@@ -11,4 +11,4 @@ namespace Impostor.Patcher.Shared.Events
 
         public string Message { get; }
     }
-}
\ No newline at end of file
+}
index c91d071971ba9b85dc3079344c92d953a6ef1338..a0f08ae47a740285b682e439d1a2fa6c16429bc4 100644 (file)
@@ -13,4 +13,4 @@ namespace Impostor.Patcher.Shared.Events
         public string IpAddress { get; }
         public ushort Port { get; }
     }
-}
\ No newline at end of file
+}
index 01b74d1d8a68705ea7f439d1392698f33191daea..77fbb6be0569321c1ececfcf94afd137104d24dc 100644 (file)
@@ -45,4 +45,4 @@ namespace Impostor.Patcher.Shared.Innersloth
             return new RegionInfo(name, ping, servers);
         }
     }
-}
\ No newline at end of file
+}
index 7203c8489e6f99f8ea685009b20f5459550b5ea4..4768377a3f2f167406f3bca79dddecd70f9c1614 100644 (file)
@@ -15,7 +15,7 @@ namespace Impostor.Patcher.Shared.Innersloth
             Ip = ip;
             Port = port;
         }
-        
+
         public void Serialize(BinaryWriter writer)
         {
             writer.Write(Name);
@@ -30,8 +30,8 @@ namespace Impostor.Patcher.Shared.Innersloth
             var ip = new IPAddress(reader.ReadBytes(4)).ToString();
             var port = reader.ReadUInt16();
             var unknown = reader.ReadInt32();
-            
+
             return new ServerInfo(name, ip, port);
         }
     }
-}
\ No newline at end of file
+}
index 0f6320b4f865fcca469a29192bdfff3e9dfb0003..4667c454f8b56846ccfca5f4988a7d933e1e36f1 100644 (file)
@@ -81,7 +81,7 @@
             this.lblUrl.Name = "lblUrl";
             this.lblUrl.Size = new System.Drawing.Size(212, 13);
             this.lblUrl.TabIndex = 5;
-            this.lblUrl.Text = "https://github.com/AeonLucid/Impostor";
+            this.lblUrl.Text = "https://github.com/Impostor/Impostor";
             this.lblUrl.Click += new System.EventHandler(this.lblUrl_Click);
             // 
             // label3
         private System.Windows.Forms.Label label3;
         private System.Windows.Forms.ComboBox comboIp;
     }
-}
\ No newline at end of file
+}
index 5c06669e0c3a44c323be46c281370d07e6158e23..dd3696f5a8f3b811965b4563dbb0626a8c105ae0 100644 (file)
@@ -95,7 +95,7 @@ namespace Impostor.Patcher.WinForms.Forms
 
         private void lblUrl_Click(object sender, EventArgs e)
         {
-            Process.Start("https://github.com/AeonLucid/Impostor");
+            Process.Start("https://github.com/Impostor/Impostor");
         }
 
         private void RefreshComboIps()
@@ -111,4 +111,4 @@ namespace Impostor.Patcher.WinForms.Forms
             }
         }
     }
-}
\ No newline at end of file
+}
index 7ca903533f6e37bcd969e32ff21fa2684ab52387..f481490649a0b5bae7f60086fa6ae2bc5aefc5c3 100644 (file)
@@ -14,4 +14,4 @@ namespace Impostor.Patcher.WinForms
             Application.Run(new FrmMain());
         }
     }
-}
\ No newline at end of file
+}
index 8f57e89e0c26a7e587660e741c922b6e4a6f70de..a978619bb904e4d460458872592eb4be0acc0e46 100644 (file)
@@ -10,4 +10,4 @@ namespace Impostor.Plugins.Debugger
     public class DebugPlugin : PluginBase
     {
     }
-}
\ No newline at end of file
+}
index cc36ce661e40a052f6bbe5929c03e77176c2bb8a..c39ce314a2aa40a0f9acc6a3cc81d1a3be1035b4 100644 (file)
@@ -32,4 +32,4 @@ namespace Impostor.Plugins.Debugger
             });
         }
     }
-}
\ No newline at end of file
+}
index 139e42c04ca7c859fed6be3a58032ac2123686b1..73fea6ad66eced0da6c0b53be9ae2578fef7abc7 100644 (file)
@@ -29,7 +29,7 @@ namespace Impostor.Plugins.Example
             var game = await _gameManager.CreateAsync(new GameOptionsData());
             game.DisplayName = "Example game";
             await game.SetPrivacyAsync(true);
-            
+
             _logger.LogInformation("Created game {0}.", game.Code.Code);
         }
 
index 0190d3b14b00c9a56fd0a8910397fbecf2e2b2a0..c62433c6425f760c7f82dae068125b65ac33fc9d 100644 (file)
@@ -94,7 +94,7 @@ namespace Impostor.Plugins.Example.Handlers
         [EventListener]
         public void OnPlayerStartMeetingEvent(IPlayerStartMeetingEvent e)
         {
-            _logger.LogDebug($"Player {e.PlayerControl.PlayerInfo.PlayerName} start meeting, reason: " + (e.Body==null ? "Emergency call button" : "Found the body of the player "+e.Body.PlayerInfo.PlayerName));
+            _logger.LogDebug($"Player {e.PlayerControl.PlayerInfo.PlayerName} start meeting, reason: " + (e.Body == null ? "Emergency call button" : "Found the body of the player " + e.Body.PlayerInfo.PlayerName));
         }
     }
 }
index a86735f8f1ae93b69a6a44e20357664fb7c26572..6bf8e72862508891372bb0d42a9b4453ebdee6c9 100644 (file)
@@ -16,4 +16,4 @@
 
         public const string UsernameIllegalCharacters = "Your username contains illegal characters, please remove them.";
     }
-}
\ No newline at end of file
+}
index 62d90b29004fd4e3200dc6b668c222821c30ba9c..ce0114aac812637c6c69f0fec0700adb13181da5 100644 (file)
@@ -5,4 +5,4 @@
         public const int SpawnTimeout = 2500;
         public const int ConnectionTimeout = 2500;
     }
-}
\ No newline at end of file
+}
index b68f06401b33245677534002b7b2a18d11131ee3..b1e2348b01221c5bafc02d3e0262ffc0aebc12d8 100644 (file)
@@ -4,7 +4,7 @@ using System.Collections.Generic;
 namespace Impostor.Server.Events
 {
     /// <summary>
-    ///     Disposes multiple <see cref="IDisposable"/>.
+    ///     Disposes multiple <see cref="IDisposable" />.
     /// </summary>
     internal class MultiDisposable : IDisposable
     {
index 6517aac8efdd0f6d382cd469a54f3374097054c5..76d2a2af0fc180335bfa34f6680779f8ead07cd9 100644 (file)
@@ -159,7 +159,7 @@ namespace Impostor.Server.Events.Register
                 throw new InvalidOperationException($"The method {method.GetFriendlyName()} must return void or ValueTask.");
             }
 
-            return Expression.Lambda<Func<object?, object, IServiceProvider, ValueTask>>(invoke,  instance, eventParameter, provider)
+            return Expression.Lambda<Func<object?, object, IServiceProvider, ValueTask>>(invoke, instance, eventParameter, provider)
                 .Compile();
         }
     }
index 1446ad1eb1647b0b561d41f3efb7dd20cfe7c107..f2bfee254fe8adf6d8eea13c49cbf51ed62e6546 100644 (file)
@@ -56,4 +56,4 @@ namespace Impostor.Server.Events.Register
             }
         }
     }
-}
\ No newline at end of file
+}
index 370bca6208f0b9c1eb1102f22d3b9b4247bd1d12..96ceb4d4e5636a1bb7947aa7f8357085696d83b8 100644 (file)
@@ -10,4 +10,4 @@ namespace Impostor.Server
             return await nodeLocator.FindAsync(gameCode) != null;
         }
     }
-}
\ No newline at end of file
+}
index 55d42fbda8f42f82c6e46bf72852675a808e0b03..396d987f17c9cc3c6e3c452f0d122c4794fcc347 100644 (file)
@@ -64,4 +64,4 @@ namespace Impostor.Server
             return str;
         }
     }
-}
\ No newline at end of file
+}
index bec1b79ba77d1af27f00f5884ec17822da4d84bc..a72a23bab026eb93c63763358bc64536265f06d8 100644 (file)
@@ -8,4 +8,4 @@ namespace Impostor.Server.Net.Factories
     {
         ClientBase Create(IHazelConnection connection, string name, int clientVersion, ISet<Mod> mods);
     }
-}
\ No newline at end of file
+}
index 2a0553fc897ce5a74424ccf296415e8bcc683896..f8b0de478c017f4fe2cfdfb62dc0e6890b62582e 100644 (file)
@@ -9,4 +9,4 @@ namespace Impostor.Server.Net
             return GameCode.Create();
         }
     }
-}
\ No newline at end of file
+}
index 9b53d708f6851e0f7e25fbc2ec505c1f4440f404..7fd4f0125fb23719b097257a389aa77b2cf88ee0 100644 (file)
@@ -26,4 +26,4 @@ namespace Impostor.Server.Net.Inner
             return result;
         }
     }
-}
\ No newline at end of file
+}
index 5b65f464cc4befbf6f340616e11f0db1c30dd0b9..8cbea9a26ed0a04cd853884be70f0a1f08ec571e 100644 (file)
@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using System.Threading.Tasks;
+using System.Threading.Tasks;
 using Impostor.Api.Net;
 using Impostor.Api.Net.Inner;
 using Impostor.Api.Net.Messages;
index 0e475b8c20c938cfd42aae9706d0bac245aaec60..ff5c21d599b59d669026f99ab5a279af9ffe5f47 100644 (file)
@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using System.Numerics;
+using System.Numerics;
 using System.Threading.Tasks;
 using Impostor.Api;
 using Impostor.Api.Events.Managers;
index 69f8dcd81a7071b00c8750c111e5ad5bc8acf7ba..4eb5f8a1ab9b27987f9c5f1ea5e86b5220372c22 100644 (file)
@@ -1,5 +1,4 @@
 using System;
-using System.Collections.Generic;
 using System.Threading.Tasks;
 using Impostor.Api.Events.Managers;
 using Impostor.Api.Innersloth;
index 78be5bd23f8e79c0e05a711f1d895b08d90a86d3..3dfd74158861477b45410781073a02a2e5cdcf2d 100644 (file)
@@ -1,4 +1,5 @@
-using System.Threading.Tasks;
+using System;
+using System.Threading.Tasks;
 using Impostor.Api.Games;
 using Impostor.Api.Net;
 using Impostor.Api.Net.Inner.Objects;
@@ -20,17 +21,17 @@ namespace Impostor.Server.Net.Inner.Objects
 
         public override ValueTask<bool> SerializeAsync(IMessageWriter writer, bool initialState)
         {
-            throw new System.NotImplementedException();
+            throw new NotImplementedException();
         }
 
         public override ValueTask DeserializeAsync(IClientPlayer sender, IClientPlayer? target, IMessageReader reader, bool initialState)
         {
-            throw new System.NotImplementedException();
+            throw new NotImplementedException();
         }
 
         public override ValueTask<bool> HandleRpcAsync(ClientPlayer sender, ClientPlayer? target, RpcCalls call, IMessageReader reader)
         {
-            throw new System.NotImplementedException();
+            throw new NotImplementedException();
         }
     }
 }
index 8f9c8f5e894087d038abc442eeb42228eade95e6..a2d6f0e79fab132c9833394a5799804317112765 100644 (file)
@@ -1,5 +1,4 @@
 using System;
-using System.Collections.Generic;
 using System.Diagnostics.CodeAnalysis;
 using System.Linq;
 using System.Threading.Tasks;
index e595b25a95d1cf43798407d295bf094c5e0c283b..66a164c78debc53213cad9cb4739294c82e6a0da 100644 (file)
@@ -4,4 +4,4 @@
     {
         bool IsActive { get; }
     }
-}
\ No newline at end of file
+}
index a6ef88e5873a1cdba2a45236734bede08259e7cc..441d7c35b7884750ce8cbe227b7c78dfaccb288d 100644 (file)
@@ -8,4 +8,4 @@ namespace Impostor.Server.Net.Inner.Objects.Systems
 
         void Deserialize(IMessageReader reader, bool initialState);
     }
-}
\ No newline at end of file
+}
index 42aa8d3793504a943ea1102a9d33be8d06e22ca7..4349233f01e71e1a366db97f2aabb746e121179e 100644 (file)
@@ -1,4 +1,5 @@
-using Impostor.Api.Net.Messages;
+using System;
+using Impostor.Api.Net.Messages;
 
 namespace Impostor.Server.Net.Inner.Objects.Systems.ShipStatus
 {
@@ -8,7 +9,7 @@ namespace Impostor.Server.Net.Inner.Objects.Systems.ShipStatus
 
         public void Serialize(IMessageWriter writer, bool initialState)
         {
-            throw new System.NotImplementedException();
+            throw new NotImplementedException();
         }
 
         public void Deserialize(IMessageReader reader, bool initialState)
@@ -16,4 +17,4 @@ namespace Impostor.Server.Net.Inner.Objects.Systems.ShipStatus
             IsActive = reader.ReadBoolean();
         }
     }
-}
\ No newline at end of file
+}
index f64402434e2544fcf64b353140d7047c7449a1c6..681ebe163f6ebeefb896df145b5ea708ab21c996 100644 (file)
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
 using Impostor.Api.Net.Messages;
 
 namespace Impostor.Server.Net.Inner.Objects.Systems.ShipStatus
@@ -19,7 +20,7 @@ namespace Impostor.Server.Net.Inner.Objects.Systems.ShipStatus
 
         public void Serialize(IMessageWriter writer, bool initialState)
         {
-            throw new System.NotImplementedException();
+            throw new NotImplementedException();
         }
 
         public void Deserialize(IMessageReader reader, bool initialState)
@@ -41,4 +42,4 @@ namespace Impostor.Server.Net.Inner.Objects.Systems.ShipStatus
             }
         }
     }
-}
\ No newline at end of file
+}
index 007b9d0af0ccac1efb2ab826f138f30ff3fd70af..4c2287fee441416d98f9bff5cb28963c5a5b2cd3 100644 (file)
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
 using Impostor.Api.Net.Messages;
 
 namespace Impostor.Server.Net.Inner.Objects.Systems.ShipStatus
@@ -14,7 +15,7 @@ namespace Impostor.Server.Net.Inner.Objects.Systems.ShipStatus
 
         public void Serialize(IMessageWriter writer, bool initialState)
         {
-            throw new System.NotImplementedException();
+            throw new NotImplementedException();
         }
 
         public void Deserialize(IMessageReader reader, bool initialState)
@@ -29,4 +30,4 @@ namespace Impostor.Server.Net.Inner.Objects.Systems.ShipStatus
             }
         }
     }
-}
\ No newline at end of file
+}
index 438091846b0ba19a3b49e60a09862e9be836046c..7bc2ab373d6c6bcc99419f864ae9ba3db7c26651 100644 (file)
@@ -20,7 +20,7 @@ namespace Impostor.Server.Net.Inner.Objects.Systems.ShipStatus
 
         public void Serialize(IMessageWriter writer, bool initialState)
         {
-            throw new System.NotImplementedException();
+            throw new NotImplementedException();
         }
 
         public void Deserialize(IMessageReader reader, bool initialState)
@@ -36,4 +36,4 @@ namespace Impostor.Server.Net.Inner.Objects.Systems.ShipStatus
             }
         }
     }
-}
\ No newline at end of file
+}
index 193cfe80baea20f87de283d75d42adb506c3937e..73c10c38fcad0b7c0e45a5f400419ea37795b421 100644 (file)
@@ -1,4 +1,5 @@
-using Impostor.Api.Net.Messages;
+using System;
+using Impostor.Api.Net.Messages;
 
 namespace Impostor.Server.Net.Inner.Objects.Systems.ShipStatus
 {
@@ -15,7 +16,7 @@ namespace Impostor.Server.Net.Inner.Objects.Systems.ShipStatus
 
         public void Serialize(IMessageWriter writer, bool initialState)
         {
-            throw new System.NotImplementedException();
+            throw new NotImplementedException();
         }
 
         public void Deserialize(IMessageReader reader, bool initialState)
@@ -23,4 +24,4 @@ namespace Impostor.Server.Net.Inner.Objects.Systems.ShipStatus
             Timer = reader.ReadSingle();
         }
     }
-}
\ No newline at end of file
+}
index df41b68ec087055d9247be329021813a912a53c2..d7964556060b6e174d7066be74e4f0461f968694 100644 (file)
@@ -1,4 +1,5 @@
-using Impostor.Api.Net.Messages;
+using System;
+using Impostor.Api.Net.Messages;
 
 namespace Impostor.Server.Net.Inner.Objects.Systems.ShipStatus
 {
@@ -8,7 +9,7 @@ namespace Impostor.Server.Net.Inner.Objects.Systems.ShipStatus
 
         public void Serialize(IMessageWriter writer, bool initialState)
         {
-            throw new System.NotImplementedException();
+            throw new NotImplementedException();
         }
 
         public void Deserialize(IMessageReader reader, bool initialState)
@@ -16,4 +17,4 @@ namespace Impostor.Server.Net.Inner.Objects.Systems.ShipStatus
             InUse = reader.ReadByte();
         }
     }
-}
\ No newline at end of file
+}
index 925774ab959c81d377cb1543911151c93dcfa6cc..eb2b57260e97f9cfe5afd6b8288b04e6265b0e1e 100644 (file)
@@ -1,4 +1,5 @@
-using Impostor.Api.Net.Messages;
+using System;
+using Impostor.Api.Net.Messages;
 
 namespace Impostor.Server.Net.Inner.Objects.Systems.ShipStatus
 {
@@ -14,7 +15,7 @@ namespace Impostor.Server.Net.Inner.Objects.Systems.ShipStatus
 
         public void Serialize(IMessageWriter writer, bool initialState)
         {
-            throw new System.NotImplementedException();
+            throw new NotImplementedException();
         }
 
         public void Deserialize(IMessageReader reader, bool initialState)
@@ -24,4 +25,4 @@ namespace Impostor.Server.Net.Inner.Objects.Systems.ShipStatus
             Value = reader.ReadByte();
         }
     }
-}
\ No newline at end of file
+}
index 1860098ce97c57f8475e4d55552a4d73d89ad777..28c2a1ab9f795991420c1505cd2b75aac2339d6d 100644 (file)
@@ -8,4 +8,4 @@ namespace Impostor.Server.Net.Inner
         None = 0,
         IsClientCharacter = 1,
     }
-}
\ No newline at end of file
+}
index 6cbe5bf61f0caed3843c7a7f6f0a04acac002995..1ff970dad8b48a6a009451c9f11a96046f0e869c 100644 (file)
@@ -8,4 +8,4 @@ namespace Impostor.Server.Net.Manager
     {
         IEnumerable<IClient> IClientManager.Clients => _clients.Values;
     }
-}
\ No newline at end of file
+}
index eef5d53d90c0a3102ed222cfe4a6bfa6e41e31eb..b10e791649fc0cbe863eb933edd00a79d046f685 100644 (file)
@@ -115,7 +115,7 @@ namespace Impostor.Server.Net.Manager
             // TODO: Prevent duplicates when using server redirector using INodeProvider.
             var (success, game) = await TryCreateAsync(options);
 
-            for (int i = 0; i < 10 && !success; i++)
+            for (var i = 0; i < 10 && !success; i++)
             {
                 (success, game) = await TryCreateAsync(options);
             }
index afae57e8ba5e94042dd957882c8aebfcced9a275..0cfa76d0fb3e7e3b2e8cbcb768f927d0336bd9b3 100644 (file)
@@ -10,7 +10,6 @@ using Impostor.Server.Config;
 using Impostor.Server.Net.Hazel;
 using Impostor.Server.Net.Manager;
 using Serilog;
-using ILogger = Serilog.ILogger;
 
 namespace Impostor.Server.Net.Redirector
 {
index 318fcb2d66da824b4f2786e360b999ba3e4903a4..fb7240c895ff9f5f87495687ba31ca73b8bff933 100644 (file)
@@ -6,4 +6,4 @@ namespace Impostor.Server.Net.Redirector
     {
         IPEndPoint Get();
     }
-}
\ No newline at end of file
+}
index 4e19c43cf4fba088d67375a1cd8debcb5c6e80c2..7e2982e80065ba2b7bf1bfb9ec3df19f5ffcb649 100644 (file)
@@ -40,4 +40,4 @@ namespace Impostor.Server.Net.Redirector
             }
         }
     }
-}
\ No newline at end of file
+}
index b928a3c21ff0938340c102f5759018291e96672b..9e5fd014884cf583c7c2996a4f0b26362b17e3c6 100644 (file)
@@ -1,14 +1,10 @@
 using System;
 using System.Collections.Generic;
-using System.Threading;
 using System.Threading.Tasks;
 using Impostor.Api;
-using Impostor.Api.Innersloth;
 using Impostor.Api.Net.Inner;
 using Impostor.Api.Net.Messages;
-using Impostor.Api.Net.Messages.S2C;
 using Impostor.Api.Unity;
-using Impostor.Hazel;
 using Impostor.Server.Events.Meeting;
 using Impostor.Server.Events.Player;
 using Impostor.Server.Net.Inner;
index 21b606701a416d3d99116aa08ac4d3e781f176d0..5c84f9472f408aeb66c9153c51cdc3c727e505ac 100644 (file)
@@ -55,7 +55,7 @@ namespace Impostor.Server.Net.State
 
             writer.StartMessage(GameDataTag.RpcFlag);
             writer.WritePacked(targetNetId);
-            writer.Write((byte) callId);
+            writer.Write((byte)callId);
 
             return writer;
         }
index fb36e92a56fa0f7e0117c67cffa95d3459c351a3..f724cf29e09dd62ce3ba97c2c5a2112484017a7f 100644 (file)
@@ -11,4 +11,4 @@ namespace Impostor.Server.Plugins
 
         Assembly Load(AssemblyLoadContext context);
     }
-}
\ No newline at end of file
+}
index 720367cc94a408b3b43ac806336fa0be7754e543..5f7d0bbc18e80b5404436a040e4327fc755d0a1e 100644 (file)
@@ -22,4 +22,4 @@ namespace Impostor.Server.Plugins
             return _assembly;
         }
     }
-}
\ No newline at end of file
+}
index 22dc9e90d5d032a2b564817ff97e3eb1924da900..66afceb3336e12209cb6d338b081feb8fb6e5835 100644 (file)
@@ -8,4 +8,4 @@ namespace Impostor.Server.Plugins
 
         public List<string> LibraryPaths { get; set; } = new List<string>();
     }
-}
\ No newline at end of file
+}
index 84238f786a5a90cbcbd61c84e0e0bd9d98d12437..40e13b5b8bc91a790c2c44738ed212596b03500f 100644 (file)
@@ -1,6 +1,5 @@
 using System;
 using System.Collections.Generic;
-using System.Linq;
 using System.Threading;
 using System.Threading.Tasks;
 using Impostor.Api.Plugins;
index 84c51585ac7a296d6836fa0b012bfd8f93b451d4..eed7af6133b2b6c00959fa9adf1beb5af732a1ff 100644 (file)
@@ -1,5 +1,5 @@
 using System.Runtime.CompilerServices;
 
-[assembly:InternalsVisibleTo("Impostor.Benchmarks")]
-[assembly:InternalsVisibleTo("Impostor.Tests")]
-[assembly:InternalsVisibleTo("Impostor.Tools.ServerReplay")]
+[assembly: InternalsVisibleTo("Impostor.Benchmarks")]
+[assembly: InternalsVisibleTo("Impostor.Tests")]
+[assembly: InternalsVisibleTo("Impostor.Tools.ServerReplay")]
index c6531b45659837233dc87dee947162f11351641f..905e026284c455b43bd531993e24da0b189cbc0a 100644 (file)
@@ -17,7 +17,7 @@ using Microsoft.Extensions.Options;
 namespace Impostor.Server.Recorder
 {
     /// <summary>
-    ///     Records all packets received in <see cref="ClientRecorder.HandleMessageAsync"/>.
+    ///     Records all packets received in <see cref="ClientRecorder.HandleMessageAsync" />.
     /// </summary>
     internal class PacketRecorder : BackgroundService
     {
index 17b355f542ee34d9432bd6fd1b4a42cb60325628..e45948e84ec39d5ce10555a30a8fe0fa71d424df 100644 (file)
@@ -15,4 +15,4 @@ namespace Impostor.Server.Recorder
             return true;
         }
     }
-}
\ No newline at end of file
+}
index 648205b5411ad23e8d2880b8e84c1bcd621a4e0e..2eb3b49d0e603fa9bc06881920c325f0b5f399ab 100644 (file)
@@ -1,17 +1,17 @@
 namespace Impostor.Server.Recorder
 {
     /// <summary>
-    /// Version of the server replay data format.
+    ///     Version of the server replay data format.
     /// </summary>
     public enum ServerReplayVersion
     {
         /// <summary>
-        /// Initial version
+        ///     Initial version
         /// </summary>
         Initial = 1,
 
         /// <summary>
-        /// Latest version
+        ///     Latest version
         /// </summary>
         Latest = Initial,
     }
index d222d79b952dbb78d82f3484168d1bbff0ff9bc1..a510803a51ec913c877dfafdf2574eb20d405650 100644 (file)
@@ -1,5 +1,4 @@
 using System.Collections.Generic;
-using System.Net.Sockets;
 using System.Threading.Tasks;
 using Impostor.Api.Events;
 using Impostor.Api.Events.Managers;
@@ -11,10 +10,10 @@ namespace Impostor.Tests.Events
 {
     public class EventManagerTests
     {
-        public static readonly IEnumerable<object[]> TestModes = new []
+        public static readonly IEnumerable<object[]> TestModes = new[]
         {
             new object[] { TestMode.Service },
-            new object[] { TestMode.Temporary }
+            new object[] { TestMode.Temporary },
         };
 
         [Theory]
@@ -38,14 +37,14 @@ namespace Impostor.Tests.Events
 
             await eventManager.CallAsync(new SetValueEvent(1));
 
-            Assert.Equal(new []
+            Assert.Equal(new[]
             {
                 EventPriority.Monitor,
                 EventPriority.Highest,
                 EventPriority.High,
                 EventPriority.Normal,
                 EventPriority.Low,
-                EventPriority.Lowest
+                EventPriority.Lowest,
             }, listener.Priorities);
         }
 
@@ -78,10 +77,10 @@ namespace Impostor.Tests.Events
 
             await eventManager.CallAsync(new SetValueEvent(1));
 
-            Assert.Equal(new []
+            Assert.Equal(new[]
             {
                 EventPriority.Monitor,
-                EventPriority.Highest
+                EventPriority.Highest,
             }, listener.Priorities);
         }
 
@@ -115,7 +114,7 @@ namespace Impostor.Tests.Events
         public enum TestMode
         {
             Service,
-            Temporary
+            Temporary,
         }
 
         public interface ISetValueEvent : IEventCancelable
index de981235159475eaea8e62b79daada87cb9c53bb..6f0c23b4f90314f0b1804cfa6cf43554d1a79be5 100644 (file)
@@ -1,5 +1,4 @@
 using Impostor.Api.Innersloth;
-
 using Xunit;
 
 namespace Impostor.Tests
@@ -26,4 +25,4 @@ namespace Impostor.Tests
             Assert.Equal(codeInt, GameCodeParser.GameNameToInt(code));
         }
     }
-}
\ No newline at end of file
+}
index e7fa0dff84fd0ed7e02196e5184fcf5777cdb448..c0ecbdd7b78cb095f27b0d0129cc77d1a28fe9ec 100644 (file)
@@ -72,7 +72,7 @@ namespace Impostor.Tests.Hazel
         public void ReadProperString()
         {
             const string Test1 = "Hello";
-            string Test2 = new string(' ', 1024);
+            var Test2 = new string(' ', 1024);
             var msg = new MessageWriter(2048);
             msg.StartMessage(1);
             msg.Write(Test1);
@@ -128,18 +128,18 @@ namespace Impostor.Tests.Hazel
             var msg = new MessageWriter(2048);
 
             msg.StartMessage(1);
-                msg.StartMessage(2);
-                    msg.Write(Test1);
-                    msg.Write(Test2);
-                    msg.StartMessage(2);
-                        msg.Write(Test1);
-                        msg.Write(Test2);
-                        msg.StartMessage(2);
-                            msg.Write(Test1);
-                            msg.Write(Test2);
-                        msg.EndMessage();
-                    msg.EndMessage();
-                msg.EndMessage();
+            msg.StartMessage(2);
+            msg.Write(Test1);
+            msg.Write(Test2);
+            msg.StartMessage(2);
+            msg.Write(Test1);
+            msg.Write(Test2);
+            msg.StartMessage(2);
+            msg.Write(Test1);
+            msg.Write(Test2);
+            msg.EndMessage();
+            msg.EndMessage();
+            msg.EndMessage();
             msg.EndMessage();
 
             // Read message.
@@ -217,7 +217,7 @@ namespace Impostor.Tests.Hazel
                 0x20, 0x6C, 0x6F, 0x6E, 0x67, 0x20, 0x70, 0x61,
                 0x63, 0x6B, 0x65, 0x74, 0x20, 0x74, 0x6F, 0x20,
                 0x74, 0x65, 0x73, 0x74, 0x20, 0x63, 0x6F, 0x70,
-                0x79, 0x69, 0x6E, 0x67, 0x2E
+                0x79, 0x69, 0x6E, 0x67, 0x2E,
             };
 
             var readerPool = CreateReaderPool();
@@ -301,15 +301,15 @@ namespace Impostor.Tests.Hazel
             var messageWriter = new MessageWriter(1024);
 
             messageWriter.StartMessage(0);
-                messageWriter.StartMessage(1);
-                    messageWriter.Write("HiTest1");
-                    messageWriter.StartMessage(2);
-                        messageWriter.Write("RemoveMe!");
-                    messageWriter.EndMessage();
-                messageWriter.EndMessage();
-                messageWriter.StartMessage(2);
-                    messageWriter.Write("HiTest2");
-                messageWriter.EndMessage();
+            messageWriter.StartMessage(1);
+            messageWriter.Write("HiTest1");
+            messageWriter.StartMessage(2);
+            messageWriter.Write("RemoveMe!");
+            messageWriter.EndMessage();
+            messageWriter.EndMessage();
+            messageWriter.StartMessage(2);
+            messageWriter.Write("HiTest2");
+            messageWriter.EndMessage();
             messageWriter.EndMessage();
 
             // Copy buffer.
index 83d67da9deca1b8bd609ceb0983539a1e0bade4a..f158191126a87f4a397a31f8df2879b0361fb065 100644 (file)
@@ -35,4 +35,4 @@ namespace Impostor.Tests.Hazel
             }
         }
     }
-}
\ No newline at end of file
+}
index 79517b4d23b0235cd29385e4fd4549a619d51b74..f04e226b0d8db6d87b6bd4dc62997aaf555f3142 100644 (file)
@@ -8,28 +8,28 @@ namespace Impostor.Tools.Proxy
         public static string HexDump(byte[] bytes, int bytesPerLine = 16)
         {
             if (bytes == null) return "<null>";
-            int bytesLength = bytes.Length;
+            var bytesLength = bytes.Length;
 
-            char[] HexChars = "0123456789ABCDEF".ToCharArray();
+            var HexChars = "0123456789ABCDEF".ToCharArray();
 
-            int firstHexColumn =
-                  8                   // 8 characters for the address
-                + 3;                  // 3 spaces
+            var firstHexColumn =
+                8 // 8 characters for the address
+                + 3; // 3 spaces
 
-            int firstCharColumn = firstHexColumn
-                + bytesPerLine * 3       // - 2 digit for the hexadecimal value and 1 space
-                + (bytesPerLine - 1) / 8 // - 1 extra space every 8 characters from the 9th
-                + 2;                  // 2 spaces 
+            var firstCharColumn = firstHexColumn
+                                  + bytesPerLine * 3 // - 2 digit for the hexadecimal value and 1 space
+                                  + (bytesPerLine - 1) / 8 // - 1 extra space every 8 characters from the 9th
+                                  + 2; // 2 spaces 
 
-            int lineLength = firstCharColumn
-                + bytesPerLine           // - characters to show the ascii value
-                + Environment.NewLine.Length; // Carriage return and line feed (should normally be 2)
+            var lineLength = firstCharColumn
+                             + bytesPerLine // - characters to show the ascii value
+                             + Environment.NewLine.Length; // Carriage return and line feed (should normally be 2)
 
-            char[] line = (new String(' ', lineLength - Environment.NewLine.Length) + Environment.NewLine).ToCharArray();
-            int expectedLines = (bytesLength + bytesPerLine - 1) / bytesPerLine;
-            StringBuilder result = new StringBuilder(expectedLines * lineLength);
+            var line = (new string(' ', lineLength - Environment.NewLine.Length) + Environment.NewLine).ToCharArray();
+            var expectedLines = (bytesLength + bytesPerLine - 1) / bytesPerLine;
+            var result = new StringBuilder(expectedLines * lineLength);
 
-            for (int i = 0; i < bytesLength; i += bytesPerLine)
+            for (var i = 0; i < bytesLength; i += bytesPerLine)
             {
                 line[0] = HexChars[(i >> 28) & 0xF];
                 line[1] = HexChars[(i >> 24) & 0xF];
@@ -40,10 +40,10 @@ namespace Impostor.Tools.Proxy
                 line[6] = HexChars[(i >> 4) & 0xF];
                 line[7] = HexChars[(i >> 0) & 0xF];
 
-                int hexColumn = firstHexColumn;
-                int charColumn = firstCharColumn;
+                var hexColumn = firstHexColumn;
+                var charColumn = firstCharColumn;
 
-                for (int j = 0; j < bytesPerLine; j++)
+                for (var j = 0; j < bytesPerLine; j++)
                 {
                     if (j > 0 && (j & 7) == 0) hexColumn++;
                     if (i + j >= bytesLength)
@@ -54,17 +54,20 @@ namespace Impostor.Tools.Proxy
                     }
                     else
                     {
-                        byte b = bytes[i + j];
+                        var b = bytes[i + j];
                         line[hexColumn] = HexChars[(b >> 4) & 0xF];
                         line[hexColumn + 1] = HexChars[b & 0xF];
                         line[charColumn] = (b < 32 ? '·' : (char)b);
                     }
+
                     hexColumn += 3;
                     charColumn++;
                 }
+
                 result.Append(line);
             }
+
             return result.ToString();
         }
     }
-}
\ No newline at end of file
+}
index 468cdd15ec27bc3c7b796e2d1d221836f62b1c85..c7f9cfac6fdc38acaf5fd46f80fc9b511955e013 100644 (file)
@@ -18,22 +18,22 @@ namespace Impostor.Tools.Proxy
 
         private static readonly Dictionary<byte, string> TagMap = new Dictionary<byte, string>
         {
-            {0, "HostGame"},
-            {1, "JoinGame"},
-            {2, "StartGame"},
-            {3, "RemoveGame"},
-            {4, "RemovePlayer"},
-            {5, "GameData"},
-            {6, "GameDataTo"},
-            {7, "JoinedGame"},
-            {8, "EndGame"},
-            {9, "GetGameList"},
-            {10, "AlterGame"},
-            {11, "KickPlayer"},
-            {12, "WaitForHost"},
-            {13, "Redirect"},
-            {14, "ReselectServer"},
-            {16, "GetGameListV2"}
+            { 0, "HostGame" },
+            { 1, "JoinGame" },
+            { 2, "StartGame" },
+            { 3, "RemoveGame" },
+            { 4, "RemovePlayer" },
+            { 5, "GameData" },
+            { 6, "GameDataTo" },
+            { 7, "JoinedGame" },
+            { 8, "EndGame" },
+            { 9, "GetGameList" },
+            { 10, "AlterGame" },
+            { 11, "KickPlayer" },
+            { 12, "WaitForHost" },
+            { 13, "Redirect" },
+            { 14, "ReselectServer" },
+            { 16, "GetGameListV2" },
         };
 
         private static IServiceProvider _serviceProvider;
@@ -46,7 +46,7 @@ namespace Impostor.Tools.Proxy
 
             _serviceProvider = services.BuildServiceProvider();
             _readerPool = _serviceProvider.GetRequiredService<ObjectPool<MessageReader>>();
-            
+
             var devices = LivePacketDevice.AllLocalMachine;
             if (devices.Count == 0)
             {
@@ -77,7 +77,7 @@ namespace Impostor.Tools.Proxy
             var ip = packet.Ethernet.IpV4;
             var ipSrc = ip.Source.ToString();
             var udp = ip.Udp;
-            
+
             // True if this is our own packet.
             using (var stream = udp.Payload.ToMemoryStream())
             {
@@ -86,14 +86,14 @@ namespace Impostor.Tools.Proxy
                 reader.Update(stream.ToArray());
 
                 var option = reader.Buffer[0];
-                if (option == (byte) MessageType.Reliable)
+                if (option == (byte)MessageType.Reliable)
                 {
                     reader.Seek(reader.Position + 3);
                 }
-                else if (option == (byte) UdpSendOption.Acknowledgement ||
-                         option == (byte) UdpSendOption.Ping ||
-                         option == (byte) UdpSendOption.Hello ||
-                         option == (byte) UdpSendOption.Disconnect)
+                else if (option == (byte)UdpSendOption.Acknowledgement ||
+                         option == (byte)UdpSendOption.Ping ||
+                         option == (byte)UdpSendOption.Hello ||
+                         option == (byte)UdpSendOption.Disconnect)
                 {
                     return;
                 }
@@ -101,9 +101,9 @@ namespace Impostor.Tools.Proxy
                 {
                     reader.Seek(reader.Position + 1);
                 }
-                
+
                 var isSent = ipSrc.StartsWith("192.");
-                
+
                 while (true)
                 {
                     if (reader.Position >= reader.Length)
@@ -120,7 +120,7 @@ namespace Impostor.Tools.Proxy
                     {
                         HandleToClient(ipSrc, message);
                     }
-                    
+
                     if (message.Position < message.Length)
                     {
                         Console.ForegroundColor = ConsoleColor.Red;
@@ -160,6 +160,7 @@ namespace Impostor.Tools.Proxy
                     {
                         Console.WriteLine("-     PlayerId    " + packet.ReadPackedInt32());
                     }
+
                     break;
                 case 10:
                     Console.WriteLine("- GameCode        " + packet.ReadInt32());
index 1111b7e711d8522b43a4130ddaa66948708c246a..7dc9196fe4e13a5a898920e1659b93d5995fcfd2 100644 (file)
@@ -11,4 +11,4 @@ namespace Impostor.Tools.ServerReplay.Mocks
             return Result;
         }
     }
-}
\ No newline at end of file
+}
index 261d679b628290cc45af74678adb8e89f72b97dd..65401efa09b1844474e6d4ed70f5862d060afb51 100644 (file)
@@ -89,7 +89,7 @@ namespace Impostor.Tools.ServerReplay
 
             services.AddSingleton(new ServerEnvironment
             {
-                IsReplay = true
+                IsReplay = true,
             });
 
             services.AddSingleton<FakeDateTimeProvider>();