From 38ae200a32dfd4089fc5391d8eca199dd6722522 Mon Sep 17 00:00:00 2001 From: Strilanc Date: Thu, 17 Mar 2011 02:40:10 -0300 Subject: [PATCH] Removing redundant ByVals (part 4) --- Plugins/Plugin Interfaces.vb | 18 +-- Plugins/Plugin Manager.vb | 12 +- Plugins/Plugin Socket.vb | 8 +- Warcraft3/Download/Download Client.vb | 16 +- Warcraft3/Download/Download Manager.vb | 40 ++--- Warcraft3/Download/Download Transfer.vb | 12 +- Warcraft3/Download/IPlayerDownloadAspect.vb | 16 +- Warcraft3/Game/Game Commands.vb | 46 +++--- Warcraft3/Game/Game Kernel.vb | 12 +- Warcraft3/Game/Game Load Screen.vb | 14 +- Warcraft3/Game/Game Lobby.vb | 126 +++++++-------- Warcraft3/Game/Game Motor.vb | 46 +++--- Warcraft3/Game/GameLoggerControl.vb | 8 +- Warcraft3/Game/W3Game.vb | 168 ++++++++++---------- Warcraft3/Game/W3GameControl.vb | 8 +- Warcraft3/Game/WC3GameManager.vb | 16 +- Warcraft3/Pinger.vb | 10 +- Warcraft3/Player/PlayerId.vb | 16 +- Warcraft3/Player/W3Player.vb | 104 ++++++------ Warcraft3/Protocol/Game Action Protocol.vb | 30 ++-- Warcraft3/Protocol/GameAction.vb | 18 +-- Warcraft3/Protocol/GameObjectIdJar.vb | 6 +- Warcraft3/Protocol/GameStatsJar.vb | 16 +- Warcraft3/Protocol/ObjectTypeJar.vb | 8 +- Warcraft3/Protocol/OrderIdJar.vb | 8 +- Warcraft3/Protocol/PlayerActionSet.vb | 16 +- Warcraft3/Protocol/SlotJar.vb | 4 +- Warcraft3/Protocol/WC3 Packet.vb | 8 +- Warcraft3/Protocol/WC3 Protocol Packers.vb | 144 ++++++++--------- Warcraft3/Protocol/WC3 Protocol Values.vb | 28 ++-- Warcraft3/Protocol/WC3 Protocol.vb | 18 +-- Warcraft3/Replay/Replay Entry Packers.vb | 58 +++---- Warcraft3/Replay/Replay Format.vb | 16 +- Warcraft3/Replay/ReplayDataReader.vb | 32 ++-- Warcraft3/Replay/ReplayEntry.vb | 18 +-- Warcraft3/Replay/ReplayManager.vb | 34 ++-- Warcraft3/Replay/ReplayReader.vb | 22 +-- Warcraft3/Replay/ReplayWriter.vb | 16 +- 38 files changed, 598 insertions(+), 598 deletions(-) diff --git a/Plugins/Plugin Interfaces.vb b/Plugins/Plugin Interfaces.vb index 8b2f2588..d9e15374 100644 --- a/Plugins/Plugin Interfaces.vb +++ b/Plugins/Plugin Interfaces.vb @@ -2,7 +2,7 @@ Namespace Plugins Public NotInheritable Class PluginException Inherits Exception - Public Sub New(ByVal message As String, Optional ByVal innerException As Exception = Nothing) + Public Sub New(message As String, Optional innerException As Exception = Nothing) MyBase.New(message, innerException) End Sub End Class @@ -14,9 +14,9 @@ Namespace Plugins ReadOnly Property Logger As Logger ReadOnly Property HasControl As Boolean ReadOnly Property Control() As Control - Function InvokeCommand(ByVal user As BotUser, ByVal argument As String) As Task(Of String) - Function IsArgumentPrivate(ByVal argument As String) As Boolean - Function IncludeCommand(ByVal command As Commands.ICommand(Of IPlugin)) As Task(Of IDisposable) + Function InvokeCommand(user As BotUser, argument As String) As Task(Of String) + Function IsArgumentPrivate(argument As String) As Boolean + Function IncludeCommand(command As Commands.ICommand(Of IPlugin)) As Task(Of IDisposable) MustInherit Shadows Class ContractClass @@ -47,12 +47,12 @@ Namespace Plugins Throw New NotSupportedException End Get End Property - Public Function InvokeCommand(ByVal user As BotUser, ByVal argument As String) As Task(Of String) Implements IPlugin.InvokeCommand + Public Function InvokeCommand(user As BotUser, argument As String) As Task(Of String) Implements IPlugin.InvokeCommand Contract.Requires(argument IsNot Nothing) Contract.Ensures(Contract.Result(Of Task(Of String))() IsNot Nothing) Throw New NotSupportedException End Function - Public Function IsArgumentPrivate(ByVal argument As String) As Boolean Implements IPlugin.IsArgumentPrivate + Public Function IsArgumentPrivate(argument As String) As Boolean Implements IPlugin.IsArgumentPrivate Contract.Requires(argument IsNot Nothing) Throw New NotSupportedException End Function @@ -61,7 +61,7 @@ Namespace Plugins Throw New NotSupportedException End Get End Property - Public Function IncludeCommand(ByVal command As Commands.ICommand(Of IPlugin)) As Task(Of IDisposable) Implements IPlugin.IncludeCommand + Public Function IncludeCommand(command As Commands.ICommand(Of IPlugin)) As Task(Of IDisposable) Implements IPlugin.IncludeCommand Contract.Requires(command IsNot Nothing) Contract.Ensures(Contract.Result(Of Task(Of IDisposable))() IsNot Nothing) Throw New NotSupportedException @@ -71,13 +71,13 @@ Namespace Plugins Public Interface IPluginFactory - Function CreatePlugin(ByVal bot As Bot.MainBot) As IPlugin + Function CreatePlugin(bot As Bot.MainBot) As IPlugin MustInherit Class ContractClass Implements IPluginFactory - Public Function CreatePlugin(ByVal bot As Bot.MainBot) As IPlugin Implements IPluginFactory.CreatePlugin + Public Function CreatePlugin(bot As Bot.MainBot) As IPlugin Implements IPluginFactory.CreatePlugin Contract.Requires(bot IsNot Nothing) Contract.Ensures(Contract.Result(Of IPlugin)() IsNot Nothing) Throw New NotSupportedException() diff --git a/Plugins/Plugin Manager.vb b/Plugins/Plugin Manager.vb index 5f64c0c3..c4902f4d 100644 --- a/Plugins/Plugin Manager.vb +++ b/Plugins/Plugin Manager.vb @@ -16,7 +16,7 @@ Namespace Plugins Contract.Invariant(_hooks IsNot Nothing) End Sub - Public Sub New(ByVal socket As Plugins.Socket) + Public Sub New(socket As Plugins.Socket) Contract.Requires(socket IsNot Nothing) Me._socket = socket End Sub @@ -42,14 +42,14 @@ Namespace Plugins Return _socket.Plugin.HasControl End Get End Property - Public Function IsArgumentPrivate(ByVal argument As String) As Boolean Implements IBotComponent.IsArgumentPrivate + Public Function IsArgumentPrivate(argument As String) As Boolean Implements IBotComponent.IsArgumentPrivate Return _socket.Plugin.IsArgumentPrivate(argument) End Function - Public Function InvokeCommand(ByVal user As BotUser, ByVal argument As String) As Task(Of String) Implements IBotComponent.InvokeCommand + Public Function InvokeCommand(user As BotUser, argument As String) As Task(Of String) Implements IBotComponent.InvokeCommand Return _socket.Plugin.InvokeCommand(user, argument) End Function - Protected Overrides Function PerformDispose(ByVal finalizing As Boolean) As Task + Protected Overrides Function PerformDispose(finalizing As Boolean) As Task _socket.Dispose() Return _hooks.DisposeAllAsync() End Function @@ -60,7 +60,7 @@ Namespace Plugins End Get End Property - Private Function IncludeCommandImpl(ByVal command As ICommand(Of IBotComponent)) As Task(Of IDisposable) Implements IBotComponent.IncludeCommand + Private Function IncludeCommandImpl(command As ICommand(Of IBotComponent)) As Task(Of IDisposable) Implements IBotComponent.IncludeCommand Dim converter = Function(plugin As IPlugin) If plugin IsNot Me._socket.Plugin Then Throw New NotSupportedException("Command mapped from manager to plugin used on different plugin.") @@ -69,7 +69,7 @@ Namespace Plugins End Function Return IncludeCommand(command.ProjectedFrom(converter)) End Function - Public Function IncludeCommand(ByVal command As ICommand(Of IPlugin)) As Task(Of IDisposable) + Public Function IncludeCommand(command As ICommand(Of IPlugin)) As Task(Of IDisposable) Contract.Requires(command IsNot Nothing) Contract.Ensures(Contract.Result(Of Task(Of IDisposable))() IsNot Nothing) Return _socket.Plugin.IncludeCommand(command) diff --git a/Plugins/Plugin Socket.vb b/Plugins/Plugin Socket.vb index 219d5ef6..3c7639dc 100644 --- a/Plugins/Plugin Socket.vb +++ b/Plugins/Plugin Socket.vb @@ -12,9 +12,9 @@ Namespace Plugins End Sub - Public Sub New(ByVal name As InvariantString, - ByVal bot As Bot.MainBot, - ByVal assemblyPath As String) + Public Sub New(name As InvariantString, + bot As Bot.MainBot, + assemblyPath As String) Contract.Requires(bot IsNot Nothing) Contract.Requires(assemblyPath IsNot Nothing) Me._name = name @@ -42,7 +42,7 @@ Namespace Plugins End Get End Property - Protected Overrides Function PerformDispose(ByVal finalizing As Boolean) As Task + Protected Overrides Function PerformDispose(finalizing As Boolean) As Task _plugin.Dispose() Return Nothing End Function diff --git a/Warcraft3/Download/Download Client.vb b/Warcraft3/Download/Download Client.vb index 67ac7d15..888a0526 100644 --- a/Warcraft3/Download/Download Client.vb +++ b/Warcraft3/Download/Download Client.vb @@ -35,10 +35,10 @@ Namespace WC3.Download Contract.Invariant(_reportedPosition <= _map.FileSize) End Sub - Public Sub New(ByVal player As IPlayerDownloadAspect, - ByVal map As Map, - ByVal clock As IClock, - ByVal hooks As IEnumerable(Of Task(Of IDisposable))) + Public Sub New(player As IPlayerDownloadAspect, + map As Map, + clock As IClock, + hooks As IEnumerable(Of Task(Of IDisposable))) Contract.Requires(map IsNot Nothing) Contract.Requires(clock IsNot Nothing) Contract.Requires(hooks IsNot Nothing) @@ -123,7 +123,7 @@ Namespace WC3.Download Contract.Requires(HasReported) Return _reportedState End Get - Set(ByVal value As Protocol.MapTransferState) + Set(value As Protocol.MapTransferState) Contract.Requires(HasReported) _reportedState = value End Set @@ -135,7 +135,7 @@ Namespace WC3.Download Contract.Assume(_reportedPosition <= Map.FileSize) Return _reportedPosition End Get - Set(ByVal value As UInt32) + Set(value As UInt32) Contract.Requires(HasReported) Contract.Requires(value <= Map.FileSize) Contract.Assume(value <= _map.FileSize) @@ -184,7 +184,7 @@ Namespace WC3.Download Where sign <> 0).FirstOrDefault) End Function - Public Shared Function StartTransfer(ByVal downloader As TransferClient, ByVal uploader As TransferClient) As Transfer + Public Shared Function StartTransfer(downloader As TransferClient, uploader As TransferClient) As Transfer Contract.Requires(downloader IsNot Nothing) Contract.Requires(uploader IsNot Nothing) Contract.Requires(downloader.HasReported) @@ -234,7 +234,7 @@ Namespace WC3.Download _hasReported = True End Sub - Protected Overrides Function PerformDispose(ByVal finalizing As Boolean) As Task + Protected Overrides Function PerformDispose(finalizing As Boolean) As Task If _transfer IsNot Nothing Then _transfer.Dispose() _transfer = Nothing diff --git a/Warcraft3/Download/Download Manager.vb b/Warcraft3/Download/Download Manager.vb index 5618eab3..d3c6e4e3 100644 --- a/Warcraft3/Download/Download Manager.vb +++ b/Warcraft3/Download/Download Manager.vb @@ -36,11 +36,11 @@ Namespace WC3.Download 'Contract.Invariant((_started.State = OnetimeLockState.Acquired) = (_mapPieceSender IsNot Nothing)) End Sub - Public Sub New(ByVal clock As IClock, - ByVal map As Map, - ByVal logger As Logger, - ByVal allowDownloads As Boolean, - ByVal allowUploads As Boolean) + Public Sub New(clock As IClock, + map As Map, + logger As Logger, + allowDownloads As Boolean, + allowUploads As Boolean) Contract.Requires(map IsNot Nothing) Contract.Requires(logger IsNot Nothing) Contract.Requires(clock IsNot Nothing) @@ -51,8 +51,8 @@ Namespace WC3.Download Me._allowUploads = allowUploads End Sub - Public Sub Start(ByVal startPlayerHoldPoint As IHoldPoint(Of IPlayerDownloadAspect), - ByVal mapPieceSender As Action(Of IPlayerDownloadAspect, UInt32)) + Public Sub Start(startPlayerHoldPoint As IHoldPoint(Of IPlayerDownloadAspect), + mapPieceSender As Action(Of IPlayerDownloadAspect, UInt32)) Contract.Requires(startPlayerHoldPoint IsNot Nothing) Contract.Requires(mapPieceSender IsNot Nothing) If Me.IsDisposed Then Throw New ObjectDisposedException(Me.GetType.Name) @@ -80,7 +80,7 @@ Namespace WC3.Download End Get End Property - Private Sub SendMapFileData(ByVal client As TransferClient, ByVal reportedPosition As UInt32) + Private Sub SendMapFileData(client As TransferClient, reportedPosition As UInt32) Contract.Requires(client IsNot Nothing) Contract.Requires(client.Transfer IsNot Nothing) Contract.Requires(client.Transfer.Uploader Is _defaultClient) @@ -94,7 +94,7 @@ Namespace WC3.Download End Sub #Region "Public View" - Private ReadOnly Property ClientLatencyDescription(ByVal player As IPlayerDownloadAspect, ByVal latencyDescription As String) As String + Private ReadOnly Property ClientLatencyDescription(player As IPlayerDownloadAspect, latencyDescription As String) As String Get Contract.Requires(player IsNot Nothing) Contract.Requires(latencyDescription IsNot Nothing) @@ -119,14 +119,14 @@ Namespace WC3.Download End If End Get End Property - Public Function QueueGetClientLatencyDescription(ByVal player As IPlayerDownloadAspect, ByVal latencyDescription As String) As Task(Of String) + Public Function QueueGetClientLatencyDescription(player As IPlayerDownloadAspect, latencyDescription As String) As Task(Of String) Contract.Requires(player IsNot Nothing) Contract.Requires(latencyDescription IsNot Nothing) Contract.Ensures(Contract.Result(Of Task(Of String))() IsNot Nothing) Return inQueue.QueueFunc(Function() ClientLatencyDescription(player, latencyDescription)) End Function - Private ReadOnly Property ClientBandwidthDescription(ByVal player As IPlayerDownloadAspect) As String + Private ReadOnly Property ClientBandwidthDescription(player As IPlayerDownloadAspect) As String Get Contract.Requires(player IsNot Nothing) Contract.Ensures(Contract.Result(Of String)() IsNot Nothing) @@ -147,7 +147,7 @@ Namespace WC3.Download Return ">HiB/s" '... What? It could happen... End Get End Property - Public Function QueueGetClientBandwidthDescription(ByVal player As IPlayerDownloadAspect) As Task(Of String) + Public Function QueueGetClientBandwidthDescription(player As IPlayerDownloadAspect) As Task(Of String) Contract.Requires(player IsNot Nothing) Contract.Ensures(Contract.Result(Of Task(Of String))() IsNot Nothing) Return inQueue.QueueFunc(Function() ClientBandwidthDescription(player)) @@ -161,7 +161,7 @@ Namespace WC3.Download #End Region #Region "Game-Triggered" - Private Function OnGameStartPlayerHold(ByVal player As IPlayerDownloadAspect) As Task + Private Function OnGameStartPlayerHold(player As IPlayerDownloadAspect) As Task Contract.Requires(player IsNot Nothing) Dim playerHooks = New List(Of Task(Of IDisposable))() From { @@ -187,7 +187,7 @@ Namespace WC3.Download #End Region #Region "Communication-Triggered" - Private Function QueueOnReceiveClientMapInfo(ByVal player As IPlayerDownloadAspect, ByVal vals As NamedValueMap) As Task + Private Function QueueOnReceiveClientMapInfo(player As IPlayerDownloadAspect, vals As NamedValueMap) As Task Contract.Requires(player IsNot Nothing) Contract.Requires(vals IsNot Nothing) Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) @@ -195,14 +195,14 @@ Namespace WC3.Download state:=vals.ItemAs(Of Protocol.MapTransferState)("transfer state"), position:=vals.ItemAs(Of UInt32)("total downloaded"))) End Function - Private Function QueueOnReceivePeerConnectionInfo(ByVal player As IPlayerDownloadAspect, ByVal flags As UInt16) As Task + Private Function QueueOnReceivePeerConnectionInfo(player As IPlayerDownloadAspect, flags As UInt16) As Task Contract.Requires(player IsNot Nothing) Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) Return inQueue.QueueAction(Sub() OnReceivePeerConnectionInfo(player:=player, flags:=flags)) End Function - Private Sub OnReceivePeerConnectionInfo(ByVal player As IPlayerDownloadAspect, ByVal flags As UInt32) + Private Sub OnReceivePeerConnectionInfo(player As IPlayerDownloadAspect, flags As UInt32) Contract.Requires(player IsNot Nothing) If Not _playerClients.ContainsKey(player) Then Return @@ -216,7 +216,7 @@ Namespace WC3.Download Select peer) End Sub - Private Sub OnReceiveClientMapInfo(ByVal player As IPlayerDownloadAspect, ByVal state As Protocol.MapTransferState, ByVal position As UInt32) + Private Sub OnReceiveClientMapInfo(player As IPlayerDownloadAspect, state As Protocol.MapTransferState, position As UInt32) Contract.Requires(player IsNot Nothing) If Not _playerClients.ContainsKey(player) Then Return @@ -243,7 +243,7 @@ Namespace WC3.Download SendMapFileData(client, position) End If End Sub - Private Sub OnFirstMapInfo(ByVal client As TransferClient, ByVal state As Protocol.MapTransferState, ByVal position As UInt32) + Private Sub OnFirstMapInfo(client As TransferClient, state As Protocol.MapTransferState, position As UInt32) Contract.Requires(client IsNot Nothing) Contract.Requires(client.Player IsNot Nothing) Contract.Requires(Not client.HasReported) @@ -258,7 +258,7 @@ Namespace WC3.Download reasonDescription:="Downloads not allowed.") End If End Sub - Private Sub OnTypicalMapInfo(ByVal client As TransferClient, ByVal state As Protocol.MapTransferState, ByVal position As UInt32) + Private Sub OnTypicalMapInfo(client As TransferClient, state As Protocol.MapTransferState, position As UInt32) Contract.Requires(client IsNot Nothing) Contract.Requires(client.Player IsNot Nothing) Contract.Requires(client.HasReported) @@ -391,7 +391,7 @@ Namespace WC3.Download End Sub #End Region - Protected Overrides Function PerformDispose(ByVal finalizing As Boolean) As Task + Protected Overrides Function PerformDispose(finalizing As Boolean) As Task If finalizing Then Return Nothing Return inQueue.QueueFunc( Function() diff --git a/Warcraft3/Download/Download Transfer.vb b/Warcraft3/Download/Download Transfer.vb index 5dc53bfe..17a4da9c 100644 --- a/Warcraft3/Download/Download Transfer.vb +++ b/Warcraft3/Download/Download Transfer.vb @@ -20,11 +20,11 @@ Namespace WC3.Download Contract.Invariant(_startingPosition <= _fileSize) End Sub - Public Sub New(ByVal downloader As TransferClient, - ByVal uploader As TransferClient, - ByVal startingPosition As UInt32, - ByVal filesize As UInt32, - ByVal clock As IClock) + Public Sub New(downloader As TransferClient, + uploader As TransferClient, + startingPosition As UInt32, + filesize As UInt32, + clock As IClock) Contract.Requires(downloader IsNot Nothing) Contract.Requires(uploader IsNot Nothing) Contract.Requires(clock IsNot Nothing) @@ -95,7 +95,7 @@ Namespace WC3.Download End Get End Property - Public Sub Advance(ByVal progress As UInt32) + Public Sub Advance(progress As UInt32) _totalProgress += progress _lastActivityClock = _lastActivityClock.Restarted() End Sub diff --git a/Warcraft3/Download/IPlayerDownloadAspect.vb b/Warcraft3/Download/IPlayerDownloadAspect.vb index 76abc6f8..ee564b9a 100644 --- a/Warcraft3/Download/IPlayerDownloadAspect.vb +++ b/Warcraft3/Download/IPlayerDownloadAspect.vb @@ -4,11 +4,11 @@ Inherits IDisposableWithTask ReadOnly Property Name As InvariantString ReadOnly Property Id As PlayerId - Function QueueAddPacketHandler(Of T)(ByVal packetDefinition As Protocol.Packets.Definition(Of T), - ByVal handler As Func(Of T, Task)) As Task(Of IDisposable) + Function QueueAddPacketHandler(Of T)(packetDefinition As Protocol.Packets.Definition(Of T), + handler As Func(Of T, Task)) As Task(Of IDisposable) Function MakePacketOtherPlayerJoined() As Protocol.Packet - Function QueueSendPacket(ByVal packet As Protocol.Packet) As Task - Function QueueDisconnect(ByVal expected As Boolean, ByVal reportedReason As Protocol.PlayerLeaveReason, ByVal reasonDescription As String) As Task + Function QueueSendPacket(packet As Protocol.Packet) As Task + Function QueueDisconnect(expected As Boolean, reportedReason As Protocol.PlayerLeaveReason, reasonDescription As String) As Task MustInherit Shadows Class ContractClass @@ -27,20 +27,20 @@ Throw New NotSupportedException End Get End Property - Public Function QueueAddPacketHandler(Of T)(ByVal packetDefinition As Protocol.Packets.Definition(Of T), - ByVal handler As Func(Of T, Task)) As Task(Of IDisposable) _ + Public Function QueueAddPacketHandler(Of T)(packetDefinition As Protocol.Packets.Definition(Of T), + handler As Func(Of T, Task)) As Task(Of IDisposable) _ Implements IPlayerDownloadAspect.QueueAddPacketHandler Contract.Requires(packetDefinition IsNot Nothing) Contract.Requires(handler IsNot Nothing) Contract.Ensures(Contract.Result(Of Task(Of IDisposable))() IsNot Nothing) Throw New NotSupportedException End Function - Public Function QueueSendPacket(ByVal packet As Protocol.Packet) As Task Implements IPlayerDownloadAspect.QueueSendPacket + Public Function QueueSendPacket(packet As Protocol.Packet) As Task Implements IPlayerDownloadAspect.QueueSendPacket Contract.Requires(packet IsNot Nothing) Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) Throw New NotSupportedException End Function - Public Function QueueDisconnect(ByVal expected As Boolean, ByVal reportedReason As Protocol.PlayerLeaveReason, ByVal reasonDescription As String) As Task Implements IPlayerDownloadAspect.QueueDisconnect + Public Function QueueDisconnect(expected As Boolean, reportedReason As Protocol.PlayerLeaveReason, reasonDescription As String) As Task Implements IPlayerDownloadAspect.QueueDisconnect Contract.Requires(reasonDescription IsNot Nothing) Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) Throw New NotSupportedException diff --git a/Warcraft3/Game/Game Commands.vb b/Warcraft3/Game/Game Commands.vb index 7ae5fb90..de8220e4 100644 --- a/Warcraft3/Game/Game Commands.vb +++ b/Warcraft3/Game/Game Commands.vb @@ -5,7 +5,7 @@ Namespace WC3 Private Sub New() End Sub - Private Shared Function Conv(ByVal command As ICommand(Of Game)) As ICommand(Of GameManager) + Private Shared Function Conv(command As ICommand(Of Game)) As ICommand(Of GameManager) Contract.Requires(command IsNot Nothing) Contract.Ensures(Contract.Result(Of ICommand(Of GameManager))() IsNot Nothing) Return command.ProjectedFrom(Function(x As GameManager) x.Game) @@ -88,7 +88,7 @@ Namespace WC3 Description:="Kicks a player from the game. Closes their slot if -close is specified.") End Sub - Protected Overloads Overrides Async Function PerformInvoke(ByVal target As Game, ByVal user As BotUser, ByVal argument As CommandArgument) As Task(Of String) + Protected Overloads Overrides Async Function PerformInvoke(target As Game, user As BotUser, argument As CommandArgument) As Task(Of String) Dim slotQuery = argument.RawValue(0) Dim shouldClose = argument.HasOptionalSwitch("close") Await target.QueueBoot(slotQuery, shouldClose) @@ -105,7 +105,7 @@ Namespace WC3 Description:="Forwards commands to the bot.") End Sub - Protected Overrides Async Function PerformInvoke(ByVal target As GameManager, ByVal user As BotUser, ByVal argument As String) As Task(Of String) + Protected Overrides Async Function PerformInvoke(target As GameManager, user As BotUser, argument As String) As Task(Of String) Dim botManagers = (Await target.Bot.Components.QueueGetAllComponents()).OfType(Of Bot.MainBotManager)() Return Await botManagers.Single().InvokeCommand(user, argument) End Function @@ -119,7 +119,7 @@ Namespace WC3 Description:="Closes this game instance.") End Sub - Protected Overloads Overrides Async Function PerformInvoke(ByVal target As Game, ByVal user As BotUser, ByVal argument As CommandArgument) As Task(Of String) + Protected Overloads Overrides Async Function PerformInvoke(target As Game, user As BotUser, argument As CommandArgument) As Task(Of String) target.Dispose() Await target.DisposalTask Return "Cancelled" @@ -134,7 +134,7 @@ Namespace WC3 Description:="Closes a slot.") End Sub - Protected Overloads Overrides Async Function PerformInvoke(ByVal target As Game, ByVal user As BotUser, ByVal argument As CommandArgument) As Task(Of String) + Protected Overloads Overrides Async Function PerformInvoke(target As Game, user As BotUser, argument As CommandArgument) As Task(Of String) Await target.QueueCloseSlot(argument.RawValue(0)) Return "Closed" End Function @@ -148,7 +148,7 @@ Namespace WC3 Description:="Sets the color of a slot. Not allowed when the map uses Fixed Player Settings.") End Sub - Protected Overloads Overrides Async Function PerformInvoke(ByVal target As Game, ByVal user As BotUser, ByVal argument As CommandArgument) As Task(Of String) + Protected Overloads Overrides Async Function PerformInvoke(target As Game, user As BotUser, argument As CommandArgument) As Task(Of String) Dim argSlot = argument.RawValue(0) Dim argColor = argument.RawValue(1) Dim color = argColor.EnumTryParse(Of Protocol.PlayerColor)(ignoreCase:=True) @@ -166,7 +166,7 @@ Namespace WC3 Description:="Places a computer in a slot, unless it contains a player.") End Sub - Protected Overloads Overrides Async Function PerformInvoke(ByVal target As Game, ByVal user As BotUser, ByVal argument As CommandArgument) As Task(Of String) + Protected Overloads Overrides Async Function PerformInvoke(target As Game, user As BotUser, argument As CommandArgument) As Task(Of String) Dim argSlot = argument.RawValue(0) Dim argDifficulty = If(argument.RawValueCount >= 2, argument.RawValue(1), WC3.Protocol.ComputerLevel.Normal.ToString) Dim difficulty = argDifficulty.EnumTryParse(Of Protocol.ComputerLevel)(ignoreCase:=True) @@ -184,7 +184,7 @@ Namespace WC3 Description:="Causes the bot to disconnect from the game. The game might continue if one of the players can host.") End Sub - Protected Overloads Overrides Async Function PerformInvoke(ByVal target As Game, ByVal user As BotUser, ByVal argument As CommandArgument) As Task(Of String) + Protected Overloads Overrides Async Function PerformInvoke(target As Game, user As BotUser, argument As CommandArgument) As Task(Of String) target.Dispose() Await target.DisposalTask Return "Disconnected" @@ -199,7 +199,7 @@ Namespace WC3 Description:="Gives access to admin or host commands.") End Sub - Protected Overloads Overrides Async Function PerformInvoke(ByVal target As Game, ByVal user As BotUser, ByVal argument As CommandArgument) As Task(Of String) + Protected Overloads Overrides Async Function PerformInvoke(target As Game, user As BotUser, argument As CommandArgument) As Task(Of String) If user Is Nothing Then Throw New InvalidOperationException("User not specified.") Await target.QueueElevatePlayer(user.Name, argument.RawValue(0)) Return "Elevated" @@ -213,7 +213,7 @@ Namespace WC3 template:="setting", Description:="Returns the current value of a game setting {tickperiod, laglimit, gamerate}.") End Sub - Protected Overloads Overrides Function PerformInvoke(ByVal target As Game, ByVal user As BotUser, ByVal argument As CommandArgument) As Task(Of String) + Protected Overloads Overrides Function PerformInvoke(target As Game, user As BotUser, argument As CommandArgument) As Task(Of String) Contract.Assume(target IsNot Nothing) Dim val As Task(Of Double) Dim argSetting = argument.RawValue(0).ToInvariant @@ -236,7 +236,7 @@ Namespace WC3 Description:="Sets the handicap of a slot.") End Sub - Protected Overloads Overrides Async Function PerformInvoke(ByVal target As Game, ByVal user As BotUser, ByVal argument As CommandArgument) As Task(Of String) + Protected Overloads Overrides Async Function PerformInvoke(target As Game, user As BotUser, argument As CommandArgument) As Task(Of String) Dim argSlot = argument.RawValue(0) Dim argHandicap = argument.RawValue(1) Dim newHandicap As Byte @@ -259,7 +259,7 @@ Namespace WC3 Description:="Prevents players from leaving a slot or from changing slot properties (if -full). Omit the slot argument to affect all slots.") End Sub - Protected Overloads Overrides Async Function PerformInvoke(ByVal target As Game, ByVal user As BotUser, ByVal argument As CommandArgument) As Task(Of String) + Protected Overloads Overrides Async Function PerformInvoke(target As Game, user As BotUser, argument As CommandArgument) As Task(Of String) Dim lockType = If(argument.HasOptionalSwitch("full"), WC3.Slot.LockState.Frozen, WC3.Slot.LockState.Sticky) If argument.RawValueCount = 0 Then Await target.QueueSetAllSlotsLocked(lockType) @@ -279,7 +279,7 @@ Namespace WC3 Description:="Opens a slot.") End Sub - Protected Overloads Overrides Async Function PerformInvoke(ByVal target As Game, ByVal user As BotUser, ByVal argument As CommandArgument) As Task(Of String) + Protected Overloads Overrides Async Function PerformInvoke(target As Game, user As BotUser, argument As CommandArgument) As Task(Of String) Await target.QueueOpenSlot(argument.RawValue(0)) Return "Opened" End Function @@ -292,7 +292,7 @@ Namespace WC3 template:="", Description:="Returns estimated network round trip times for each player.") End Sub - Protected Overloads Overrides Function PerformInvoke(ByVal target As Game, ByVal user As BotUser, ByVal argument As CommandArgument) As Task(Of String) + Protected Overloads Overrides Function PerformInvoke(target As Game, user As BotUser, argument As CommandArgument) As Task(Of String) Contract.Assume(target IsNot Nothing) Return From players In target.QueueGetPlayers() From latencies In (From player In players Select player.QueueGetLatencyDescription).Cache.AsAggregateTask @@ -311,7 +311,7 @@ Namespace WC3 Description:="Sets the race of a slot. Not allowed when the map uses Fixed Player Settings and the slot race is not Selectable.") End Sub - Protected Overloads Overrides Async Function PerformInvoke(ByVal target As Game, ByVal user As BotUser, ByVal argument As CommandArgument) As Task(Of String) + Protected Overloads Overrides Async Function PerformInvoke(target As Game, user As BotUser, argument As CommandArgument) As Task(Of String) Dim argSlot = argument.RawValue(0) Dim argRace = argument.RawValue(1) Dim race = argRace.EnumTryParse(Of Protocol.Races)(ignoreCase:=True) @@ -329,7 +329,7 @@ Namespace WC3 Description:="Reserves a slot for a player.") End Sub - Protected Overloads Overrides Async Function PerformInvoke(ByVal target As Game, ByVal user As BotUser, ByVal argument As CommandArgument) As Task(Of String) + Protected Overloads Overrides Async Function PerformInvoke(target As Game, user As BotUser, argument As CommandArgument) As Task(Of String) Dim name = argument.RawValue(0) Dim slotQueryString = argument.TryGetOptionalNamedValue("slot") Dim slotQuery = If(slotQueryString Is Nothing, Nothing, New InvariantString?(slotQueryString)) @@ -346,7 +346,7 @@ Namespace WC3 template:="setting value", Description:="Sets the value of a game setting {tickperiod, laglimit, gamerate}.") End Sub - Protected Overloads Overrides Function PerformInvoke(ByVal target As Game, ByVal user As BotUser, ByVal argument As CommandArgument) As Task(Of String) + Protected Overloads Overrides Function PerformInvoke(target As Game, user As BotUser, argument As CommandArgument) As Task(Of String) Contract.Assume(target IsNot Nothing) Dim val_us As UShort Dim vald As Double @@ -381,7 +381,7 @@ Namespace WC3 Description:="Sets a slot's team. Only works in melee games.") End Sub - Protected Overloads Overrides Async Function PerformInvoke(ByVal target As Game, ByVal user As BotUser, ByVal argument As CommandArgument) As Task(Of String) + Protected Overloads Overrides Async Function PerformInvoke(target As Game, user As BotUser, argument As CommandArgument) As Task(Of String) Dim argSlot = argument.RawValue(0) Dim argTeam = argument.RawValue(1) Dim team As Byte @@ -402,7 +402,7 @@ Namespace WC3 Description:="Sets up the number of slots on each team (eg. 'SetupTeams 2v2' will leave two open slots on each team).") End Sub - Protected Overloads Overrides Async Function PerformInvoke(ByVal target As Game, ByVal user As BotUser, ByVal argument As CommandArgument) As Task(Of String) + Protected Overloads Overrides Async Function PerformInvoke(target As Game, user As BotUser, argument As CommandArgument) As Task(Of String) Await target.QueueTrySetTeamSizes(TeamVersusStringToTeamSizes(argument.RawValue(0))) Return "Set Teams" End Function @@ -416,7 +416,7 @@ Namespace WC3 Description:="Starts the launch countdown.") End Sub - Protected Overloads Overrides Async Function PerformInvoke(ByVal target As Game, ByVal user As BotUser, ByVal argument As CommandArgument) As Task(Of String) + Protected Overloads Overrides Async Function PerformInvoke(target As Game, user As BotUser, argument As CommandArgument) As Task(Of String) Await target.QueueStartCountdown() Return "Started Countdown" End Function @@ -430,7 +430,7 @@ Namespace WC3 Description:="Swaps the contents of two slots.") End Sub - Protected Overloads Overrides Async Function PerformInvoke(ByVal target As Game, ByVal user As BotUser, ByVal argument As CommandArgument) As Task(Of String) + Protected Overloads Overrides Async Function PerformInvoke(target As Game, user As BotUser, argument As CommandArgument) As Task(Of String) Await target.QueueSwapSlotContents(argument.RawValue(0), argument.RawValue(1)) Return "Swapped Slots" End Function @@ -444,7 +444,7 @@ Namespace WC3 Description:="Allows players to move from a slot and change its properties. Omit the slot argument to affect all slots.") End Sub - Protected Overloads Overrides Async Function PerformInvoke(ByVal target As Game, ByVal user As BotUser, ByVal argument As CommandArgument) As Task(Of String) + Protected Overloads Overrides Async Function PerformInvoke(target As Game, user As BotUser, argument As CommandArgument) As Task(Of String) Dim lockType = WC3.Slot.LockState.Unlocked If argument.RawValueCount = 0 Then Await target.QueueSetAllSlotsLocked(lockType) @@ -464,7 +464,7 @@ Namespace WC3 Description:="Places or cancels a vote to prematurely start an autostarted game. Requires at least 2 players and at least a 2/3 majority.") End Sub - Protected Overloads Overrides Async Function PerformInvoke(ByVal target As Game, ByVal user As BotUser, ByVal argument As CommandArgument) As Task(Of String) + Protected Overloads Overrides Async Function PerformInvoke(target As Game, user As BotUser, argument As CommandArgument) As Task(Of String) If user Is Nothing Then Throw New InvalidOperationException("User not specified.") Await target.QueueSetPlayerVoteToStart(user.Name, wantsToStart:=Not argument.HasOptionalSwitch("cancel")) Return "Voted to start" diff --git a/Warcraft3/Game/Game Kernel.vb b/Warcraft3/Game/Game Kernel.vb index 76624bea..02a7ba05 100644 --- a/Warcraft3/Game/Game Kernel.vb +++ b/Warcraft3/Game/Game Kernel.vb @@ -33,7 +33,7 @@ Namespace WC3 Private ReadOnly _players As New ObservableCollection(Of Player) Private _state As GameState = GameState.AcceptingPlayers - Public Event ChangedState(ByVal sender As GameKernel, ByVal oldState As GameState, ByVal newState As GameState) + Public Event ChangedState(sender As GameKernel, oldState As GameState, newState As GameState) Private Sub ObjectInvariant() Contract.Invariant(_clock IsNot Nothing) @@ -43,10 +43,10 @@ Namespace WC3 Contract.Invariant(_logger IsNot Nothing) End Sub - Public Sub New(ByVal clock As IClock, - ByVal inQueue As CallQueue, - ByVal outQueue As CallQueue, - ByVal logger As Logger) + Public Sub New(clock As IClock, + inQueue As CallQueue, + outQueue As CallQueue, + logger As Logger) Contract.Assume(clock IsNot Nothing) Contract.Assume(inQueue IsNot Nothing) Contract.Assume(outQueue IsNot Nothing) @@ -90,7 +90,7 @@ Namespace WC3 Get Return _state End Get - Set(ByVal value As GameState) + Set(value As GameState) Dim oldState = State _state = value RaiseEvent ChangedState(Me, oldState, value) diff --git a/Warcraft3/Game/Game Load Screen.vb b/Warcraft3/Game/Game Load Screen.vb index 2cc75657..4c26c5ef 100644 --- a/Warcraft3/Game/Game Load Screen.vb +++ b/Warcraft3/Game/Game Load Screen.vb @@ -11,9 +11,9 @@ Private _loadInGameTickCount As Integer Private _loadInGameTicker As IDisposable - Public Event RecordGameStarted(ByVal sender As GameLoadScreen) - Public Event EmptyTick(ByVal sender As GameLoadScreen) - Public Event Finished(ByVal sender As GameLoadScreen) + Public Event RecordGameStarted(sender As GameLoadScreen) + Public Event EmptyTick(sender As GameLoadScreen) + Public Event Finished(sender As GameLoadScreen) Private Sub ObjectInvariant() Contract.Invariant(_settings IsNot Nothing) @@ -25,9 +25,9 @@ Contract.Invariant(_loadInGameTickCount >= 0) End Sub - Public Sub New(ByVal kernel As GameKernel, - ByVal lobby As GameLobby, - ByVal settings As GameSettings) + Public Sub New(kernel As GameKernel, + lobby As GameLobby, + settings As GameSettings) Contract.Assume(kernel IsNot Nothing) Contract.Assume(lobby IsNot Nothing) Contract.Assume(settings IsNot Nothing) @@ -115,7 +115,7 @@ End If End Sub - Private Sub OnReceiveReady(ByVal sendingPlayer As Player) + Private Sub OnReceiveReady(sendingPlayer As Player) Contract.Requires(sendingPlayer IsNot Nothing) If Not unreadyPlayers.Contains(sendingPlayer) Then Return diff --git a/Warcraft3/Game/Game Lobby.vb b/Warcraft3/Game/Game Lobby.vb index 47f22c38..d3f653e7 100644 --- a/Warcraft3/Game/Game Lobby.vb +++ b/Warcraft3/Game/Game Lobby.vb @@ -11,8 +11,8 @@ Private _fakeHostPlayer As Player Private _slots As SlotSet - Public Event ChangedPublicState(ByVal sender As GameLobby) - Public Event RemovePlayer(ByVal sender As GameLobby, ByVal player As Player, ByVal wasExpected As Boolean, ByVal reportedReason As Protocol.PlayerLeaveReason, ByVal reasonDescription As String) + Public Event ChangedPublicState(sender As GameLobby) + Public Event RemovePlayer(sender As GameLobby, player As Player, wasExpected As Boolean, reportedReason As Protocol.PlayerLeaveReason, reasonDescription As String) Private Sub ObjectInvariant() Contract.Invariant(_downloadManager IsNot Nothing) @@ -24,10 +24,10 @@ Contract.Invariant(_settings IsNot Nothing) End Sub - Public Sub New(ByVal startPlayerHoldPoint As HoldPoint(Of Player), - ByVal downloadManager As Download.Manager, - ByVal kernel As GameKernel, - ByVal settings As GameSettings) + Public Sub New(startPlayerHoldPoint As HoldPoint(Of Player), + downloadManager As Download.Manager, + kernel As GameKernel, + settings As GameSettings) Contract.Assume(startPlayerHoldPoint IsNot Nothing) Contract.Assume(downloadManager IsNot Nothing) Contract.Assume(settings IsNot Nothing) @@ -77,7 +77,7 @@ Next remainingObsSlot End If End Sub - Private Shared Function InitCreateSlots(ByVal settings As GameSettings) As IRist(Of Slot) + Private Shared Function InitCreateSlots(settings As GameSettings) As IRist(Of Slot) Contract.Requires(settings IsNot Nothing) Contract.Ensures(Contract.Result(Of IRist(Of Slot))() IsNot Nothing) Dim result = New List(Of Slot) @@ -111,7 +111,7 @@ Contract.Ensures(Contract.Result(Of SlotSet)() IsNot Nothing) Return _slots End Get - Set(ByVal value As SlotSet) + Set(value As SlotSet) Contract.Requires(value IsNot Nothing) _slots = value End Set @@ -134,8 +134,8 @@ End Get End Property - Public Sub LobbyCatchRemovedPlayer(ByVal player As Player, - ByVal slot As Slot?) + Public Sub LobbyCatchRemovedPlayer(player As Player, + slot As Slot?) Contract.Requires(player IsNot Nothing) If slot Is Nothing OrElse slot.Value.Contents.PlayerIndex Is Nothing Then @@ -163,8 +163,8 @@ End Try End Function - Public Function AddFakePlayer(ByVal name As InvariantString, - Optional ByVal slot As Slot? = Nothing) As Player + Public Function AddFakePlayer(name As InvariantString, + Optional slot As Slot? = Nothing) As Player Contract.Ensures(Contract.Result(Of Player)() IsNot Nothing) If Not AcceptingPlayers Then @@ -207,7 +207,7 @@ RaiseEvent ChangedPublicState(Me) End Sub - Private Function AllocateSpaceForNewPlayer(ByVal name As InvariantString) As Tuple(Of Slot, PlayerId) + Private Function AllocateSpaceForNewPlayer(name As InvariantString) As Tuple(Of Slot, PlayerId) Contract.Ensures(Not _freeIndexes.Contains(Contract.Result(Of Tuple(Of Slot, PlayerId))().Item2)) 'Choose Slot @@ -248,9 +248,9 @@ Contract.Assume(Not _freeIndexes.Contains(r.Item2)) Return r End Function - Private Function AddPlayer(ByVal newPlayer As Player, - ByVal slot As Slot, - ByVal socketRemoteEndPoint As Net.IPEndPoint) As Player + Private Function AddPlayer(newPlayer As Player, + slot As Slot, + socketRemoteEndPoint As Net.IPEndPoint) As Player Contract.Requires(newPlayer IsNot Nothing) Contract.Requires(socketRemoteEndPoint IsNot Nothing) Contract.Requires(socketRemoteEndPoint.Address IsNot Nothing) @@ -286,8 +286,8 @@ Return newPlayer End Function - Public Function AddPlayer(ByVal knockData As Protocol.KnockData, - ByVal socket As W3Socket) As Player + Public Function AddPlayer(knockData As Protocol.KnockData, + socket As W3Socket) As Player Contract.Requires(knockData IsNot Nothing) Contract.Requires(socket IsNot Nothing) Contract.Ensures(Contract.Result(Of Player)() IsNot Nothing) @@ -303,19 +303,19 @@ Return AddPlayer(newPlayer, space.Item1, socket.RemoteEndPoint) End Function - Protected Overrides Function PerformDispose(ByVal finalizing As Boolean) As Task + Protected Overrides Function PerformDispose(finalizing As Boolean) As Task If finalizing Then Return Nothing _downloadManager.Dispose() Return Nothing End Function - Public Function IsPlayerVisible(ByVal player As Player) As Boolean + Public Function IsPlayerVisible(player As Player) As Boolean Contract.Requires(player IsNot Nothing) Return _pidVisiblityMap(player.Id) = player.Id End Function - Public Function GetVisiblePlayer(ByVal player As Player) As Player + Public Function GetVisiblePlayer(player As Player) As Player Contract.Requires(player IsNot Nothing) Contract.Ensures(Contract.Result(Of Player)() IsNot Nothing) If IsPlayerVisible(player) Then Return player @@ -324,10 +324,10 @@ Contract.Assume(visiblePlayer IsNot Nothing) Return visiblePlayer End Function - Public Shared Function SetupCoveredSlot(ByVal slots As SlotSet, - ByVal coveringSlot As Slot, - ByVal coveredSlot As Slot, - ByVal coveredPlayersId As PlayerId) As SlotSet + Public Shared Function SetupCoveredSlot(slots As SlotSet, + coveringSlot As Slot, + coveredSlot As Slot, + coveredPlayersId As PlayerId) As SlotSet Contract.Requires(slots IsNot Nothing) Contract.Requires(coveringSlot.Contents.EnumPlayers.None) Contract.Requires(coveringSlot.Contents.EnumPlayers.Count = 1) @@ -339,8 +339,8 @@ coveredSlot.With(contents:=New SlotContentsCovered(coveringSlot.MatchableId, coveredPlayersId, {}))) End Function - Public Function SendMapPiece(ByVal receiver As Download.IPlayerDownloadAspect, - ByVal position As UInt32) As Task + Public Function SendMapPiece(receiver As Download.IPlayerDownloadAspect, + position As UInt32) As Task Contract.Requires(receiver IsNot Nothing) Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) @@ -357,7 +357,7 @@ '''Returns any slot matching a string. Checks index, color and player name. - Public Function FindMatchingSlot(ByVal query As InvariantString) As Slot + Public Function FindMatchingSlot(query As InvariantString) As Slot Dim best = (From slot In _slots Let match = slot.Matches(query) Let content = slot.Contents.ContentType @@ -367,7 +367,7 @@ Return best.slot End Function - Public Sub OnPlayerSetColor(ByVal sender As Player, ByVal newColor As Protocol.PlayerColor) + Public Sub OnPlayerSetColor(sender As Player, newColor As Protocol.PlayerColor) Contract.Requires(sender IsNot Nothing) Dim trySlot = _slots.TryFindPlayerSlot(sender) If Not trySlot.HasValue Then Return @@ -392,7 +392,7 @@ _slots = _slots.WithSlotsUpdatedByIndex(slot.With(color:=newColor)) RaiseEvent ChangedPublicState(Me) End Sub - Public Sub OnPlayerSetRace(ByVal sender As Player, ByVal newRace As Protocol.Races) + Public Sub OnPlayerSetRace(sender As Player, newRace As Protocol.Races) Contract.Requires(sender IsNot Nothing) Dim trySlot = _slots.TryFindPlayerSlot(sender) If trySlot Is Nothing Then Return @@ -408,7 +408,7 @@ _slots = _slots.WithSlotsUpdatedByIndex(slot.With(race:=newRace)) RaiseEvent ChangedPublicState(Me) End Sub - Public Sub OnPlayerSetHandicap(ByVal sender As Player, ByVal newHandicap As Byte) + Public Sub OnPlayerSetHandicap(sender As Player, newHandicap As Byte) Contract.Requires(sender IsNot Nothing) Dim trySlot = _slots.TryFindPlayerSlot(sender) If trySlot Is Nothing Then Return @@ -429,7 +429,7 @@ RaiseEvent ChangedPublicState(Me) End Sub - Public Sub OnPlayerSetTeam(ByVal sender As Player, ByVal newTeam As Byte) + Public Sub OnPlayerSetTeam(sender As Player, newTeam As Byte) Contract.Requires(sender IsNot Nothing) Dim trySlot = _slots.TryFindPlayerSlot(sender) If trySlot Is Nothing Then Return @@ -480,8 +480,8 @@ End Sub '''Reserves a slot for a player. - Public Function ReserveSlot(ByVal userName As InvariantString, - Optional ByVal slotQuery As InvariantString? = Nothing) As Player + Public Function ReserveSlot(userName As InvariantString, + Optional slotQuery As InvariantString? = Nothing) As Player Contract.Ensures(Contract.Result(Of Player)() IsNot Nothing) If Not AcceptingPlayers Then Throw New InvalidOperationException("Can't reserve slots after launch.") Dim slot As Slot @@ -498,9 +498,9 @@ Return AddFakePlayer(userName, slot:=slot) End Function - Private Sub ModifySlot(ByVal slotQuery As InvariantString, - ByVal projection As Func(Of Slot, Slot), - Optional ByVal avoidPlayers As Boolean = False) + Private Sub ModifySlot(slotQuery As InvariantString, + projection As Func(Of Slot, Slot), + Optional avoidPlayers As Boolean = False) Contract.Requires(projection IsNot Nothing) If Not AcceptingPlayers Then Throw New InvalidOperationException("Can't modify slots during launch.") @@ -515,28 +515,28 @@ End Sub '''Opens the slot with the given index, unless the slot contains a player. - Public Sub OpenSlot(ByVal slotQuery As InvariantString) + Public Sub OpenSlot(slotQuery As InvariantString) ModifySlot(slotQuery, Function(slot) slot.With(contents:=New SlotContentsOpen), avoidPlayers:=True) End Sub '''Places a computer with the given difficulty in the slot with the given index, unless the slot contains a player. - Public Sub ComputerizeSlot(ByVal slotQuery As InvariantString, ByVal cpu As Protocol.ComputerLevel) + Public Sub ComputerizeSlot(slotQuery As InvariantString, cpu As Protocol.ComputerLevel) ModifySlot(slotQuery, Function(slot) slot.With(contents:=New SlotContentsComputer(cpu)), avoidPlayers:=True) End Sub '''Closes the slot with the given index, unless the slot contains a player. - Public Sub CloseSlot(ByVal slotQuery As InvariantString) + Public Sub CloseSlot(slotQuery As InvariantString) ModifySlot(slotQuery, Function(slot) slot.With(contents:=New SlotContentsClosed), avoidPlayers:=True) End Sub - Public Sub SwapSlotContents(ByVal slotQuery1 As InvariantString, - ByVal slotQuery2 As InvariantString) + Public Sub SwapSlotContents(slotQuery1 As InvariantString, + slotQuery2 As InvariantString) If Not AcceptingPlayers Then Throw New InvalidOperationException("Can't swap slots after launch.") Dim slot1 = FindMatchingSlot(slotQuery1) Dim slot2 = FindMatchingSlot(slotQuery2) @@ -544,13 +544,13 @@ SwapSlotContents(slot1, slot2) RaiseEvent ChangedPublicState(Me) End Sub - Public Sub SwapSlotContents(ByVal slot1 As Slot, ByVal slot2 As Slot) + Public Sub SwapSlotContents(slot1 As Slot, slot2 As Slot) _slots = _slots.WithSlotsUpdatedByIndex(slot1.With(contents:=slot2.Contents), slot2.With(contents:=slot1.Contents)) RaiseEvent ChangedPublicState(Me) End Sub - Public Sub SetSlotColor(ByVal slotQuery As InvariantString, ByVal color As Protocol.PlayerColor) + Public Sub SetSlotColor(slotQuery As InvariantString, color As Protocol.PlayerColor) If _settings.Map.UsesFixedPlayerSettings Then Throw New InvalidOperationException("The map says that slot's color is locked.") ElseIf Not AcceptingPlayers Then @@ -567,14 +567,14 @@ RaiseEvent ChangedPublicState(Me) End Sub - Public Sub SetSlotRace(ByVal slotQuery As InvariantString, ByVal race As Protocol.Races) + Public Sub SetSlotRace(slotQuery As InvariantString, race As Protocol.Races) ModifySlot(slotQuery, Function(slot) If Not slot.RaceUnlocked Then Throw New InvalidOperationException("The map says that slot's race is locked.") Return slot.With(race:=race) End Function) End Sub - Public Sub SetSlotTeam(ByVal slotQuery As InvariantString, ByVal team As Byte) + Public Sub SetSlotTeam(slotQuery As InvariantString, team As Byte) If _settings.Map.UsesCustomForces Then Throw New InvalidOperationException("The map says that all teams are locked.") ModifySlot(slotQuery, Function(slot) If slot.Team <> team AndAlso slot.Team = WC3.Slot.ObserverTeamIndex Then @@ -586,15 +586,15 @@ End Function) End Sub - Public Sub SetSlotHandicap(ByVal slotQuery As InvariantString, ByVal handicap As Byte) + Public Sub SetSlotHandicap(slotQuery As InvariantString, handicap As Byte) ModifySlot(slotQuery, Function(slot) slot.With(handicap:=handicap)) End Sub - Public Sub SetSlotLocked(ByVal slotQuery As InvariantString, ByVal locked As Slot.LockState) + Public Sub SetSlotLocked(slotQuery As InvariantString, locked As Slot.LockState) ModifySlot(slotQuery, Function(slot) slot.With(locked:=locked)) End Sub - Public Sub SetAllSlotsLocked(ByVal locked As Slot.LockState) + Public Sub SetAllSlotsLocked(locked As Slot.LockState) _slots = _slots.WithSlotsReplaced(From slot In _slots Select slot.With(locked:=locked)) End Sub @@ -607,7 +607,7 @@ End Function '''Opens slots, closes slots and moves players around to try to match the desired team sizes. - Public Sub TrySetTeamSizes(ByVal desiredTeamSizes As IEnumerable(Of Integer)) + Public Sub TrySetTeamSizes(desiredTeamSizes As IEnumerable(Of Integer)) Contract.Requires(desiredTeamSizes IsNot Nothing) If Not AcceptingPlayers Then Throw New InvalidOperationException("Can't change team sizes after launch.") @@ -623,9 +623,9 @@ End Sub - Public Shared Function SetupTeamSizesMeleeForces(ByVal slotSet As SlotSet, - ByVal desiredTeamSizes As IEnumerable(Of Integer), - ByVal maxNonObserverSlots As Integer) As SlotSet + Public Shared Function SetupTeamSizesMeleeForces(slotSet As SlotSet, + desiredTeamSizes As IEnumerable(Of Integer), + maxNonObserverSlots As Integer) As SlotSet Contract.Requires(slotSet IsNot Nothing) Contract.Requires(desiredTeamSizes IsNot Nothing) Contract.Requires(maxNonObserverSlots > 0) @@ -659,8 +659,8 @@ Return slotSet.WithSlotsReplaced(assignedSlots).WithSlotsReplaced(closedSlots) End Function - Public Shared Function SetupTeamSizesCustomForces(ByVal slotSet As SlotSet, - ByVal desiredTeamSizes As IEnumerable(Of Integer)) As SlotSet + Public Shared Function SetupTeamSizesCustomForces(slotSet As SlotSet, + desiredTeamSizes As IEnumerable(Of Integer)) As SlotSet Contract.Requires(slotSet IsNot Nothing) Contract.Requires(desiredTeamSizes IsNot Nothing) Contract.Ensures(Contract.Result(Of SlotSet)() IsNot Nothing) @@ -713,8 +713,8 @@ End Function '''Broadcasts a packet to all players. Requires a packer for the packet, and values matching the packer. - Public Sub BroadcastPacket(ByVal packet As Protocol.Packet, - Optional ByVal source As Player = Nothing) + Public Sub BroadcastPacket(packet As Protocol.Packet, + Optional source As Player = Nothing) Contract.Requires(packet IsNot Nothing) For Each player In From p In _kernel.Players Where p IsNot source @@ -724,9 +724,9 @@ End Sub '''Sends text to all players. Uses spoof chat if necessary. - Public Sub BroadcastMessage(ByVal message As String, - Optional ByVal playerToAvoid As Player = Nothing, - Optional ByVal messageType As LogMessageType = LogMessageType.Typical) + Public Sub BroadcastMessage(message As String, + Optional playerToAvoid As Player = Nothing, + Optional messageType As LogMessageType = LogMessageType.Typical) Contract.Requires(message IsNot Nothing) For Each player In From p In _kernel.Players Where p IsNot playerToAvoid @@ -736,9 +736,9 @@ End Sub '''Sends text to the target player. Uses spoof chat if necessary. - Public Sub SendMessageTo(ByVal message As String, - ByVal player As Player, - Optional ByVal display As Boolean = True) + Public Sub SendMessageTo(message As String, + player As Player, + Optional display As Boolean = True) Contract.Requires(message IsNot Nothing) Contract.Requires(player IsNot Nothing) diff --git a/Warcraft3/Game/Game Motor.vb b/Warcraft3/Game/Game Motor.vb index 2732adf4..68a42659 100644 --- a/Warcraft3/Game/Game Motor.vb +++ b/Warcraft3/Game/Game Motor.vb @@ -8,7 +8,7 @@ End Get End Property - Public Sub New(ByVal length As UShort, ByVal startTime As Integer) + Public Sub New(length As UShort, startTime As Integer) Me.length = length Me.startTime = startTime End Sub @@ -31,12 +31,12 @@ Private _lagClock As RelativeClock Private ReadOnly _init As New OnetimeLock - Public Event ReceivedPlayerActions(ByVal sender As GameMotor, ByVal player As Player, ByVal actions As IRist(Of Protocol.GameAction)) - Public Event Tick(ByVal sender As GameMotor, - ByVal timeSpan As UShort, - ByVal actualActionStreaks As IRist(Of IRist(Of Protocol.SpecificPlayerActionSet)), - ByVal visibleActionStreaks As IRist(Of IRist(Of Protocol.PlayerActionSet))) - Public Event RemovePlayer(ByVal sender As GameMotor, ByVal player As Player, ByVal wasExpected As Boolean, ByVal reportedReason As Protocol.PlayerLeaveReason, ByVal reasonDescription As String) + Public Event ReceivedPlayerActions(sender As GameMotor, player As Player, actions As IRist(Of Protocol.GameAction)) + Public Event Tick(sender As GameMotor, + timeSpan As UShort, + actualActionStreaks As IRist(Of IRist(Of Protocol.SpecificPlayerActionSet)), + visibleActionStreaks As IRist(Of IRist(Of Protocol.PlayerActionSet))) + Public Event RemovePlayer(sender As GameMotor, player As Player, wasExpected As Boolean, reportedReason As Protocol.PlayerLeaveReason, reasonDescription As String) Private Sub ObjectInvariant() Contract.Invariant(_laggingPlayers IsNot Nothing) @@ -50,11 +50,11 @@ Contract.Invariant(_actionsForNextTick IsNot Nothing) End Sub - Public Sub New(ByVal defaultSpeedFactor As Double, - ByVal defaultTickPeriod As TimeSpan, - ByVal defaultLagLimit As TimeSpan, - ByVal kernel As GameKernel, - ByVal lobby As GameLobby) + Public Sub New(defaultSpeedFactor As Double, + defaultTickPeriod As TimeSpan, + defaultLagLimit As TimeSpan, + kernel As GameKernel, + lobby As GameLobby) Contract.Assume(defaultSpeedFactor > 0) Contract.Assume(defaultTickPeriod.Ticks > 0) Contract.Assume(defaultLagLimit.Ticks >= 0) @@ -90,13 +90,13 @@ Public Function QueueStart() As Task Return _kernel.InQueue.QueueAction(AddressOf Start) End Function - Protected Overrides Function PerformDispose(ByVal finalizing As Boolean) As Task + Protected Overrides Function PerformDispose(finalizing As Boolean) As Task If finalizing Then Return Nothing Return _kernel.InQueue.QueueAction(Sub() _tickClock = Nothing) End Function Private _asyncWaitTriggered As Boolean - Private Sub OnReceiveGameActions(ByVal sender As Player, ByVal actions As IRist(Of Protocol.GameAction)) + Private Sub OnReceiveGameActions(sender As Player, actions As IRist(Of Protocol.GameAction)) Contract.Requires(sender IsNot Nothing) Contract.Requires(actions IsNot Nothing) _actionsForNextTick.Add(New Protocol.SpecificPlayerActionSet(sender, actions)) @@ -111,7 +111,7 @@ End Sub - Private Sub OnReceiveRequestDropLagger(ByVal sender As Player) + Private Sub OnReceiveRequestDropLagger(sender As Player) Contract.Requires(sender IsNot Nothing) For Each player In _laggingPlayers Contract.Assume(player IsNot Nothing) @@ -119,7 +119,7 @@ Next player End Sub - Private Function BroadcastPacket(ByVal packet As Protocol.Packet) As Task + Private Function BroadcastPacket(packet As Protocol.Packet) As Task Contract.Requires(packet IsNot Nothing) Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) Return (From player In _kernel.Players Select player.QueueSendPacket(packet)).AsAggregateTask @@ -185,9 +185,9 @@ End Sub - Private Function SplitSequenceByDataSize(Of TValue)(ByVal sequence As IEnumerable(Of TValue), - ByVal measure As Func(Of TValue, Int32), - ByVal maxDataSize As Int32) As IRist(Of IRist(Of TValue)) + Private Function SplitSequenceByDataSize(Of TValue)(sequence As IEnumerable(Of TValue), + measure As Func(Of TValue, Int32), + maxDataSize As Int32) As IRist(Of IRist(Of TValue)) Contract.Requires(sequence IsNot Nothing) Contract.Requires(maxDataSize > 0) Contract.Requires(measure IsNot Nothing) @@ -215,7 +215,7 @@ Select subSequence.ToRist ).ToRist End Function - Private Sub SendQueuedGameData(ByVal record As TickRecord) + Private Sub SendQueuedGameData(record As TickRecord) Contract.Requires(record IsNot Nothing) 'Include all the data we can fit in a packet Dim totalDataLength = 0 @@ -256,17 +256,17 @@ Return _kernel.InQueue.QueueFunc(Function() _lagLimit) End Function - Public Function QueueSetTickPeriod(ByVal value As TimeSpan) As Task + Public Function QueueSetTickPeriod(value As TimeSpan) As Task Contract.Requires(value.Ticks > 0) Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) Return _kernel.InQueue.QueueAction(Sub() _tickPeriod = value) End Function - Public Function QueueSetSpeedFactor(ByVal value As Double) As Task + Public Function QueueSetSpeedFactor(value As Double) As Task Contract.Requires(value > 0) Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) Return _kernel.InQueue.QueueAction(Sub() _speedFactor = value) End Function - Public Function QueueSetLagLimit(ByVal value As TimeSpan) As Task + Public Function QueueSetLagLimit(value As TimeSpan) As Task Contract.Requires(value.Ticks >= 0) Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) Return _kernel.InQueue.QueueAction(Sub() _lagLimit = value) diff --git a/Warcraft3/Game/GameLoggerControl.vb b/Warcraft3/Game/GameLoggerControl.vb index 0d2cbc29..6d49a06b 100644 --- a/Warcraft3/Game/GameLoggerControl.vb +++ b/Warcraft3/Game/GameLoggerControl.vb @@ -6,7 +6,7 @@ Namespace WC3 Public Class GameLoggerControl Private WithEvents game As WC3.Game Private actionMode As CallbackMode = CallbackMode.Off - Public Sub SetGame(ByVal game As WC3.Game) + Public Sub SetGame(game As WC3.Game) SyncLock lock If Me.game Is game Then Return Me.game = game @@ -24,9 +24,9 @@ Namespace WC3 End Select End Sub - Private Sub OnPlayerAction(ByVal sender As WC3.Game, - ByVal player As WC3.Player, - ByVal actions As IRist(Of WC3.Protocol.GameAction)) Handles game.ReceivedPlayerActions + Private Sub OnPlayerAction(sender As WC3.Game, + player As WC3.Player, + actions As IRist(Of WC3.Protocol.GameAction)) Handles game.ReceivedPlayerActions Dim mode = actionMode If mode = CallbackMode.Off Then Return For Each action In actions diff --git a/Warcraft3/Game/W3Game.vb b/Warcraft3/Game/W3Game.vb index b9bab8dd..607dc42f 100644 --- a/Warcraft3/Game/W3Game.vb +++ b/Warcraft3/Game/W3Game.vb @@ -39,28 +39,28 @@ Namespace WC3 Private _adminPlayer As Player Private _flagHasPlayerLeft As Boolean - Public Event Tick(ByVal sender As Game, - ByVal timeSpan As UShort, - ByVal actualActionStreaks As IRist(Of IRist(Of Protocol.SpecificPlayerActionSet)), - ByVal visibleActionStreaks As IRist(Of IRist(Of Protocol.PlayerActionSet))) - Public Event Updated(ByVal sender As Game, - ByVal slots As SlotSet) - Public Event PlayerLeft(ByVal sender As Game, - ByVal state As GameState, - ByVal leaver As Player, - ByVal reportedReason As Protocol.PlayerLeaveReason, - ByVal reasonDescription As String) - Public Event ChangedState(ByVal sender As Game, - ByVal oldState As GameState, - ByVal newState As GameState) - Public Event PlayerTalked(ByVal sender As Game, - ByVal speaker As Player, - ByVal text As String, - ByVal receivingGroup As Protocol.ChatGroup?) - Public Event RecordGameStarted(ByVal sender As Game) - Public Event ReceivedPlayerActions(ByVal sender As Game, - ByVal player As Player, - ByVal actions As IRist(Of Protocol.GameAction)) + Public Event Tick(sender As Game, + timeSpan As UShort, + actualActionStreaks As IRist(Of IRist(Of Protocol.SpecificPlayerActionSet)), + visibleActionStreaks As IRist(Of IRist(Of Protocol.PlayerActionSet))) + Public Event Updated(sender As Game, + slots As SlotSet) + Public Event PlayerLeft(sender As Game, + state As GameState, + leaver As Player, + reportedReason As Protocol.PlayerLeaveReason, + reasonDescription As String) + Public Event ChangedState(sender As Game, + oldState As GameState, + newState As GameState) + Public Event PlayerTalked(sender As Game, + speaker As Player, + text As String, + receivingGroup As Protocol.ChatGroup?) + Public Event RecordGameStarted(sender As Game) + Public Event ReceivedPlayerActions(sender As Game, + player As Player, + actions As IRist(Of Protocol.GameAction)) Private Sub ObjectInvariant() Contract.Invariant(_kernel IsNot Nothing) @@ -73,12 +73,12 @@ Namespace WC3 Contract.Invariant(_slotStateUpdateThrottle IsNot Nothing) End Sub - Public Sub New(ByVal name As InvariantString, - ByVal settings As GameSettings, - ByVal lobby As GameLobby, - ByVal motor As GameMotor, - ByVal loadScreen As GameLoadScreen, - ByVal kernel As GameKernel) + Public Sub New(name As InvariantString, + settings As GameSettings, + lobby As GameLobby, + motor As GameMotor, + loadScreen As GameLoadScreen, + kernel As GameKernel) Contract.Assume(settings IsNot Nothing) Contract.Assume(lobby IsNot Nothing) Contract.Assume(motor IsNot Nothing) @@ -92,10 +92,10 @@ Namespace WC3 Me._loadScreen = loadScreen End Sub - Public Shared Function FromSettings(ByVal settings As GameSettings, - ByVal name As InvariantString, - ByVal clock As IClock, - ByVal logger As Logger) As Game + Public Shared Function FromSettings(settings As GameSettings, + name As InvariantString, + clock As IClock, + logger As Logger) As Game Contract.Requires(clock IsNot Nothing) Contract.Requires(settings IsNot Nothing) Contract.Requires(logger IsNot Nothing) @@ -199,7 +199,7 @@ Namespace WC3 AddHandler _motor.ReceivedPlayerActions, Sub(sender, player, actions) _kernel.OutQueue.QueueAction(Sub() RaiseEvent ReceivedPlayerActions(Me, player, actions)) End Sub - Protected Overrides Function PerformDispose(ByVal finalizing As Boolean) As Task + Protected Overrides Function PerformDispose(finalizing As Boolean) As Task If finalizing Then Return Nothing Return _kernel.OutQueue.QueueAction(Sub() _kernel.InQueue.QueueAction( Sub() @@ -245,9 +245,9 @@ Namespace WC3 Return _kernel.InQueue.QueueAction(AddressOf ThrowUpdated) End Function - Private Function CommandProcessText(ByVal manager As GameManager, - ByVal player As Player, - ByVal argument As String) As Task(Of String) + Private Function CommandProcessText(manager As GameManager, + player As Player, + argument As String) As Task(Of String) Contract.Requires(manager IsNot Nothing) Contract.Requires(argument IsNot Nothing) @@ -275,9 +275,9 @@ Namespace WC3 Dim user = If(player Is Nothing, Nothing, New BotUser(player.Name)) Return commands.Invoke(manager, user, argument) End Function - Public Function QueueCommandProcessText(ByVal manager As GameManager, - ByVal player As Player, - ByVal argument As String) As Task(Of String) + Public Function QueueCommandProcessText(manager As GameManager, + player As Player, + argument As String) As Task(Of String) Contract.Requires(manager IsNot Nothing) Contract.Requires(argument IsNot Nothing) Contract.Ensures(Contract.Result(Of Task(Of String))() IsNot Nothing) @@ -301,24 +301,24 @@ Namespace WC3 Return _kernel.InQueue.QueueFunc(Function() _kernel.State) End Function - Public Function QueueBroadcastMessage(ByVal message As String) As Task + Public Function QueueBroadcastMessage(message As String) As Task Contract.Requires(message IsNot Nothing) Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) Return _kernel.InQueue.QueueAction(Sub() _lobby.BroadcastMessage(message)) End Function - Public Function QueueSendMessageTo(ByVal message As String, ByVal player As Player) As Task + Public Function QueueSendMessageTo(message As String, player As Player) As Task Contract.Requires(message IsNot Nothing) Contract.Requires(player IsNot Nothing) Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) Return _kernel.InQueue.QueueAction(Sub() _lobby.SendMessageTo(message, player)) End Function - Private Sub OnReceiveChat(ByVal sender As Player, - ByVal text As String, - ByVal type As Protocol.ChatType, - ByVal receivingGroup As Protocol.ChatGroup?, - ByVal requestedReceivers As IRist(Of PlayerId)) + Private Sub OnReceiveChat(sender As Player, + text As String, + type As Protocol.ChatType, + receivingGroup As Protocol.ChatGroup?, + requestedReceivers As IRist(Of PlayerId)) Contract.Requires(sender IsNot Nothing) Contract.Requires(text IsNot Nothing) Contract.Requires(requestedReceivers IsNot Nothing) @@ -346,7 +346,7 @@ Namespace WC3 End If Next receiver End Sub - Private Sub OnReceiveNonGameAction(ByVal sender As Player, ByVal vals As NamedValueMap) + Private Sub OnReceiveNonGameAction(sender As Player, vals As NamedValueMap) Contract.Requires(sender IsNot Nothing) Contract.Requires(vals IsNot Nothing) @@ -388,10 +388,10 @@ Namespace WC3 #Region "Players" '''Removes the given player from the instance - Private Sub RemovePlayer(ByVal player As Player, - ByVal wasExpected As Boolean, - ByVal reportedReason As Protocol.PlayerLeaveReason, - ByVal reasonDescription As String) + Private Sub RemovePlayer(player As Player, + wasExpected As Boolean, + reportedReason As Protocol.PlayerLeaveReason, + reasonDescription As String) Contract.Requires(player IsNot Nothing) Contract.Requires(reasonDescription IsNot Nothing) If Not _kernel.Players.Contains(player) Then @@ -445,8 +445,8 @@ Namespace WC3 End If End Sub - Private Sub ElevatePlayer(ByVal name As InvariantString, - Optional ByVal password As String = Nothing) + Private Sub ElevatePlayer(name As InvariantString, + Optional password As String = Nothing) Dim player = TryFindPlayer(name) If player Is Nothing Then Throw New InvalidOperationException("No player found with the name '{0}'.".Frmt(name)) If _adminPlayer IsNot Nothing Then Throw New InvalidOperationException("A player is already the admin.") @@ -461,25 +461,25 @@ Namespace WC3 _adminPlayer = player _lobby.SendMessageTo("You are now the admin.", player) End Sub - Public Function QueueElevatePlayer(ByVal name As InvariantString, - Optional ByVal password As String = Nothing) As Task + Public Function QueueElevatePlayer(name As InvariantString, + Optional password As String = Nothing) As Task Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) Return _kernel.InQueue.QueueAction(Sub() ElevatePlayer(name, password)) End Function - Private Function TryFindPlayer(ByVal id As PlayerId) As Player + Private Function TryFindPlayer(id As PlayerId) As Player Return (From player In _kernel.Players Where player.Id = id).FirstOrDefault End Function - Private Function TryFindPlayer(ByVal userName As InvariantString) As Player + Private Function TryFindPlayer(userName As InvariantString) As Player Return (From player In _kernel.Players Where player.Name = userName).FirstOrDefault End Function - Public Function QueueTryFindPlayer(ByVal userName As InvariantString) As Task(Of Player) + Public Function QueueTryFindPlayer(userName As InvariantString) As Task(Of Player) Contract.Ensures(Contract.Result(Of Task(Of Player))() IsNot Nothing) Return _kernel.InQueue.QueueFunc(Function() TryFindPlayer(userName)) End Function '''Boots players in the slot with the given index. - Private Sub Boot(ByVal slotQuery As InvariantString, ByVal shouldCloseEmptiedSlot As Boolean) + Private Sub Boot(slotQuery As InvariantString, shouldCloseEmptiedSlot As Boolean) Dim slot = _lobby.FindMatchingSlot(slotQuery) If Not slot.Contents.EnumPlayers.Any Then Throw New InvalidOperationException("There is no player to boot in slot '{0}'.".Frmt(slotQuery)) @@ -502,14 +502,14 @@ Namespace WC3 _lobby.ThrowChangedPublicState() End If End Sub - Public Function QueueBoot(ByVal slotQuery As InvariantString, ByVal shouldCloseEmptiedSlot As Boolean) As Task + Public Function QueueBoot(slotQuery As InvariantString, shouldCloseEmptiedSlot As Boolean) As Task Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) Return _kernel.InQueue.QueueAction(Sub() Boot(slotQuery, shouldCloseEmptiedSlot)) End Function #End Region - Public Function ObservePlayers(ByVal adder As Action(Of Player), - ByVal remover As Action(Of Player)) As Task(Of IDisposable) + Public Function ObservePlayers(adder As Action(Of Player), + remover As Action(Of Player)) As Task(Of IDisposable) Contract.Requires(adder IsNot Nothing) Contract.Requires(remover IsNot Nothing) Contract.Ensures(Contract.Result(Of Task(Of IDisposable))() IsNot Nothing) @@ -612,7 +612,7 @@ Namespace WC3 #End Region #Region "Lobby" - Private Sub SetPlayerVoteToStart(ByVal name As InvariantString, ByVal val As Boolean) + Private Sub SetPlayerVoteToStart(name As InvariantString, val As Boolean) If Not Settings.IsAutoStarted Then Throw New InvalidOperationException("Game is not set to start automatically.") Dim p = TryFindPlayer(name) If p Is Nothing Then Throw New InvalidOperationException("No player found with the name '{0}'.".Frmt(name)) @@ -625,8 +625,8 @@ Namespace WC3 TryStartCountdown() End If End Sub - Public Function QueueSetPlayerVoteToStart(ByVal name As InvariantString, - ByVal wantsToStart As Boolean) As Task + Public Function QueueSetPlayerVoteToStart(name As InvariantString, + wantsToStart As Boolean) As Task Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) Return _kernel.InQueue.QueueAction(Sub() SetPlayerVoteToStart(name, wantsToStart)) End Function @@ -636,20 +636,20 @@ Namespace WC3 Return _lobby.StartPlayerHoldPoint End Get End Property - Public Function QueueAddPlayer(ByVal knockData As Protocol.KnockData, - ByVal socket As W3Socket) As Task(Of Player) + Public Function QueueAddPlayer(knockData As Protocol.KnockData, + socket As W3Socket) As Task(Of Player) Contract.Requires(knockData IsNot Nothing) Contract.Requires(socket IsNot Nothing) Contract.Ensures(Contract.Result(Of Task(Of Player))() IsNot Nothing) Return _kernel.InQueue.QueueFunc(Function() _lobby.AddPlayer(knockData, socket)) End Function - Public Function QueueSendMapPiece(ByVal player As Download.IPlayerDownloadAspect, - ByVal position As UInt32) As Task + Public Function QueueSendMapPiece(player As Download.IPlayerDownloadAspect, + position As UInt32) As Task Return _kernel.InQueue.QueueFunc(Function() _lobby.SendMapPiece(player, position)).Unwrap End Function '''Broadcasts new game state to players, and throws the updated event. - Private Sub SendLobbyState(ByVal randomSeed As UInt32) + Private Sub SendLobbyState(randomSeed As UInt32) If _kernel.State >= GameState.Loading Then Return For Each player In _kernel.Players @@ -663,55 +663,55 @@ Namespace WC3 TryBeginAutoStart() End Sub - Public Function QueueTrySetTeamSizes(ByVal sizes As IRist(Of Integer)) As Task + Public Function QueueTrySetTeamSizes(sizes As IRist(Of Integer)) As Task Contract.Requires(sizes IsNot Nothing) Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) Return _kernel.InQueue.QueueAction(Sub() _lobby.TrySetTeamSizes(sizes)) End Function - Public Function QueueOpenSlot(ByVal slotQuery As InvariantString) As Task + Public Function QueueOpenSlot(slotQuery As InvariantString) As Task Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) Return _kernel.InQueue.QueueAction(Sub() _lobby.OpenSlot(slotQuery)) End Function - Public Function QueueSetSlotCpu(ByVal slotQuery As InvariantString, ByVal newCpuLevel As Protocol.ComputerLevel) As Task + Public Function QueueSetSlotCpu(slotQuery As InvariantString, newCpuLevel As Protocol.ComputerLevel) As Task Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) Return _kernel.InQueue.QueueAction(Sub() _lobby.ComputerizeSlot(slotQuery, newCpuLevel)) End Function - Public Function QueueCloseSlot(ByVal slotQuery As InvariantString) As Task + Public Function QueueCloseSlot(slotQuery As InvariantString) As Task Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) Return _kernel.InQueue.QueueAction(Sub() _lobby.CloseSlot(slotQuery)) End Function - Public Function QueueReserveSlot(ByVal userName As InvariantString, - Optional ByVal slotQuery As InvariantString? = Nothing) As Task + Public Function QueueReserveSlot(userName As InvariantString, + Optional slotQuery As InvariantString? = Nothing) As Task Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) Return _kernel.InQueue.QueueAction(Sub() _lobby.ReserveSlot(userName, slotQuery)) End Function - Public Function QueueSwapSlotContents(ByVal slotQuery1 As InvariantString, - ByVal slotQuery2 As InvariantString) As Task + Public Function QueueSwapSlotContents(slotQuery1 As InvariantString, + slotQuery2 As InvariantString) As Task Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) Return _kernel.InQueue.QueueAction(Sub() _lobby.SwapSlotContents(slotQuery1, slotQuery2)) End Function - Public Function QueueSetSlotColor(ByVal slotQuery As InvariantString, ByVal newColor As Protocol.PlayerColor) As Task + Public Function QueueSetSlotColor(slotQuery As InvariantString, newColor As Protocol.PlayerColor) As Task Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) Return _kernel.InQueue.QueueAction(Sub() _lobby.SetSlotColor(slotQuery, newColor)) End Function - Public Function QueueSetSlotRace(ByVal slotQuery As InvariantString, ByVal newRace As Protocol.Races) As Task + Public Function QueueSetSlotRace(slotQuery As InvariantString, newRace As Protocol.Races) As Task Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) Return _kernel.InQueue.QueueAction(Sub() _lobby.SetSlotRace(slotQuery, newRace)) End Function - Public Function QueueSetSlotTeam(ByVal slotQuery As InvariantString, ByVal newTeam As Byte) As Task + Public Function QueueSetSlotTeam(slotQuery As InvariantString, newTeam As Byte) As Task Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) Return _kernel.InQueue.QueueAction(Sub() _lobby.SetSlotTeam(slotQuery, newTeam)) End Function - Public Function QueueSetSlotHandicap(ByVal slotQuery As InvariantString, ByVal newHandicap As Byte) As Task + Public Function QueueSetSlotHandicap(slotQuery As InvariantString, newHandicap As Byte) As Task Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) Return _kernel.InQueue.QueueAction(Sub() _lobby.SetSlotHandicap(slotQuery, newHandicap)) End Function - Public Function QueueSetSlotLocked(ByVal slotQuery As InvariantString, ByVal newLockState As Slot.LockState) As Task + Public Function QueueSetSlotLocked(slotQuery As InvariantString, newLockState As Slot.LockState) As Task Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) Return _kernel.InQueue.QueueAction(Sub() _lobby.SetSlotLocked(slotQuery, newLockState)) End Function - Public Function QueueSetAllSlotsLocked(ByVal newLockState As Slot.LockState) As Task + Public Function QueueSetAllSlotsLocked(newLockState As Slot.LockState) As Task Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) Return _kernel.InQueue.QueueAction(Sub() _lobby.SetAllSlotsLocked(newLockState)) End Function diff --git a/Warcraft3/Game/W3GameControl.vb b/Warcraft3/Game/W3GameControl.vb index c4208c07..3ad3844b 100644 --- a/Warcraft3/Game/W3GameControl.vb +++ b/Warcraft3/Game/W3GameControl.vb @@ -20,12 +20,12 @@ Namespace WC3 hook.Dispose() Next hook End Sub - Private Sub OnCommand(ByVal sender As CommandControl, ByVal argument As String) Handles comGame.IssuedCommand + Private Sub OnCommand(sender As CommandControl, argument As String) Handles comGame.IssuedCommand Contract.Requires(argument IsNot Nothing) Tinker.Components.UIInvokeCommand(_manager, argument) End Sub - Public Sub New(ByVal manager As WC3.GameManager) + Public Sub New(manager As WC3.GameManager) Contract.Assert(manager IsNot Nothing) InitializeComponent() @@ -39,7 +39,7 @@ Namespace WC3 _game.QueueThrowUpdated() End Sub - Private Sub txtInput_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtInput.KeyPress + Private Sub txtInput_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles txtInput.KeyPress If e.KeyChar <> Microsoft.VisualBasic.ChrW(Keys.Enter) Then Return If txtInput.Text = "" Then Return _game.QueueBroadcastMessage(txtInput.Text) @@ -47,7 +47,7 @@ Namespace WC3 e.Handled = True End Sub - Private Sub OnGameUpdated(ByVal sender As WC3.Game, ByVal slots As SlotSet) + Private Sub OnGameUpdated(sender As WC3.Game, slots As SlotSet) Contract.Requires(sender IsNot Nothing) Contract.Requires(slots IsNot Nothing) Dim descriptions = (From slot In slots Select slot.AsyncGenerateDescription).ToArray diff --git a/Warcraft3/Game/WC3GameManager.vb b/Warcraft3/Game/WC3GameManager.vb index 0bf3650e..238ab572 100644 --- a/Warcraft3/Game/WC3GameManager.vb +++ b/Warcraft3/Game/WC3GameManager.vb @@ -19,9 +19,9 @@ Namespace WC3 Contract.Invariant(_control IsNot Nothing) End Sub - Public Sub New(ByVal name As InvariantString, - ByVal bot As Bot.MainBot, - ByVal game As WC3.Game) + Public Sub New(name As InvariantString, + bot As Bot.MainBot, + game As WC3.Game) Contract.Requires(bot IsNot Nothing) Contract.Requires(game IsNot Nothing) @@ -35,7 +35,7 @@ Namespace WC3 game.ChainEventualDisposalTo(Me) End Sub - Private Async Sub HandleText(ByVal player As WC3.Player, ByVal text As String) + Private Async Sub HandleText(player As WC3.Player, text As String) Contract.Assume(player IsNot Nothing) Contract.Assume(text IsNot Nothing) @@ -99,7 +99,7 @@ Namespace WC3 Return True End Get End Property - Public Function IsArgumentPrivate(ByVal argument As String) As Boolean Implements IBotComponent.IsArgumentPrivate + Public Function IsArgumentPrivate(argument As String) As Boolean Implements IBotComponent.IsArgumentPrivate Return False End Function Public ReadOnly Property Control As Control Implements IBotComponent.Control @@ -108,17 +108,17 @@ Namespace WC3 End Get End Property - Public Function InvokeCommand(ByVal user As BotUser, ByVal argument As String) As Task(Of String) Implements IBotComponent.InvokeCommand + Public Function InvokeCommand(user As BotUser, argument As String) As Task(Of String) Implements IBotComponent.InvokeCommand Return Game.QueueCommandProcessText(Me, Nothing, argument) End Function - Protected Overrides Function PerformDispose(ByVal finalizing As Boolean) As Task + Protected Overrides Function PerformDispose(finalizing As Boolean) As Task _game.Dispose() _control.DisposeControlAsync() Return _hooks.DisposeAllAsync() End Function - Private Function IncludeCommandImpl(ByVal command As ICommand(Of IBotComponent)) As Task(Of IDisposable) Implements IBotComponent.IncludeCommand + Private Function IncludeCommandImpl(command As ICommand(Of IBotComponent)) As Task(Of IDisposable) Implements IBotComponent.IncludeCommand Throw New NotImplementedException("Game commands are admin/lobby/loading/etc specific.") End Function End Class diff --git a/Warcraft3/Pinger.vb b/Warcraft3/Pinger.vb index 9edbe2eb..2b27cd37 100644 --- a/Warcraft3/Pinger.vb +++ b/Warcraft3/Pinger.vb @@ -9,8 +9,8 @@ Private ReadOnly _clock As IClock Private ReadOnly _ticker As IDisposable - Public Event SendPing(ByVal sender As Pinger, ByVal salt As UInteger) - Public Event Timeout(ByVal sender As Pinger) + Public Event SendPing(sender As Pinger, salt As UInteger) + Public Event Timeout(sender As Pinger) Private Sub ObjectInvariant() @@ -23,7 +23,7 @@ Contract.Invariant(_timeoutCount > 0) End Sub - Public Sub New(ByVal period As TimeSpan, ByVal timeoutCount As Integer, ByVal clock As IClock) + Public Sub New(period As TimeSpan, timeoutCount As Integer, clock As IClock) Contract.Assume(period.Ticks > 0) Contract.Assume(timeoutCount > 0) Contract.Assume(clock IsNot Nothing) @@ -47,7 +47,7 @@ End If End Sub - Private Sub ReceivedPong(ByVal salt As UInteger) + Private Sub ReceivedPong(salt As UInteger) If _pingQueue.Count <= 0 Then Throw New InvalidOperationException("Pong received before ping sent.") End If @@ -65,7 +65,7 @@ _latency += lambda * stored.Item2.ElapsedTime.TotalMilliseconds If _latency <= 0 Then _latency = Double.Epsilon End Sub - Public Function QueueReceivedPong(ByVal salt As UInteger) As Task + Public Function QueueReceivedPong(salt As UInteger) As Task Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) Return inQueue.QueueAction(Sub() ReceivedPong(salt)) End Function diff --git a/Warcraft3/Player/PlayerId.vb b/Warcraft3/Player/PlayerId.vb index 59e6c4f7..f2241b97 100644 --- a/Warcraft3/Player/PlayerId.vb +++ b/Warcraft3/Player/PlayerId.vb @@ -14,7 +14,7 @@ Namespace WC3 End Sub - Public Sub New(ByVal index As Byte) + Public Sub New(index As Byte) Contract.Requires(index > 0) Contract.Requires(index <= 12) Me._index = index - CByte(1) @@ -28,21 +28,21 @@ Namespace WC3 End Get End Property - Public Shared Operator =(ByVal value1 As PlayerId, ByVal value2 As PlayerId) As Boolean + Public Shared Operator =(value1 As PlayerId, value2 As PlayerId) As Boolean Return value1._index = value2._index End Operator - Public Shared Operator <>(ByVal value1 As PlayerId, ByVal value2 As PlayerId) As Boolean + Public Shared Operator <>(value1 As PlayerId, value2 As PlayerId) As Boolean Return Not value1 = value2 End Operator Public Overrides Function GetHashCode() As Integer Return _index.GetHashCode End Function - Public Overrides Function Equals(ByVal obj As Object) As Boolean + Public Overrides Function Equals(obj As Object) As Boolean If Not TypeOf obj Is PlayerId Then Return False Return Me = DirectCast(obj, PlayerId) End Function - Public Overloads Function Equals(ByVal other As PlayerId) As Boolean Implements IEquatable(Of PlayerId).Equals + Public Overloads Function Equals(other As PlayerId) As Boolean Implements IEquatable(Of PlayerId).Equals Return Me = other End Function @@ -54,17 +54,17 @@ Namespace WC3 Public Class PlayerIdJar Inherits BaseJar(Of PlayerId) - Public Overrides Function Pack(ByVal value As PlayerId) As IRist(Of Byte) + Public Overrides Function Pack(value As PlayerId) As IRist(Of Byte) Return MakeRist(value.Index) End Function - Public Overrides Function Parse(ByVal data As IRist(Of Byte)) As ParsedValue(Of PlayerId) + Public Overrides Function Parse(data As IRist(Of Byte)) As ParsedValue(Of PlayerId) If data.Count < 1 Then Throw New PicklingNotEnoughDataException("A PlayerId requires 1 byte.") If data.First < 1 OrElse data.First > 12 Then Throw New PicklingException("Invalid player id: {0}".Frmt(data.First)) Return New PlayerId(data.First).ParsedWithDataCount(1) End Function - Public Overrides Function Parse(ByVal text As String) As PlayerId + Public Overrides Function Parse(text As String) As PlayerId Dim index As Byte If text.StartsWith("pid", StringComparison.Ordinal) Then index = Byte.Parse(text.Substring(3), NumberStyles.Integer, CultureInfo.InvariantCulture) diff --git a/Warcraft3/Player/W3Player.vb b/Warcraft3/Player/W3Player.vb index ef843281..f8b2414f 100644 --- a/Warcraft3/Player/W3Player.vb +++ b/Warcraft3/Player/W3Player.vb @@ -45,9 +45,9 @@ Namespace WC3 Public Property HasVotedToStart As Boolean Public Property AdminAttemptCount As Integer - Public Event SuperficialStateUpdated(ByVal sender As Player) - Public Event StateUpdated(ByVal sender As Player) - Public Event Disconnected(ByVal sender As Player, ByVal expected As Boolean, ByVal reportedReason As Protocol.PlayerLeaveReason, ByVal reasonDescription As String) + Public Event SuperficialStateUpdated(sender As Player) + Public Event StateUpdated(sender As Player) + Public Event Disconnected(sender As Player, expected As Boolean, reportedReason As Protocol.PlayerLeaveReason, reasonDescription As String) Private Sub ObjectInvariant() Contract.Invariant(_logger IsNot Nothing) @@ -68,21 +68,21 @@ Namespace WC3 Contract.Invariant(_numPeerConnections <= 12) End Sub - Public Sub New(ByVal id As PlayerId, - ByVal name As InvariantString, - ByVal isFake As Boolean, - ByVal logger As Logger, - ByVal peerKey As UInt32, - ByVal peerData As IRist(Of Byte), - ByVal packetHandlerLogger As PacketHandlerLogger(Of Protocol.PacketId), - ByVal listenEndPoint As Net.IPEndPoint, - ByVal taskTestCanHost As Task, - Optional ByVal pinger As Pinger = Nothing, - Optional ByVal socket As W3Socket = Nothing, - Optional ByVal initialState As PlayerState = PlayerState.Lobby, - Optional ByVal downloadManager As Download.Manager = Nothing, - Optional ByVal inQueue As CallQueue = Nothing, - Optional ByVal outQueue As CallQueue = Nothing) + Public Sub New(id As PlayerId, + name As InvariantString, + isFake As Boolean, + logger As Logger, + peerKey As UInt32, + peerData As IRist(Of Byte), + packetHandlerLogger As PacketHandlerLogger(Of Protocol.PacketId), + listenEndPoint As Net.IPEndPoint, + taskTestCanHost As Task, + Optional pinger As Pinger = Nothing, + Optional socket As W3Socket = Nothing, + Optional initialState As PlayerState = PlayerState.Lobby, + Optional downloadManager As Download.Manager = Nothing, + Optional inQueue As CallQueue = Nothing, + Optional outQueue As CallQueue = Nothing) Contract.Requires(packetHandlerLogger IsNot Nothing) Contract.Requires(peerData IsNot Nothing) Contract.Requires(listenEndPoint IsNot Nothing) @@ -108,9 +108,9 @@ Namespace WC3 Me._outQueue = If(outQueue, MakeTaskedCallQueue) End Sub - Public Shared Function MakeFake(ByVal id As PlayerId, - ByVal name As InvariantString, - ByVal logger As Logger) As Player + Public Shared Function MakeFake(id As PlayerId, + name As InvariantString, + logger As Logger) As Player Contract.Requires(logger IsNot Nothing) Contract.Ensures(Contract.Result(Of Player)() IsNot Nothing) @@ -132,12 +132,12 @@ Namespace WC3 Return player End Function - Public Shared Function MakeRemote(ByVal id As PlayerId, - ByVal knockData As Protocol.KnockData, - ByVal socket As W3Socket, - ByVal clock As IClock, - ByVal downloadManager As Download.Manager, - ByVal logger As Logger) As Player + Public Shared Function MakeRemote(id As PlayerId, + knockData As Protocol.KnockData, + socket As W3Socket, + clock As IClock, + downloadManager As Download.Manager, + logger As Logger) As Player Contract.Requires(knockData IsNot Nothing) Contract.Requires(socket IsNot Nothing) Contract.Requires(clock IsNot Nothing) @@ -293,12 +293,12 @@ Namespace WC3 contextInfo End Function - Private Function TryAddPacketLogger(ByVal packetDefinition As Protocol.Packets.Definition) As IDisposable + Private Function TryAddPacketLogger(packetDefinition As Protocol.Packets.Definition) As IDisposable Contract.Requires(packetDefinition IsNot Nothing) Return _packetHandlerLogger.TryIncludeLogger(packetDefinition.Id, packetDefinition.Jar) End Function - Private Function AddQueuedLocalPacketHandler(Of T)(ByVal packetDefinition As Protocol.Packets.Definition(Of T), - ByVal handler As Action(Of T)) As IDisposable + Private Function AddQueuedLocalPacketHandler(Of T)(packetDefinition As Protocol.Packets.Definition(Of T), + handler As Action(Of T)) As IDisposable Contract.Requires(packetDefinition IsNot Nothing) Contract.Requires(handler IsNot Nothing) Contract.Ensures(Contract.Result(Of IDisposable)() IsNot Nothing) @@ -307,8 +307,8 @@ Namespace WC3 packetDefinition.Jar, Function(pickle) _inQueue.QueueAction(Sub() handler(pickle.Value))) End Function - Private Function AddRemotePacketHandler(Of T)(ByVal packetDefinition As Protocol.Packets.Definition(Of T), - ByVal handler As Func(Of T, Task)) As IDisposable + Private Function AddRemotePacketHandler(Of T)(packetDefinition As Protocol.Packets.Definition(Of T), + handler As Func(Of T, Task)) As IDisposable Contract.Requires(packetDefinition IsNot Nothing) Contract.Requires(handler IsNot Nothing) Contract.Ensures(Contract.Result(Of IDisposable)() IsNot Nothing) @@ -317,33 +317,33 @@ Namespace WC3 packetDefinition.Jar, Function(pickle) handler(pickle.Value)) End Function - Public Function QueueAddPacketHandler(Of T)(ByVal packetDefinition As Protocol.Packets.Definition(Of T), - ByVal handler As Func(Of T, Task)) As Task(Of IDisposable) _ + Public Function QueueAddPacketHandler(Of T)(packetDefinition As Protocol.Packets.Definition(Of T), + handler As Func(Of T, Task)) As Task(Of IDisposable) _ Implements Download.IPlayerDownloadAspect.QueueAddPacketHandler Return _inQueue.QueueFunc(Function() AddRemotePacketHandler(packetDefinition, handler)) End Function - Private Sub OnReceivePong(ByVal salt As UInt32) + Private Sub OnReceivePong(salt As UInt32) _outQueue.QueueAction(Sub() RaiseEvent SuperficialStateUpdated(Me)) End Sub - Private Sub OnReceivePeerConnectionInfo(ByVal flags As UInt16) + Private Sub OnReceivePeerConnectionInfo(flags As UInt16) _numPeerConnections = (From i In 12.Range Where flags.HasBitSet(i)).Count Contract.Assume(_numPeerConnections <= 12) RaiseEvent SuperficialStateUpdated(Me) End Sub - Private Sub OnReceiveClientMapInfo(ByVal vals As NamedValueMap) + Private Sub OnReceiveClientMapInfo(vals As NamedValueMap) Contract.Requires(vals IsNot Nothing) _reportedDownloadPosition = vals.ItemAs(Of UInt32)("total downloaded") _outQueue.QueueAction(Sub() RaiseEvent StateUpdated(Me)) End Sub - Private Sub OnReceiveReady(ByVal value As NoValue) + Private Sub OnReceiveReady(value As NoValue) _ready = True _logger.Log("{0} is ready".Frmt(Name), LogMessageType.Positive) End Sub - Private Sub OnReceiveLeaving(ByVal leaveType As Protocol.PlayerLeaveReason) + Private Sub OnReceiveLeaving(leaveType As Protocol.PlayerLeaveReason) Disconnect(True, leaveType, "Controlled exit with reported result: {0}".Frmt(leaveType)) End Sub - Private Sub OnReceiveTock(ByVal vals As NamedValueMap) + Private Sub OnReceiveTock(vals As NamedValueMap) Contract.Requires(vals IsNot Nothing) If _tickQueue.Count <= 0 Then _logger.Log("Banned behavior: {0} responded to a tick which wasn't sent.".Frmt(Name), LogMessageType.Problem) @@ -356,11 +356,11 @@ Namespace WC3 _totalTockTime += record.length End Sub - Private Sub OnSocketDisconnected(ByVal sender As W3Socket, ByVal expected As Boolean, ByVal reasonDescription As String) + Private Sub OnSocketDisconnected(sender As W3Socket, expected As Boolean, reasonDescription As String) _inQueue.QueueAction(Sub() Disconnect(expected, Protocol.PlayerLeaveReason.Disconnect, reasonDescription)) End Sub - Protected Overrides Function PerformDispose(ByVal finalizing As Boolean) As Task + Protected Overrides Function PerformDispose(finalizing As Boolean) As Task If finalizing Then Return Nothing Return QueueDisconnect(expected:=True, reportedReason:=Protocol.PlayerLeaveReason.Disconnect, reasonDescription:="Disposed") End Function @@ -406,9 +406,9 @@ Namespace WC3 _inQueue.QueueAction(Sub() BeginReading()) End Sub - Private Sub Disconnect(ByVal expected As Boolean, - ByVal reportedReason As Protocol.PlayerLeaveReason, - ByVal reasonDescription As String) + Private Sub Disconnect(expected As Boolean, + reportedReason As Protocol.PlayerLeaveReason, + reasonDescription As String) Contract.Requires(reasonDescription IsNot Nothing) If _socket IsNot Nothing Then _socket.Disconnect(expected, reasonDescription) @@ -417,16 +417,16 @@ Namespace WC3 RaiseEvent Disconnected(Me, expected, reportedReason, reasonDescription) Me.Dispose() End Sub - Public Function QueueDisconnect(ByVal expected As Boolean, ByVal reportedReason As Protocol.PlayerLeaveReason, ByVal reasonDescription As String) As Task Implements Download.IPlayerDownloadAspect.QueueDisconnect + Public Function QueueDisconnect(expected As Boolean, reportedReason As Protocol.PlayerLeaveReason, reasonDescription As String) As Task Implements Download.IPlayerDownloadAspect.QueueDisconnect Return _inQueue.QueueAction(Sub() Disconnect(expected, reportedReason, reasonDescription)) End Function - Private Sub SendPacket(ByVal pk As Protocol.Packet) + Private Sub SendPacket(pk As Protocol.Packet) Contract.Requires(pk IsNot Nothing) If _socket Is Nothing Then Return _socket.SendPacket(pk) End Sub - Public Function QueueSendPacket(ByVal packet As Protocol.Packet) As Task Implements Download.IPlayerDownloadAspect.QueueSendPacket + Public Function QueueSendPacket(packet As Protocol.Packet) As Task Implements Download.IPlayerDownloadAspect.QueueSendPacket Dim result = _inQueue.QueueAction(Sub() SendPacket(packet)) result.IgnoreExceptions() Return result @@ -449,8 +449,8 @@ Namespace WC3 Return _inQueue.QueueAction(AddressOf GamePlayStart) End Function - Private Sub SendTick(ByVal record As TickRecord, - ByVal actionStreaks As IEnumerable(Of IRist(Of Protocol.PlayerActionSet))) + Private Sub SendTick(record As TickRecord, + actionStreaks As IEnumerable(Of IRist(Of Protocol.PlayerActionSet))) Contract.Requires(actionStreaks IsNot Nothing) Contract.Requires(record IsNot Nothing) If IsFake Then Return @@ -466,8 +466,8 @@ Namespace WC3 SendPacket(Protocol.MakeTick(record.length)) End If End Sub - Public Function QueueSendTick(ByVal record As TickRecord, - ByVal actionStreaks As IEnumerable(Of IRist(Of Protocol.PlayerActionSet))) As Task + Public Function QueueSendTick(record As TickRecord, + actionStreaks As IEnumerable(Of IRist(Of Protocol.PlayerActionSet))) As Task Contract.Requires(record IsNot Nothing) Contract.Requires(actionStreaks IsNot Nothing) Contract.Ensures(Contract.Result(Of Task)() IsNot Nothing) diff --git a/Warcraft3/Protocol/Game Action Protocol.vb b/Warcraft3/Protocol/Game Action Protocol.vb index 9ecc2008..80ef544d 100644 --- a/Warcraft3/Protocol/Game Action Protocol.vb +++ b/Warcraft3/Protocol/Game Action Protocol.vb @@ -192,7 +192,7 @@ Namespace WC3.Protocol Public ReadOnly AllocatedId As UInteger Public ReadOnly CounterId As UInteger - Public Sub New(ByVal allocatedId As UInteger, ByVal counterId As UInteger) + Public Sub New(allocatedId As UInteger, counterId As UInteger) Me.AllocatedId = allocatedId Me.CounterId = counterId End Sub @@ -200,18 +200,18 @@ Namespace WC3.Protocol Public Overrides Function GetHashCode() As Integer Return CounterId.GetHashCode End Function - Public Overrides Function Equals(ByVal obj As Object) As Boolean + Public Overrides Function Equals(obj As Object) As Boolean If Not TypeOf obj Is GameObjectId Then Return False Return Me.Equals(DirectCast(obj, GameObjectId)) End Function - Public Overloads Function Equals(ByVal other As GameObjectId) As Boolean Implements IEquatable(Of GameObjectId).Equals + Public Overloads Function Equals(other As GameObjectId) As Boolean Implements IEquatable(Of GameObjectId).Equals Return Me.AllocatedId = other.AllocatedId AndAlso Me.CounterId = other.CounterId End Function - Public Shared Operator =(ByVal value1 As GameObjectId, ByVal value2 As GameObjectId) As Boolean + Public Shared Operator =(value1 As GameObjectId, value2 As GameObjectId) As Boolean Return value1.equals(value2) End Operator - Public Shared Operator <>(ByVal value1 As GameObjectId, ByVal value2 As GameObjectId) As Boolean + Public Shared Operator <>(value1 As GameObjectId, value2 As GameObjectId) As Boolean Return Not value1 = value2 End Operator @@ -219,7 +219,7 @@ Namespace WC3.Protocol If AllocatedId = UInt32.MaxValue AndAlso CounterId = UInt32.MaxValue Then Return "[none]" Return "allocated id: {0}, counter id: {1}".Frmt(AllocatedId, CounterId) End Function - Public Shared Function Parse(ByVal text As String) As GameObjectId + Public Shared Function Parse(text As String) As GameObjectId Contract.Requires(text IsNot Nothing) If text = "[none]" Then Return New GameObjectId(UInt32.MaxValue, UInt32.MaxValue) If Not text Like "allocated id: #*, counter id: #*" Then Throw New FormatException("Not a recognized GameObjectId format.") @@ -242,7 +242,7 @@ Namespace WC3.Protocol Return _allDefinitions.Values End Get End Property - Public Shared ReadOnly Property DefinitionFor(ByVal id As GameActionId) As Definition + Public Shared ReadOnly Property DefinitionFor(id As GameActionId) As Definition Get Contract.Ensures(Contract.Result(Of Definition)() IsNot Nothing) If Not _allDefinitions.ContainsKey(id) Then Throw New ArgumentException("No definition defined for id: {0}.".Frmt(id)) @@ -259,7 +259,7 @@ Namespace WC3.Protocol Contract.Invariant(_jar IsNot Nothing) End Sub - Friend Sub New(ByVal id As GameActionId, ByVal jar As ISimpleJar) + Friend Sub New(id As GameActionId, jar As ISimpleJar) Contract.Requires(jar IsNot Nothing) Me._id = id Me._jar = jar @@ -286,7 +286,7 @@ Namespace WC3.Protocol Contract.Invariant(_jar IsNot Nothing) End Sub - Friend Sub New(ByVal id As GameActionId, ByVal jar As IJar(Of T)) + Friend Sub New(id As GameActionId, jar As IJar(Of T)) MyBase.New(id, jar) Contract.Requires(jar IsNot Nothing) Me._jar = jar @@ -300,21 +300,21 @@ Namespace WC3.Protocol End Property End Class - Private Shared Function Define(ByVal id As GameActionId) As Definition(Of NoValue) + Private Shared Function Define(id As GameActionId) As Definition(Of NoValue) Contract.Ensures(Contract.Result(Of Definition(Of NoValue))() IsNot Nothing) Return Define(id, New EmptyJar) End Function - Private Shared Function Define(Of T)(ByVal id As GameActionId, ByVal jar As IJar(Of T)) As Definition(Of T) + Private Shared Function Define(Of T)(id As GameActionId, jar As IJar(Of T)) As Definition(Of T) Contract.Requires(jar IsNot Nothing) Contract.Ensures(Contract.Result(Of Definition(Of T))() IsNot Nothing) Dim result = New Definition(Of T)(id, jar) _allDefinitions.Add(id, result) Return result End Function - Private Shared Function Define(ByVal id As GameActionId, - ByVal jar1 As ISimpleNamedJar, - ByVal jar2 As ISimpleNamedJar, - ByVal ParamArray jars() As ISimpleNamedJar) As Definition(Of NamedValueMap) + Private Shared Function Define(id As GameActionId, + jar1 As ISimpleNamedJar, + jar2 As ISimpleNamedJar, + ParamArray jars() As ISimpleNamedJar) As Definition(Of NamedValueMap) Contract.Requires(jar1 IsNot Nothing) Contract.Requires(jar2 IsNot Nothing) Contract.Requires(jars IsNot Nothing) diff --git a/Warcraft3/Protocol/GameAction.vb b/Warcraft3/Protocol/GameAction.vb index 53d159bc..162577de 100644 --- a/Warcraft3/Protocol/GameAction.vb +++ b/Warcraft3/Protocol/GameAction.vb @@ -14,7 +14,7 @@ Namespace WC3.Protocol Contract.Invariant(_payload IsNot Nothing) End Sub - Private Sub New(ByVal definition As GameActions.Definition, ByVal payload As Object) + Private Sub New(definition As GameActions.Definition, payload As Object) Contract.Requires(definition IsNot Nothing) Contract.Requires(payload IsNot Nothing) Contract.Ensures(Me.Definition Is definition) @@ -23,8 +23,8 @@ Namespace WC3.Protocol Me._payload = payload End Sub - Public Shared Function FromDefinitionAndValue(Of TPayload)(ByVal definition As GameActions.Definition(Of TPayload), - ByVal payload As TPayload) As GameAction + Public Shared Function FromDefinitionAndValue(Of TPayload)(definition As GameActions.Definition(Of TPayload), + payload As TPayload) As GameAction Contract.Requires(definition IsNot Nothing) Contract.Requires(payload IsNot Nothing) Contract.Ensures(Contract.Result(Of GameAction)() IsNot Nothing) @@ -43,22 +43,22 @@ Namespace WC3.Protocol End Get End Property - Public Shared Widening Operator CType(ByVal value As GameAction) As KeyValuePair(Of GameActionId, Object) + Public Shared Widening Operator CType(value As GameAction) As KeyValuePair(Of GameActionId, Object) Contract.Requires(value IsNot Nothing) Return value.Definition.Id.KeyValue(value.Payload) End Operator - Public Shared Widening Operator CType(ByVal value As KeyValuePair(Of GameActionId, Object)) As GameAction + Public Shared Widening Operator CType(value As KeyValuePair(Of GameActionId, Object)) As GameAction Contract.Ensures(Contract.Result(Of GameAction)() IsNot Nothing) Contract.Assume(value.Value IsNot Nothing) Return New GameAction(GameActions.DefinitionFor(value.Key), value.Value) End Operator - Public Overloads Function Equals(ByVal other As GameAction) As Boolean Implements System.IEquatable(Of GameAction).Equals + Public Overloads Function Equals(other As GameAction) As Boolean Implements System.IEquatable(Of GameAction).Equals If other Is Nothing Then Return False If other.Definition IsNot Me.Definition Then Return False Return SharedJar.Pack(Me).SequenceEqual(SharedJar.Pack(other)) End Function - Public Overrides Function Equals(ByVal obj As Object) As Boolean + Public Overrides Function Equals(obj As Object) As Boolean Return Me.Equals(TryCast(obj, GameAction)) End Function Public Overrides Function GetHashCode() As Integer @@ -82,11 +82,11 @@ Namespace WC3.Protocol Return DataJar End Function - Public Overrides Function PackRaw(ByVal value As GameAction) As KeyValuePair(Of GameActionId, Object) + Public Overrides Function PackRaw(value As GameAction) As KeyValuePair(Of GameActionId, Object) Contract.Assume(value IsNot Nothing) Return value End Function - Public Overrides Function ParseRaw(ByVal value As KeyValuePair(Of GameActionId, Object)) As GameAction + Public Overrides Function ParseRaw(value As KeyValuePair(Of GameActionId, Object)) As GameAction Return value End Function End Class diff --git a/Warcraft3/Protocol/GameObjectIdJar.vb b/Warcraft3/Protocol/GameObjectIdJar.vb index 7b7e0622..43e5e444 100644 --- a/Warcraft3/Protocol/GameObjectIdJar.vb +++ b/Warcraft3/Protocol/GameObjectIdJar.vb @@ -4,11 +4,11 @@ Namespace WC3.Protocol Public NotInheritable Class GameObjectIdJar Inherits BaseJar(Of GameObjectId) - Public Overrides Function Pack(ByVal value As GameObjectId) As IRist(Of Byte) + Public Overrides Function Pack(value As GameObjectId) As IRist(Of Byte) Return value.AllocatedId.Bytes.Concat(value.CounterId.Bytes).ToRist() End Function - Public Overrides Function Parse(ByVal data As IRist(Of Byte)) As ParsedValue(Of GameObjectId) + Public Overrides Function Parse(data As IRist(Of Byte)) As ParsedValue(Of GameObjectId) If data.Count < 8 Then Throw New PicklingNotEnoughDataException("A GameObjectId requires 8 bytes.") Dim value = New GameObjectId(data.SubList(0, 4).ToUInt32, data.SubList(4, 4).ToUInt32) @@ -16,7 +16,7 @@ Namespace WC3.Protocol End Function - Public Overrides Function Parse(ByVal text As String) As GameObjectId + Public Overrides Function Parse(text As String) As GameObjectId Try Return GameObjectId.Parse(text) Catch ex As Exception When TypeOf ex Is FormatException OrElse diff --git a/Warcraft3/Protocol/GameStatsJar.vb b/Warcraft3/Protocol/GameStatsJar.vb index 5c8121f8..3229ae02 100644 --- a/Warcraft3/Protocol/GameStatsJar.vb +++ b/Warcraft3/Protocol/GameStatsJar.vb @@ -38,11 +38,11 @@ Namespace WC3.Protocol New ByteJar().Named("unknown2"), New DataJar().Fixed(exactDataCount:=20).Optional.Named("sha1 checksum")) - Public Overrides Function Pack(ByVal value As GameStats) As IRist(Of Byte) + Public Overrides Function Pack(value As GameStats) As IRist(Of Byte) Contract.Assume(value IsNot Nothing) Return EncodeStatStringData(DataJar.Pack(PackDataValue(value))).Append(0).ToRist() End Function - Public Overrides Function Parse(ByVal data As IRist(Of Byte)) As ParsedValue(Of GameStats) + Public Overrides Function Parse(data As IRist(Of Byte)) As ParsedValue(Of GameStats) 'null-terminated Dim indexOfNull = data.IndexOf(0) If Not indexOfNull.HasValue Then Throw New PicklingException("No null terminator on game statstring.") @@ -56,7 +56,7 @@ Namespace WC3.Protocol Return ParseDataValue(parsed.Value).ParsedWithDataCount(usedDataCount) End Function - Private Shared Function PackDataValue(ByVal value As GameStats) As NamedValueMap + Private Shared Function PackDataValue(value As GameStats) As NamedValueMap Contract.Requires(value IsNot Nothing) Contract.Ensures(Contract.Result(Of NamedValueMap)() IsNot Nothing) 'Encode settings @@ -114,7 +114,7 @@ Namespace WC3.Protocol {"unknown1", CByte(0)}, {"unknown2", CByte(0)}} End Function - Private Shared Function ParseDataValue(ByVal vals As NamedValueMap) As GameStats + Private Shared Function ParseDataValue(vals As NamedValueMap) As GameStats Contract.Requires(vals IsNot Nothing) Contract.Ensures(Contract.Result(Of GameStats)() IsNot Nothing) Dim settings = vals.ItemAs(Of GameSettings)("settings") @@ -180,7 +180,7 @@ Namespace WC3.Protocol hostName:=hostName) End Function - Private Shared Function EncodeStatStringData(ByVal data As IEnumerable(Of Byte)) As IEnumerable(Of Byte) + Private Shared Function EncodeStatStringData(data As IEnumerable(Of Byte)) As IEnumerable(Of Byte) Contract.Requires(data IsNot Nothing) Contract.Ensures(Contract.Result(Of IEnumerable(Of Byte))() IsNot Nothing) Return From b In Concat(From plainBlock In data.Partitioned(partitionSize:=7) @@ -189,7 +189,7 @@ Namespace WC3.Protocol Select b Or CByte(1) End Function - Private Shared Function DecodeStatStringData(ByVal data As IEnumerable(Of Byte)) As IEnumerable(Of Byte) + Private Shared Function DecodeStatStringData(data As IEnumerable(Of Byte)) As IEnumerable(Of Byte) Contract.Requires(data IsNot Nothing) Contract.Ensures(Contract.Result(Of IEnumerable(Of Byte))() IsNot Nothing) Return From encodedBlock In data.Partitioned(partitionSize:=8) @@ -197,12 +197,12 @@ Namespace WC3.Protocol Select decodedValue = valueMaskBitPair.Item1.WithBitSetTo(bitPosition:=0, bitValue:=valueMaskBitPair.Item2) End Function - Public Overrides Function Describe(ByVal value As GameStats) As String + Public Overrides Function Describe(value As GameStats) As String Contract.Assume(value IsNot Nothing) Return DataJar.Describe(PackDataValue(value)) End Function - Public Overrides Function Parse(ByVal text As String) As GameStats + Public Overrides Function Parse(text As String) As GameStats Return ParseDataValue(DataJar.Parse(text)) End Function diff --git a/Warcraft3/Protocol/ObjectTypeJar.vb b/Warcraft3/Protocol/ObjectTypeJar.vb index d253dc39..353910d2 100644 --- a/Warcraft3/Protocol/ObjectTypeJar.vb +++ b/Warcraft3/Protocol/ObjectTypeJar.vb @@ -6,14 +6,14 @@ Namespace WC3.Protocol Private Shared ReadOnly DataJar As New UInt32Jar() - Public Overrides Function Pack(ByVal value As UInteger) As IRist(Of Byte) + Public Overrides Function Pack(value As UInteger) As IRist(Of Byte) Return DataJar.Pack(value) End Function - Public Overrides Function Parse(ByVal data As IRist(Of Byte)) As ParsedValue(Of UInt32) + Public Overrides Function Parse(data As IRist(Of Byte)) As ParsedValue(Of UInt32) Return DataJar.Parse(data) End Function - Public Overrides Function Describe(ByVal value As UInt32) As String + Public Overrides Function Describe(value As UInt32) As String If value.Bytes.All(Function(b) b >= 32 AndAlso b <= 127) Then Return "type '{0}'".Frmt(New String(System.Text.Encoding.ASCII.GetChars(value.Bytes(ByteOrder.BigEndian).ToArray()))) Else @@ -21,7 +21,7 @@ Namespace WC3.Protocol End If End Function - Public Overrides Function Parse(ByVal text As String) As UInt32 + Public Overrides Function Parse(text As String) As UInt32 Try If text Like New InvariantString("type '????'") Then Contract.Assume(text.Length >= "type '".Length + "????".Length) diff --git a/Warcraft3/Protocol/OrderIdJar.vb b/Warcraft3/Protocol/OrderIdJar.vb index ebced94b..c07d43c6 100644 --- a/Warcraft3/Protocol/OrderIdJar.vb +++ b/Warcraft3/Protocol/OrderIdJar.vb @@ -6,14 +6,14 @@ Namespace WC3.Protocol Private Shared ReadOnly DataJar As New EnumUInt32Jar(Of OrderId)(checkDefined:=False) - Public Overrides Function Pack(ByVal value As OrderId) As IRist(Of Byte) + Public Overrides Function Pack(value As OrderId) As IRist(Of Byte) Return DataJar.Pack(value) End Function - Public Overrides Function Parse(ByVal data As IRist(Of Byte)) As ParsedValue(Of OrderId) + Public Overrides Function Parse(data As IRist(Of Byte)) As ParsedValue(Of OrderId) Return DataJar.Parse(data) End Function - Public Overrides Function Describe(ByVal value As OrderId) As String + Public Overrides Function Describe(value As OrderId) As String If value.EnumValueIsDefined() Then Return value.ToString ElseIf value >= &HD0000UI AndAlso value < &HE0000UI Then @@ -23,7 +23,7 @@ Namespace WC3.Protocol End If End Function - Public Overrides Function Parse(ByVal text As String) As OrderId + Public Overrides Function Parse(text As String) As OrderId Try Dim enumVal = text.EnumTryParse(Of OrderId)(ignoreCase:=True) If enumVal.HasValue Then diff --git a/Warcraft3/Protocol/PlayerActionSet.vb b/Warcraft3/Protocol/PlayerActionSet.vb index 8ae7fcfd..66954dc1 100644 --- a/Warcraft3/Protocol/PlayerActionSet.vb +++ b/Warcraft3/Protocol/PlayerActionSet.vb @@ -9,7 +9,7 @@ Namespace WC3.Protocol Private Sub ObjectInvariant() Contract.Invariant(_actions IsNot Nothing) End Sub - Public Sub New(ByVal id As PlayerId, ByVal actions As IRist(Of GameAction)) + Public Sub New(id As PlayerId, actions As IRist(Of GameAction)) Contract.Requires(actions IsNot Nothing) Me._id = id Me._actions = actions @@ -29,10 +29,10 @@ Namespace WC3.Protocol Public Overrides Function GetHashCode() As Integer Return Id.GetHashCode End Function - Public Overrides Function Equals(ByVal obj As Object) As Boolean + Public Overrides Function Equals(obj As Object) As Boolean Return Me.Equals(TryCast(obj, PlayerActionSet)) End Function - Public Overloads Function Equals(ByVal other As PlayerActionSet) As Boolean Implements IEquatable(Of PlayerActionSet).Equals + Public Overloads Function Equals(other As PlayerActionSet) As Boolean Implements IEquatable(Of PlayerActionSet).Equals If other Is Nothing Then Return False If Me.Id <> other.Id Then Return False If Me.Actions.Count <> other.Actions.Count Then Return False @@ -49,7 +49,7 @@ Namespace WC3.Protocol Private Sub ObjectInvariant() Contract.Invariant(_player IsNot Nothing) End Sub - Public Sub New(ByVal player As Player, ByVal actions As IRist(Of GameAction)) + Public Sub New(player As Player, actions As IRist(Of GameAction)) MyBase.New(player.Id, actions) Contract.Requires(player IsNot Nothing) Contract.Requires(actions IsNot Nothing) @@ -65,10 +65,10 @@ Namespace WC3.Protocol Public Overrides Function GetHashCode() As Integer Return _player.GetHashCode End Function - Public Overrides Function Equals(ByVal obj As Object) As Boolean + Public Overrides Function Equals(obj As Object) As Boolean Return Me.Equals(TryCast(obj, SpecificPlayerActionSet)) End Function - Public Overloads Function Equals(ByVal other As SpecificPlayerActionSet) As Boolean Implements IEquatable(Of SpecificPlayerActionSet).Equals + Public Overloads Function Equals(other As SpecificPlayerActionSet) As Boolean Implements IEquatable(Of SpecificPlayerActionSet).Equals Return MyBase.Equals(DirectCast(other, PlayerActionSet)) AndAlso Me.Player Is other.Player End Function End Class @@ -82,13 +82,13 @@ Namespace WC3.Protocol Public Overrides Function SubJar() As IJar(Of NamedValueMap) Return DataJar End Function - Public Overrides Function PackRaw(ByVal value As PlayerActionSet) As NamedValueMap + Public Overrides Function PackRaw(value As PlayerActionSet) As NamedValueMap Contract.Assume(value IsNot Nothing) Return New Dictionary(Of InvariantString, Object) From { {"source", value.Id}, {"actions", value.Actions}} End Function - Public Overrides Function ParseRaw(ByVal value As NamedValueMap) As PlayerActionSet + Public Overrides Function ParseRaw(value As NamedValueMap) As PlayerActionSet Contract.Assume(value IsNot Nothing) Return New PlayerActionSet(value.ItemAs(Of PlayerId)("source"), value.ItemAs(Of IRist(Of GameAction))("actions")) diff --git a/Warcraft3/Protocol/SlotJar.vb b/Warcraft3/Protocol/SlotJar.vb index 2064752e..4c453eb8 100644 --- a/Warcraft3/Protocol/SlotJar.vb +++ b/Warcraft3/Protocol/SlotJar.vb @@ -17,8 +17,8 @@ Namespace WC3.Protocol New ByteJar().Named("handicap")) End Sub - Public Shared Function PackSlot(ByVal slot As Slot, - Optional ByVal receiver As Player = Nothing) As NamedValueMap + Public Shared Function PackSlot(slot As Slot, + Optional receiver As Player = Nothing) As NamedValueMap Contract.Requires(receiver IsNot Nothing) Contract.Ensures(Contract.Result(Of NamedValueMap)() IsNot Nothing) Dim pid = slot.Contents.DataPlayerIndex(receiver) diff --git a/Warcraft3/Protocol/WC3 Packet.vb b/Warcraft3/Protocol/WC3 Packet.vb index 97b7b231..2b2908cc 100644 --- a/Warcraft3/Protocol/WC3 Packet.vb +++ b/Warcraft3/Protocol/WC3 Packet.vb @@ -9,14 +9,14 @@ Namespace WC3.Protocol Contract.Invariant(_payload IsNot Nothing) End Sub - Private Sub New(ByVal id As PacketId, ByVal payload As ISimplePickle) + Private Sub New(id As PacketId, payload As ISimplePickle) Contract.Requires(payload IsNot Nothing) Me._id = id Me._payload = payload End Sub - Public Shared Function FromValue(Of T)(ByVal packetDefinition As Packets.Definition(Of T), - ByVal value As T) As Packet + Public Shared Function FromValue(Of T)(packetDefinition As Packets.Definition(Of T), + value As T) As Packet Contract.Requires(packetDefinition IsNot Nothing) Contract.Requires(value IsNot Nothing) Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) @@ -37,7 +37,7 @@ Namespace WC3.Protocol End Class Public Module W3PacketHandler - Public Function MakeW3PacketHandlerLogger(ByVal sourceName As String, ByVal logger As Logger) As PacketHandlerLogger(Of PacketId) + Public Function MakeW3PacketHandlerLogger(sourceName As String, logger As Logger) As PacketHandlerLogger(Of PacketId) Contract.Requires(sourceName IsNot Nothing) Contract.Requires(logger IsNot Nothing) Contract.Ensures(Contract.Result(Of PacketHandlerLogger(Of PacketId))() IsNot Nothing) diff --git a/Warcraft3/Protocol/WC3 Protocol Packers.vb b/Warcraft3/Protocol/WC3 Protocol Packers.vb index b33e0e29..d41ace89 100644 --- a/Warcraft3/Protocol/WC3 Protocol Packers.vb +++ b/Warcraft3/Protocol/WC3 Protocol Packers.vb @@ -3,7 +3,7 @@ Imports Tinker.Pickling Namespace WC3.Protocol Public Module Packers - Public Function MakePlayersLagging(ByVal laggers As IEnumerable(Of PlayerId)) As Packet + Public Function MakePlayersLagging(laggers As IEnumerable(Of PlayerId)) As Packet Contract.Requires(laggers IsNot Nothing) Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) Return Packet.FromValue(ServerPackets.PlayersLagging, (From lagger In laggers @@ -12,19 +12,19 @@ Namespace WC3.Protocol {"initial milliseconds used", 2000UI}})).ToRist) End Function - Public Function MakePlayerStoppedLagging(ByVal lagger As PlayerId, - ByVal lagTimeInMilliseconds As UInteger) As Packet + Public Function MakePlayerStoppedLagging(lagger As PlayerId, + lagTimeInMilliseconds As UInteger) As Packet Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) Return Packet.FromValue(ServerPackets.PlayerStoppedLagging, New Dictionary(Of InvariantString, Object) From { {"lagger", lagger}, {"marginal milliseconds used", lagTimeInMilliseconds}}) End Function - Public Function MakeText(ByVal text As String, - ByVal chatType As ChatType, - ByVal receivingGroup As ChatGroup?, - ByVal receivers As IEnumerable(Of PlayerId), - ByVal sender As PlayerId) As Packet + Public Function MakeText(text As String, + chatType As ChatType, + receivingGroup As ChatGroup?, + receivers As IEnumerable(Of PlayerId), + sender As PlayerId) As Packet Contract.Requires(text IsNot Nothing) Contract.Requires(receivers IsNot Nothing) Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) @@ -47,8 +47,8 @@ Namespace WC3.Protocol End Select End Function - Public Function MakeGreet(ByVal remoteExternalEndPoint As Net.IPEndPoint, - ByVal assignedId As PlayerId) As Packet + Public Function MakeGreet(remoteExternalEndPoint As Net.IPEndPoint, + assignedId As PlayerId) As Packet Contract.Requires(remoteExternalEndPoint IsNot Nothing) Contract.Requires(remoteExternalEndPoint.Address IsNot Nothing) Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) @@ -58,13 +58,13 @@ Namespace WC3.Protocol {"external address", remoteExternalEndPoint}}) End Function - Public Function MakeReject(ByVal reason As RejectReason) As Packet + Public Function MakeReject(reason As RejectReason) As Packet Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) Return Packet.FromValue(ServerPackets.RejectEntry, reason) End Function - Public Function MakeHostMapInfo(ByVal map As Map, - Optional ByVal mapTransferKey As UInt32 = 1) As Packet + Public Function MakeHostMapInfo(map As Map, + Optional mapTransferKey As UInt32 = 1) As Packet Contract.Requires(map IsNot Nothing) Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) Return Packet.FromValue(ServerPackets.HostMapInfo, New Dictionary(Of InvariantString, Object) From { @@ -76,11 +76,11 @@ Namespace WC3.Protocol {"sha1 checksum", map.MapChecksumSHA1}}) End Function - Public Function MakeOtherPlayerJoined(ByVal name As InvariantString, - ByVal joiner As PlayerId, - ByVal peerKey As UInt32, - ByVal peerData As IRist(Of Byte), - ByVal listenAddress As Net.IPEndPoint) As Packet + Public Function MakeOtherPlayerJoined(name As InvariantString, + joiner As PlayerId, + peerKey As UInt32, + peerData As IRist(Of Byte), + listenAddress As Net.IPEndPoint) As Packet Contract.Requires(peerData IsNot Nothing) Contract.Requires(listenAddress IsNot Nothing) Contract.Requires(listenAddress.Address IsNot Nothing) @@ -94,30 +94,30 @@ Namespace WC3.Protocol {"internal address", listenAddress}}) End Function - Public Function MakePing(ByVal salt As UInteger) As Packet + Public Function MakePing(salt As UInteger) As Packet Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) Return Packet.FromValue(ServerPackets.Ping, salt) End Function - Public Function MakeOtherPlayerReady(ByVal readiedPlayer As PlayerId) As Packet + Public Function MakeOtherPlayerReady(readiedPlayer As PlayerId) As Packet Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) Return Packet.FromValue(ServerPackets.OtherPlayerReady, readiedPlayer) End Function - Public Function MakeOtherPlayerLeft(ByVal leaver As PlayerId, - ByVal reportedReason As PlayerLeaveReason) As Packet + Public Function MakeOtherPlayerLeft(leaver As PlayerId, + reportedReason As PlayerLeaveReason) As Packet Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) Return Packet.FromValue(ServerPackets.OtherPlayerLeft, New Dictionary(Of InvariantString, Object) From { {"leaver", leaver}, {"reason", reportedReason}}) End Function - Public Function MakeLobbyState(ByVal layoutStyle As LobbyLayoutStyle, - ByVal slots As IEnumerable(Of Slot), - ByVal randomSeed As UInt32, - Optional ByVal receiver As Player = Nothing, - Optional ByVal hideSlots As Boolean = False) As Packet + Public Function MakeLobbyState(layoutStyle As LobbyLayoutStyle, + slots As IEnumerable(Of Slot), + randomSeed As UInt32, + Optional receiver As Player = Nothing, + Optional hideSlots As Boolean = False) As Packet Contract.Requires(slots IsNot Nothing) Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) Dim reportedPlayerSlots = CByte(slots.Count) @@ -147,8 +147,8 @@ Namespace WC3.Protocol Return Packet.FromValue(ServerPackets.HostConfirmHostLeaving, New NoValue) End Function - Public Function MakeTickPreOverflow(ByVal actions As IRist(Of PlayerActionSet), - Optional ByVal timeSpan As UShort = 0) As Packet + Public Function MakeTickPreOverflow(actions As IRist(Of PlayerActionSet), + Optional timeSpan As UShort = 0) As Packet Contract.Requires(actions IsNot Nothing) Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) Return Packet.FromValue(ServerPackets.TickPreOverflow, New Dictionary(Of InvariantString, Object) From { @@ -156,8 +156,8 @@ Namespace WC3.Protocol {"player action sets", actions}}) End Function - Public Function MakeTick(ByVal timeSpan As UShort, - Optional ByVal actions As Maybe(Of IRist(Of PlayerActionSet)) = Nothing) As Packet + Public Function MakeTick(timeSpan As UShort, + Optional actions As Maybe(Of IRist(Of PlayerActionSet)) = Nothing) As Packet Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) Return Packet.FromValue(ServerPackets.Tick, New Dictionary(Of InvariantString, Object) From { {"time span", timeSpan}, @@ -165,11 +165,11 @@ Namespace WC3.Protocol End Function - Public Function MakeMapFileData(ByVal filePosition As UInt32, - ByVal fileData As IRist(Of Byte), - ByVal downloader As PlayerId, - ByVal uploader As PlayerId, - Optional ByVal mapTransferKey As UInt32 = 1) As Packet + Public Function MakeMapFileData(filePosition As UInt32, + fileData As IRist(Of Byte), + downloader As PlayerId, + uploader As PlayerId, + Optional mapTransferKey As UInt32 = 1) As Packet Contract.Requires(filePosition >= 0) Contract.Requires(fileData IsNot Nothing) Contract.Requires(downloader <> uploader) @@ -183,9 +183,9 @@ Namespace WC3.Protocol {"file data", fileData}}) End Function - Public Function MakeSetUploadTarget(ByVal downloader As PlayerId, - ByVal filePosition As UInteger, - Optional ByVal mapTransferKey As UInt32 = 1) As Packet + Public Function MakeSetUploadTarget(downloader As PlayerId, + filePosition As UInteger, + Optional mapTransferKey As UInt32 = 1) As Packet Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) Return Packet.FromValue(ServerPackets.SetUploadTarget, New Dictionary(Of InvariantString, Object) From { {"map transfer key", mapTransferKey}, @@ -193,17 +193,17 @@ Namespace WC3.Protocol {"starting file pos", filePosition}}) End Function - Public Function MakeSetDownloadSource(ByVal uploader As PlayerId, - Optional ByVal mapTransferKey As UInt32 = 1) As Packet + Public Function MakeSetDownloadSource(uploader As PlayerId, + Optional mapTransferKey As UInt32 = 1) As Packet Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) Return Packet.FromValue(ServerPackets.SetDownloadSource, New Dictionary(Of InvariantString, Object) From { {"map transfer key", mapTransferKey}, {"uploader", uploader}}) End Function - Public Function MakeClientMapInfo(ByVal transferState As MapTransferState, - ByVal totalDownloaded As UInteger, - Optional ByVal mapTransferKey As UInt32 = 1) As Packet + Public Function MakeClientMapInfo(transferState As MapTransferState, + totalDownloaded As UInteger, + Optional mapTransferKey As UInt32 = 1) As Packet Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) Return Packet.FromValue(ClientPackets.ClientMapInfo, New Dictionary(Of InvariantString, Object) From { {"map transfer key", mapTransferKey}, @@ -211,10 +211,10 @@ Namespace WC3.Protocol {"total downloaded", totalDownloaded}}) End Function - Public Function MakeMapFileDataReceived(ByVal downloader As PlayerId, - ByVal uploader As PlayerId, - ByVal totalDownloaded As UInteger, - Optional ByVal mapTransferKey As UInt32 = 1) As Packet + Public Function MakeMapFileDataReceived(downloader As PlayerId, + uploader As PlayerId, + totalDownloaded As UInteger, + Optional mapTransferKey As UInt32 = 1) As Packet Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) Return Packet.FromValue(PeerPackets.MapFileDataReceived, New Dictionary(Of InvariantString, Object) From { {"downloader", downloader}, @@ -224,8 +224,8 @@ Namespace WC3.Protocol End Function - Public Function MakeLanCreateGame(ByVal wc3MajorVersion As UInteger, - ByVal gameId As UInteger) As Packet + Public Function MakeLanCreateGame(wc3MajorVersion As UInteger, + gameId As UInteger) As Packet Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) Return Packet.FromValue(ServerPackets.LanCreateGame, New Dictionary(Of InvariantString, Object) From { {"product id", "W3XP"}, @@ -233,8 +233,8 @@ Namespace WC3.Protocol {"game id", gameId}}) End Function - Public Function MakeLanRefreshGame(ByVal gameId As UInteger, - ByVal game As GameDescription) As Packet + Public Function MakeLanRefreshGame(gameId As UInteger, + game As GameDescription) As Packet Contract.Requires(game IsNot Nothing) Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) Return Packet.FromValue(ServerPackets.LanRefreshGame, New Dictionary(Of InvariantString, Object) From { @@ -243,8 +243,8 @@ Namespace WC3.Protocol {"free slots", CUInt(game.TotalSlotCount - game.UsedSlotCount)}}) End Function - Public Function MakeLanGameDetails(ByVal majorVersion As UInteger, - ByVal game As LocalGameDescription) As Packet + Public Function MakeLanGameDetails(majorVersion As UInteger, + game As LocalGameDescription) As Packet Contract.Requires(game IsNot Nothing) Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) Return Packet.FromValue(ServerPackets.LanGameDetails, New Dictionary(Of InvariantString, Object) From { @@ -263,19 +263,19 @@ Namespace WC3.Protocol {"listen port", game.Port}}) End Function - Public Function MakeLanDestroyGame(ByVal gameId As UInteger) As Packet + Public Function MakeLanDestroyGame(gameId As UInteger) As Packet Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) Return Packet.FromValue(ServerPackets.LanDestroyGame, gameId) End Function - Public Function MakeKnock(ByVal name As InvariantString, - ByVal listenPort As UShort, - ByVal sendingPort As UShort, - Optional ByVal gameId As UInt32 = 0, - Optional ByVal entryKey As UInt32 = 0, - Optional ByVal peerKey As UInt32 = 0, - Optional ByVal internalAddress As Net.IPAddress = Nothing) As Packet + Public Function MakeKnock(name As InvariantString, + listenPort As UShort, + sendingPort As UShort, + Optional gameId As UInt32 = 0, + Optional entryKey As UInt32 = 0, + Optional peerKey As UInt32 = 0, + Optional internalAddress As Net.IPAddress = Nothing) As Packet Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) If internalAddress Is Nothing Then internalAddress = New Net.IPAddress(GetCachedIPAddressBytes(external:=True)) @@ -296,20 +296,20 @@ Namespace WC3.Protocol Return Packet.FromValue(ClientPackets.Ready, New NoValue) End Function - Public Function MakePong(ByVal salt As UInteger) As Packet + Public Function MakePong(salt As UInteger) As Packet Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) Return Packet.FromValue(ClientPackets.Pong, salt) End Function - Public Function MakeTock(ByVal unknown As Byte, - ByVal checksum As UInt32) As Packet + Public Function MakeTock(unknown As Byte, + checksum As UInt32) As Packet Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) Return Packet.FromValue(ClientPackets.Tock, New Dictionary(Of InvariantString, Object) From { {"unknown", unknown}, {"game state checksum", checksum}}) End Function - Public Function MakePeerConnectionInfo(ByVal pids As IEnumerable(Of PlayerId)) As Packet + Public Function MakePeerConnectionInfo(pids As IEnumerable(Of PlayerId)) As Packet Contract.Requires(pids IsNot Nothing) Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) Dim peerFlags = (From pid In pids Select 1US << (pid.Index - 1)).Aggregate(0US, Function(flag1, flag2) flag1 Or flag2) @@ -317,9 +317,9 @@ Namespace WC3.Protocol End Function - Public Function MakePeerKnock(ByVal receiverPeerKey As UInteger, - ByVal sender As PlayerId, - ByVal connectedPeers As IEnumerable(Of PlayerId)) As Packet + Public Function MakePeerKnock(receiverPeerKey As UInteger, + sender As PlayerId, + connectedPeers As IEnumerable(Of PlayerId)) As Packet Contract.Requires(connectedPeers IsNot Nothing) Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) Dim peerFlags = (From pid In connectedPeers Select 1UI << (pid.Index - 1)).Aggregate(0UI, Function(flag1, flag2) flag1 Or flag2) @@ -331,8 +331,8 @@ Namespace WC3.Protocol {"sender peer connection flags", peerFlags}}) End Function - Public Function MakePeerPing(ByVal salt As UInt32, - ByVal senderConnectedPeers As IEnumerable(Of PlayerId)) As Packet + Public Function MakePeerPing(salt As UInt32, + senderConnectedPeers As IEnumerable(Of PlayerId)) As Packet Contract.Requires(senderConnectedPeers IsNot Nothing) Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) Dim peerFlags = (From pid In senderConnectedPeers Select 1UI << (pid.Index - 1)).Aggregate(0UI, Function(flag1, flag2) flag1 Or flag2) @@ -342,7 +342,7 @@ Namespace WC3.Protocol {"unknown2", 0UI}}) End Function - Public Function MakePeerPong(ByVal salt As UInt32) As Packet + Public Function MakePeerPong(salt As UInt32) As Packet Contract.Ensures(Contract.Result(Of Packet)() IsNot Nothing) Return Packet.FromValue(PeerPackets.PeerPong, salt) End Function diff --git a/Warcraft3/Protocol/WC3 Protocol Values.vb b/Warcraft3/Protocol/WC3 Protocol Values.vb index faf1e16e..d3509d7d 100644 --- a/Warcraft3/Protocol/WC3 Protocol Values.vb +++ b/Warcraft3/Protocol/WC3 Protocol Values.vb @@ -19,14 +19,14 @@ Namespace WC3.Protocol Contract.Invariant(_peerData IsNot Nothing) End Sub - Public Sub New(ByVal name As InvariantString, - ByVal gameId As UInt32, - ByVal peerKey As UInt32, - ByVal peerData As IRist(Of Byte), - ByVal entryKey As UInt32, - ByVal listenPort As UInt16, - ByVal internalEndPoint As Net.IPEndPoint, - ByVal unknown As Byte) + Public Sub New(name As InvariantString, + gameId As UInt32, + peerKey As UInt32, + peerData As IRist(Of Byte), + entryKey As UInt32, + listenPort As UInt16, + internalEndPoint As Net.IPEndPoint, + unknown As Byte) Contract.Requires(peerData IsNot Nothing) Contract.Requires(internalEndPoint IsNot Nothing) Contract.Assume(internalEndPoint.Address IsNot Nothing) @@ -86,7 +86,7 @@ Namespace WC3.Protocol End Property #End Region - Public Overloads Function Equals(ByVal other As KnockData) As Boolean Implements IEquatable(Of KnockData).Equals + Public Overloads Function Equals(other As KnockData) As Boolean Implements IEquatable(Of KnockData).Equals If other Is Nothing Then Return False Return Me.Name = other.Name AndAlso Me.PeerData.SequenceEqual(other.PeerData) AndAlso @@ -97,7 +97,7 @@ Namespace WC3.Protocol Me.InternalEndPoint.Equals(other.InternalEndPoint) AndAlso Me.Unknown = other.Unknown End Function - Public Overrides Function Equals(ByVal obj As Object) As Boolean + Public Overrides Function Equals(obj As Object) As Boolean Return Me.Equals(TryCast(obj, KnockData)) End Function Public Overrides Function GetHashCode() As Integer @@ -106,11 +106,11 @@ Namespace WC3.Protocol Public Overrides Function ToString() As String Return "{0} joining game {1}".Frmt(Me.Name, Me.GameId) End Function - Public Shared Operator =(ByVal value1 As KnockData, ByVal value2 As KnockData) As Boolean + Public Shared Operator =(value1 As KnockData, value2 As KnockData) As Boolean If value1 Is Nothing Then Return value2 Is Nothing Return value1.Equals(value2) End Operator - Public Shared Operator <>(ByVal value1 As KnockData, ByVal value2 As KnockData) As Boolean + Public Shared Operator <>(value1 As KnockData, value2 As KnockData) As Boolean Return Not value1 = value2 End Operator End Class @@ -130,7 +130,7 @@ Namespace WC3.Protocol Public Overrides Function SubJar() As Pickling.IJar(Of NamedValueMap) Return DataJar End Function - Public Overrides Function PackRaw(ByVal value As KnockData) As NamedValueMap + Public Overrides Function PackRaw(value As KnockData) As NamedValueMap Contract.Assume(value IsNot Nothing) Return New Dictionary(Of InvariantString, Object) From { {"game id", value.GameId}, @@ -142,7 +142,7 @@ Namespace WC3.Protocol {"peer data", value.PeerData}, {"internal address", value.InternalEndPoint}} End Function - Public Overrides Function ParseRaw(ByVal value As NamedValueMap) As KnockData + Public Overrides Function ParseRaw(value As NamedValueMap) As KnockData Contract.Assume(value IsNot Nothing) Return New KnockData(GameId:=value.ItemAs(Of UInt32)("game id"), EntryKey:=value.ItemAs(Of UInt32)("entry key"), diff --git a/Warcraft3/Protocol/WC3 Protocol.vb b/Warcraft3/Protocol/WC3 Protocol.vb index b60aee63..8aa0afad 100644 --- a/Warcraft3/Protocol/WC3 Protocol.vb +++ b/Warcraft3/Protocol/WC3 Protocol.vb @@ -224,7 +224,7 @@ Namespace WC3.Protocol Contract.Invariant(_jar IsNot Nothing) End Sub - Friend Sub New(ByVal id As PacketId, ByVal jar As ISimpleJar) + Friend Sub New(id As PacketId, jar As ISimpleJar) Contract.Requires(jar IsNot Nothing) Me._id = id Me._jar = jar @@ -250,7 +250,7 @@ Namespace WC3.Protocol Contract.Invariant(_jar IsNot Nothing) End Sub - Friend Sub New(ByVal id As PacketId, ByVal jar As IJar(Of T)) + Friend Sub New(id As PacketId, jar As IJar(Of T)) MyBase.New(id, jar) Contract.Requires(jar IsNot Nothing) Me._jar = jar @@ -264,20 +264,20 @@ Namespace WC3.Protocol End Property End Class - Private Function Define(ByVal id As PacketId) As Definition(Of NoValue) + Private Function Define(id As PacketId) As Definition(Of NoValue) Contract.Ensures(Contract.Result(Of Definition(Of NoValue))() IsNot Nothing) Return Define(id, New EmptyJar) End Function - Private Function Define(Of T)(ByVal id As PacketId, - ByVal jar As IJar(Of T)) As Definition(Of T) + Private Function Define(Of T)(id As PacketId, + jar As IJar(Of T)) As Definition(Of T) Contract.Requires(jar IsNot Nothing) Contract.Ensures(Contract.Result(Of Definition(Of T))() IsNot Nothing) Return New Definition(Of T)(id, jar) End Function - Private Function Define(ByVal id As PacketId, - ByVal jar1 As ISimpleNamedJar, - ByVal jar2 As ISimpleNamedJar, - ByVal ParamArray jars() As ISimpleNamedJar) As Definition(Of NamedValueMap) + Private Function Define(id As PacketId, + jar1 As ISimpleNamedJar, + jar2 As ISimpleNamedJar, + ParamArray jars() As ISimpleNamedJar) As Definition(Of NamedValueMap) Contract.Requires(jar1 IsNot Nothing) Contract.Requires(jar2 IsNot Nothing) Contract.Requires(jars IsNot Nothing) diff --git a/Warcraft3/Replay/Replay Entry Packers.vb b/Warcraft3/Replay/Replay Entry Packers.vb index c7516cf1..f153bec1 100644 --- a/Warcraft3/Replay/Replay Entry Packers.vb +++ b/Warcraft3/Replay/Replay Entry Packers.vb @@ -3,14 +3,14 @@ Namespace WC3.Replay Public Module Packers - Public Function MakeStartOfReplay(ByVal primaryPlayerId As PlayerId, - ByVal primaryPlayerName As InvariantString, - ByVal primaryPlayerPeerData As IRist(Of Byte), - ByVal gameName As InvariantString, - ByVal gameStats As GameStats, - ByVal playerCount As UInt32, - ByVal gameType As Protocol.GameTypes, - Optional ByVal language As UInt32 = &H18F8B0) As ReplayEntry + Public Function MakeStartOfReplay(primaryPlayerId As PlayerId, + primaryPlayerName As InvariantString, + primaryPlayerPeerData As IRist(Of Byte), + gameName As InvariantString, + gameStats As GameStats, + playerCount As UInt32, + gameType As Protocol.GameTypes, + Optional language As UInt32 = &H18F8B0) As ReplayEntry Contract.Requires(primaryPlayerPeerData IsNot Nothing) Contract.Requires(gameStats IsNot Nothing) Contract.Requires(playerCount > 0) @@ -29,9 +29,9 @@ Namespace WC3.Replay {"language", language}}) End Function - Public Function MakePlayerJoined(ByVal id As PlayerId, - ByVal name As InvariantString, - ByVal peerData As IRist(Of Byte)) As ReplayEntry + Public Function MakePlayerJoined(id As PlayerId, + name As InvariantString, + peerData As IRist(Of Byte)) As ReplayEntry Contract.Requires(peerData IsNot Nothing) Contract.Ensures(Contract.Result(Of ReplayEntry)() IsNot Nothing) Return ReplayEntry.FromDefinitionAndValue(Format.ReplayEntryPlayerJoined, New Dictionary(Of InvariantString, Object) From { @@ -41,10 +41,10 @@ Namespace WC3.Replay {"unknown", 0UI}}) End Function - Public Function MakeLobbyState(ByVal slots As IEnumerable(Of Slot), - ByVal randomSeed As UInt32, - ByVal layoutStyle As Protocol.LobbyLayoutStyle, - ByVal defaultPlayerSlotCount As Byte) As ReplayEntry + Public Function MakeLobbyState(slots As IEnumerable(Of Slot), + randomSeed As UInt32, + layoutStyle As Protocol.LobbyLayoutStyle, + defaultPlayerSlotCount As Byte) As ReplayEntry Contract.Requires(slots IsNot Nothing) Contract.Requires(defaultPlayerSlotCount > 0) Contract.Requires(defaultPlayerSlotCount <= 12) @@ -71,10 +71,10 @@ Namespace WC3.Replay Return ReplayEntry.FromDefinitionAndValue(Format.ReplayEntryGameStarted, 1UI) End Function - Public Function MakePlayerLeft(ByVal unknown1 As UInt32, - ByVal leaver As PlayerId, - ByVal reportedReason As Protocol.PlayerLeaveReason, - ByVal leaveCount As UInt32) As ReplayEntry + Public Function MakePlayerLeft(unknown1 As UInt32, + leaver As PlayerId, + reportedReason As Protocol.PlayerLeaveReason, + leaveCount As UInt32) As ReplayEntry Contract.Ensures(Contract.Result(Of ReplayEntry)() IsNot Nothing) Return ReplayEntry.FromDefinitionAndValue(Format.ReplayEntryPlayerLeft, New Dictionary(Of InvariantString, Object) From { {"unknown1", unknown1}, @@ -83,13 +83,13 @@ Namespace WC3.Replay {"session leave count", leaveCount}}) End Function - Public Function MakeGameStateChecksum(ByVal checksum As UInt32) As ReplayEntry + Public Function MakeGameStateChecksum(checksum As UInt32) As ReplayEntry Contract.Ensures(Contract.Result(Of ReplayEntry)() IsNot Nothing) Return ReplayEntry.FromDefinitionAndValue(Format.ReplayEntryGameStateChecksum, checksum) End Function - Public Function MakeLobbyChatMessage(ByVal sender As PlayerId, - ByVal message As String) As ReplayEntry + Public Function MakeLobbyChatMessage(sender As PlayerId, + message As String) As ReplayEntry Contract.Requires(message IsNot Nothing) Contract.Ensures(Contract.Result(Of ReplayEntry)() IsNot Nothing) Return ReplayEntry.FromDefinitionAndValue(Format.ReplayEntryChatMessage, New Dictionary(Of InvariantString, Object) From { @@ -99,9 +99,9 @@ Namespace WC3.Replay {"message", message}})}}) End Function - Public Function MakeGameChatMessage(ByVal sender As PlayerId, - ByVal message As String, - ByVal receivingGroup As Protocol.ChatGroup) As ReplayEntry + Public Function MakeGameChatMessage(sender As PlayerId, + message As String, + receivingGroup As Protocol.ChatGroup) As ReplayEntry Contract.Requires(message IsNot Nothing) Contract.Ensures(Contract.Result(Of ReplayEntry)() IsNot Nothing) Return ReplayEntry.FromDefinitionAndValue(Format.ReplayEntryChatMessage, New Dictionary(Of InvariantString, Object) From { @@ -111,8 +111,8 @@ Namespace WC3.Replay {"message", message}})}}) End Function - Public Function MakeTickPreOverflow(ByVal actions As IRist(Of Protocol.PlayerActionSet), - Optional ByVal duration As UInt16 = Nothing) As ReplayEntry + Public Function MakeTickPreOverflow(actions As IRist(Of Protocol.PlayerActionSet), + Optional duration As UInt16 = Nothing) As ReplayEntry Contract.Requires(actions IsNot Nothing) Contract.Ensures(Contract.Result(Of ReplayEntry)() IsNot Nothing) Return ReplayEntry.FromDefinitionAndValue(Format.ReplayEntryTickPreOverflow, New Dictionary(Of InvariantString, Object) From { @@ -120,8 +120,8 @@ Namespace WC3.Replay {"player action sets", actions}}) End Function - Public Function MakeTick(ByVal duration As UInt16, - ByVal actions As IRist(Of Protocol.PlayerActionSet)) As ReplayEntry + Public Function MakeTick(duration As UInt16, + actions As IRist(Of Protocol.PlayerActionSet)) As ReplayEntry Contract.Requires(actions IsNot Nothing) Contract.Ensures(Contract.Result(Of ReplayEntry)() IsNot Nothing) Return ReplayEntry.FromDefinitionAndValue(Format.ReplayEntryTick, New Dictionary(Of InvariantString, Object) From { diff --git a/Warcraft3/Replay/Replay Format.vb b/Warcraft3/Replay/Replay Format.vb index 413c5108..e586e597 100644 --- a/Warcraft3/Replay/Replay Format.vb +++ b/Warcraft3/Replay/Replay Format.vb @@ -39,7 +39,7 @@ Namespace WC3.Replay Return _allDefinitions.Values End Get End Property - Public Shared ReadOnly Property DefinitionFor(ByVal id As ReplayEntryId) As Definition + Public Shared ReadOnly Property DefinitionFor(id As ReplayEntryId) As Definition Get Contract.Ensures(Contract.Result(Of Definition)() IsNot Nothing) If Not _allDefinitions.ContainsKey(id) Then Throw New ArgumentException("No definition defined for id: {0}.".Frmt(id)) @@ -56,7 +56,7 @@ Namespace WC3.Replay Contract.Invariant(_jar IsNot Nothing) End Sub - Friend Sub New(ByVal id As ReplayEntryId, ByVal jar As ISimpleJar) + Friend Sub New(id As ReplayEntryId, jar As ISimpleJar) Contract.Requires(jar IsNot Nothing) Me._id = id Me._jar = jar @@ -83,7 +83,7 @@ Namespace WC3.Replay Contract.Invariant(_jar IsNot Nothing) End Sub - Friend Sub New(ByVal id As ReplayEntryId, ByVal jar As IJar(Of T)) + Friend Sub New(id As ReplayEntryId, jar As IJar(Of T)) MyBase.New(id, jar) Contract.Requires(jar IsNot Nothing) Me._jar = jar @@ -97,17 +97,17 @@ Namespace WC3.Replay End Property End Class - Private Shared Function Define(Of T)(ByVal id As ReplayEntryId, ByVal jar As IJar(Of T)) As Definition(Of T) + Private Shared Function Define(Of T)(id As ReplayEntryId, jar As IJar(Of T)) As Definition(Of T) Contract.Requires(jar IsNot Nothing) Contract.Ensures(Contract.Result(Of Definition(Of T))() IsNot Nothing) Dim result = New Definition(Of T)(id, jar) _allDefinitions.Add(id, result) Return result End Function - Private Shared Function Define(ByVal id As ReplayEntryId, - ByVal jar1 As ISimpleNamedJar, - ByVal jar2 As ISimpleNamedJar, - ByVal ParamArray jars() As ISimpleNamedJar) As Definition(Of NamedValueMap) + Private Shared Function Define(id As ReplayEntryId, + jar1 As ISimpleNamedJar, + jar2 As ISimpleNamedJar, + ParamArray jars() As ISimpleNamedJar) As Definition(Of NamedValueMap) Contract.Requires(jar1 IsNot Nothing) Contract.Requires(jar2 IsNot Nothing) Contract.Requires(jars IsNot Nothing) diff --git a/Warcraft3/Replay/ReplayDataReader.vb b/Warcraft3/Replay/ReplayDataReader.vb index f39bed00..d1c3a179 100644 --- a/Warcraft3/Replay/ReplayDataReader.vb +++ b/Warcraft3/Replay/ReplayDataReader.vb @@ -20,11 +20,11 @@ Contract.Invariant(_dataLength > 0) End Sub - Public Sub New(ByVal blockPosition As Long, - ByVal blockLength As Long, - ByVal dataPosition As Long, - ByVal dataLength As Long, - ByVal checksum As UInt32) + Public Sub New(blockPosition As Long, + blockLength As Long, + dataPosition As Long, + dataLength As Long, + checksum As UInt32) Contract.Requires(blockPosition >= 0) Contract.Requires(blockLength > 0) Contract.Requires(dataPosition >= 0) @@ -101,10 +101,10 @@ 'Contract.Invariant(_loadedBlockData Is Nothing OrElse _position <= _blockInfoTable(_loadedBlockIndex).NextDataPosition) End Sub - Public Sub New(ByVal subStream As IRandomReadableStream, - ByVal blockCount As UInt32, - ByVal firstBlockOffset As UInt32, - ByVal decompressedSize As UInt32) + Public Sub New(subStream As IRandomReadableStream, + blockCount As UInt32, + firstBlockOffset As UInt32, + decompressedSize As UInt32) Contract.Requires(subStream IsNot Nothing) Contract.Requires(blockCount >= 0) Contract.Requires(firstBlockOffset >= 0) @@ -121,7 +121,7 @@ ''' ''' The starting position of the block, as determined by the previous block's end. ''' The logical starting position of the data stored in the block. - Private Sub LoadNextBlockInfo(ByVal blockPosition As Long, ByVal dataPosition As Long) + Private Sub LoadNextBlockInfo(blockPosition As Long, dataPosition As Long) Contract.Requires(blockPosition >= 0) Contract.Requires(dataPosition >= 0) Contract.Requires(_blockInfoTable.Count < _blockCount) @@ -149,7 +149,7 @@ ''' ''' Determines the block info for the given block, filling the block info table as necessary. ''' - Private Function ReadBlockInfo(ByVal blockIndex As Integer) As BlockInfo + Private Function ReadBlockInfo(blockIndex As Integer) As BlockInfo Contract.Requires(blockIndex >= 0) Contract.Requires(blockIndex < _blockCount) Contract.Ensures(_blockInfoTable.Count > blockIndex) @@ -164,7 +164,7 @@ ''' ''' Determines the block data for the given block, filling the block info table as necessary. ''' - Private Function ReadBlockData(ByVal blockIndex As Integer) As IRist(Of Byte) + Private Function ReadBlockData(blockIndex As Integer) As IRist(Of Byte) Contract.Requires(blockIndex >= 0) Contract.Requires(blockIndex < _blockCount) Contract.Ensures(_blockInfoTable.Count > blockIndex) @@ -191,7 +191,7 @@ End Function '''Determines the block which contains the given position. - Private Function FindBlockIndexAt(ByVal position As Long) As Integer + Private Function FindBlockIndexAt(position As Long) As Integer Contract.Requires(position >= 0) Contract.Requires(position < _length) Contract.Ensures(Contract.Result(Of Integer)() >= 0) @@ -225,7 +225,7 @@ Throw New UnreachableException("A valid position was not contained in any block.") End Function - Public Function Read(ByVal maxCount As Integer) As IRist(Of Byte) Implements IReadableStream.Read + Public Function Read(maxCount As Integer) As IRist(Of Byte) Implements IReadableStream.Read Dim result = New List(Of Byte) If _blockCount = 0 Then Return result.AsRist() @@ -276,7 +276,7 @@ Contract.Assume(_position <= Length) Return _position End Get - Set(ByVal value As Long) + Set(value As Long) If value < _length Then Dim newBlockIndex = FindBlockIndexAt(value) If _loadedBlockData Is Nothing OrElse _loadedBlockIndex <> newBlockIndex Then @@ -289,7 +289,7 @@ End Set End Property - Protected Overrides Function PerformDispose(ByVal finalizing As Boolean) As Task + Protected Overrides Function PerformDispose(finalizing As Boolean) As Task _stream.Dispose() Return Nothing End Function diff --git a/Warcraft3/Replay/ReplayEntry.vb b/Warcraft3/Replay/ReplayEntry.vb index 00c1171f..98c75fdb 100644 --- a/Warcraft3/Replay/ReplayEntry.vb +++ b/Warcraft3/Replay/ReplayEntry.vb @@ -14,7 +14,7 @@ Namespace WC3.Replay Contract.Invariant(_definition IsNot Nothing) End Sub - Private Sub New(ByVal definition As Format.Definition, ByVal payload As Object) + Private Sub New(definition As Format.Definition, payload As Object) Contract.Requires(definition IsNot Nothing) Contract.Requires(payload IsNot Nothing) Contract.Ensures(Me.Definition Is definition) @@ -23,8 +23,8 @@ Namespace WC3.Replay Me._payload = payload End Sub - Public Shared Function FromDefinitionAndValue(Of TPayload)(ByVal definition As Format.Definition(Of TPayload), - ByVal payload As TPayload) As ReplayEntry + Public Shared Function FromDefinitionAndValue(Of TPayload)(definition As Format.Definition(Of TPayload), + payload As TPayload) As ReplayEntry Contract.Requires(definition IsNot Nothing) Contract.Requires(payload IsNot Nothing) Contract.Ensures(Contract.Result(Of ReplayEntry)() IsNot Nothing) @@ -44,21 +44,21 @@ Namespace WC3.Replay End Get End Property - Public Shared Widening Operator CType(ByVal value As ReplayEntry) As KeyValuePair(Of ReplayEntryId, Object) + Public Shared Widening Operator CType(value As ReplayEntry) As KeyValuePair(Of ReplayEntryId, Object) Contract.Requires(value IsNot Nothing) Return value.Definition.Id.KeyValue(value.Payload) End Operator - Public Shared Widening Operator CType(ByVal value As KeyValuePair(Of ReplayEntryId, Object)) As ReplayEntry + Public Shared Widening Operator CType(value As KeyValuePair(Of ReplayEntryId, Object)) As ReplayEntry Contract.Ensures(Contract.Result(Of ReplayEntry)() IsNot Nothing) Contract.Assume(value.Value IsNot Nothing) Return New ReplayEntry(Format.DefinitionFor(value.Key), value.Value) End Operator - Public Overloads Function Equals(ByVal other As ReplayEntry) As Boolean Implements System.IEquatable(Of ReplayEntry).Equals + Public Overloads Function Equals(other As ReplayEntry) As Boolean Implements System.IEquatable(Of ReplayEntry).Equals If other Is Nothing Then Return False Return SharedJar.Pack(Me).SequenceEqual(SharedJar.Pack(other)) End Function - Public Overrides Function Equals(ByVal obj As Object) As Boolean + Public Overrides Function Equals(obj As Object) As Boolean Return Me.Equals(TryCast(obj, ReplayEntry)) End Function Public Overrides Function GetHashCode() As Integer @@ -82,11 +82,11 @@ Namespace WC3.Replay Return DataJar End Function - Public Overrides Function PackRaw(ByVal value As ReplayEntry) As KeyValuePair(Of ReplayEntryId, Object) + Public Overrides Function PackRaw(value As ReplayEntry) As KeyValuePair(Of ReplayEntryId, Object) Contract.Assume(value IsNot Nothing) Return value End Function - Public Overrides Function ParseRaw(ByVal value As KeyValuePair(Of ReplayEntryId, Object)) As ReplayEntry + Public Overrides Function ParseRaw(value As KeyValuePair(Of ReplayEntryId, Object)) As ReplayEntry Return value End Function End Class diff --git a/Warcraft3/Replay/ReplayManager.vb b/Warcraft3/Replay/ReplayManager.vb index fef6d963..11ee284f 100644 --- a/Warcraft3/Replay/ReplayManager.vb +++ b/Warcraft3/Replay/ReplayManager.vb @@ -17,15 +17,15 @@ Contract.Invariant(_hooks IsNot Nothing) End Sub - Private Sub New(ByVal writer As ReplayWriter, - ByVal infoProvider As IProductInfoProvider) + Private Sub New(writer As ReplayWriter, + infoProvider As IProductInfoProvider) Contract.Requires(writer IsNot Nothing) Contract.Requires(infoProvider IsNot Nothing) Me._writer = writer Me._infoProvider = infoProvider End Sub - Private Sub Wire(ByVal game As Game) + Private Sub Wire(game As Game) Contract.Requires(game IsNot Nothing) Dim tickHandler As Game.TickEventHandler = @@ -50,12 +50,12 @@ game.ChainEventualDisposalTo(Me) End Sub - Public Shared Function StartRecordingFrom(ByVal defaultFileName As String, - ByVal game As Game, - ByVal players As IEnumerable(Of Player), - ByVal slots As IEnumerable(Of Slot), - ByVal randomSeed As UInt32, - ByVal infoProvider As IProductInfoProvider) As ReplayManager + Public Shared Function StartRecordingFrom(defaultFileName As String, + game As Game, + players As IEnumerable(Of Player), + slots As IEnumerable(Of Slot), + randomSeed As UInt32, + infoProvider As IProductInfoProvider) As ReplayManager Contract.Requires(game IsNot Nothing) Contract.Requires(players IsNot Nothing) Contract.Requires(slots IsNot Nothing) @@ -122,8 +122,8 @@ Return result End Function - Private Sub OnTick(ByVal duration As UShort, - ByVal visibleActionStreaks As IRist(Of IRist(Of Protocol.PlayerActionSet))) + Private Sub OnTick(duration As UShort, + visibleActionStreaks As IRist(Of IRist(Of Protocol.PlayerActionSet))) Contract.Requires(visibleActionStreaks IsNot Nothing) For Each visibleActionStreak In visibleActionStreaks.SkipLast(1) Contract.Assume(visibleActionStreak IsNot Nothing) @@ -132,9 +132,9 @@ _writer.WriteEntry(MakeTick(duration, If(visibleActionStreaks.LastOrDefault, MakeRist(Of Protocol.PlayerActionSet)()))) End Sub - Private Sub OnChat(ByVal speaker As Player, - ByVal text As String, - ByVal receivingGroup As Protocol.ChatGroup?) + Private Sub OnChat(speaker As Player, + text As String, + receivingGroup As Protocol.ChatGroup?) Contract.Requires(speaker IsNot Nothing) Contract.Requires(text IsNot Nothing) If receivingGroup Is Nothing Then @@ -143,13 +143,13 @@ _writer.WriteEntry(MakeGameChatMessage(speaker.Id, text, receivingGroup.Value)) End If End Sub - Private Sub Onleave(ByVal leaver As Player, - ByVal reportedResult As Protocol.PlayerLeaveReason) + Private Sub Onleave(leaver As Player, + reportedResult As Protocol.PlayerLeaveReason) Contract.Requires(leaver IsNot Nothing) _writer.WriteEntry(MakePlayerLeft(0, leaver.Id, reportedResult, 0)) End Sub - Protected Overrides Function PerformDispose(ByVal finalizing As Boolean) As Task + Protected Overrides Function PerformDispose(finalizing As Boolean) As Task If finalizing Then Return Nothing Return inQueue.QueueFunc( Function() diff --git a/Warcraft3/Replay/ReplayReader.vb b/Warcraft3/Replay/ReplayReader.vb index 770a8b22..e6fa3680 100644 --- a/Warcraft3/Replay/ReplayReader.vb +++ b/Warcraft3/Replay/ReplayReader.vb @@ -18,15 +18,15 @@ Namespace WC3.Replay Contract.Invariant(_gameDuration.Ticks >= 0) End Sub - Public Sub New(ByVal streamFactory As Func(Of IRandomReadableStream), - ByVal description As Lazy(Of String), - ByVal headerSize As UInt32, - ByVal dataDecompressedSize As UInt32, - ByVal dataBlockCount As UInt32, - ByVal wc3Version As UInt32, - ByVal replayVersion As UInt16, - ByVal settings As ReplaySettings, - ByVal gameDuration As TimeSpan) + Public Sub New(streamFactory As Func(Of IRandomReadableStream), + description As Lazy(Of String), + headerSize As UInt32, + dataDecompressedSize As UInt32, + dataBlockCount As UInt32, + wc3Version As UInt32, + replayVersion As UInt16, + settings As ReplaySettings, + gameDuration As TimeSpan) Contract.Requires(streamFactory IsNot Nothing) Contract.Requires(description IsNot Nothing) Contract.Requires(gameDuration.Ticks >= 0) @@ -41,12 +41,12 @@ Namespace WC3.Replay Me._gameDuration = gameDuration End Sub - Public Shared Function FromFile(ByVal path As String) As ReplayReader + Public Shared Function FromFile(path As String) As ReplayReader Contract.Requires(path IsNot Nothing) Contract.Ensures(Contract.Result(Of ReplayReader)() IsNot Nothing) Return ReplayReader.FromStreamFactory(Function() New IO.FileStream(path, IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read).AsRandomReadableStream) End Function - Public Shared Function FromStreamFactory(ByVal streamFactory As Func(Of IRandomReadableStream)) As ReplayReader + Public Shared Function FromStreamFactory(streamFactory As Func(Of IRandomReadableStream)) As ReplayReader Contract.Requires(streamFactory IsNot Nothing) Contract.Ensures(Contract.Result(Of ReplayReader)() IsNot Nothing) diff --git a/Warcraft3/Replay/ReplayWriter.vb b/Warcraft3/Replay/ReplayWriter.vb index 291b1a97..7eeebab9 100644 --- a/Warcraft3/Replay/ReplayWriter.vb +++ b/Warcraft3/Replay/ReplayWriter.vb @@ -32,11 +32,11 @@ Namespace WC3.Replay Contract.Invariant(_blockSizeRemaining <= BlockSize) End Sub - Public Sub New(ByVal stream As IRandomWritableStream, - ByVal settings As ReplaySettings, - ByVal wc3Version As UInt32, - ByVal replayVersion As UInt16, - Optional ByVal duration As UInt32? = Nothing) + Public Sub New(stream As IRandomWritableStream, + settings As ReplaySettings, + wc3Version As UInt32, + replayVersion As UInt16, + Optional duration As UInt32? = Nothing) Contract.Requires(stream IsNot Nothing) Me._stream = stream @@ -93,7 +93,7 @@ Namespace WC3.Replay Contract.Assume(_startPosition <= _stream.Length) End Sub - Public Sub WriteData(ByVal data As IRist(Of Byte)) + Public Sub WriteData(data As IRist(Of Byte)) Contract.Requires(data IsNot Nothing) If Me.IsDisposed Then Throw New ObjectDisposedException(Me.GetType.Name) @@ -111,7 +111,7 @@ Namespace WC3.Replay End If Contract.Assume(_blockSizeRemaining >= 0) End Sub - Public Sub WriteEntry(ByVal entry As ReplayEntry) + Public Sub WriteEntry(entry As ReplayEntry) Contract.Requires(entry IsNot Nothing) WriteData(entryJar.Pack(entry).ToRist) End Sub @@ -146,7 +146,7 @@ Namespace WC3.Replay End Using End Function - Protected Overrides Function PerformDispose(ByVal finalizing As Boolean) As Task + Protected Overrides Function PerformDispose(finalizing As Boolean) As Task EndBlock() _stream.WriteAt(position:=_startPosition, data:=GenerateHeader())