Skip to content

Commit

Permalink
Removing redundant ByVals (part 4)
Browse files Browse the repository at this point in the history
  • Loading branch information
Strilanc committed Mar 17, 2011
1 parent 1bbeaca commit 38ae200
Show file tree
Hide file tree
Showing 38 changed files with 598 additions and 598 deletions.
18 changes: 9 additions & 9 deletions Plugins/Plugin Interfaces.vb
Expand Up @@ -2,7 +2,7 @@ Namespace Plugins
<Serializable()>
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
Expand All @@ -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)

<ContractClassFor(GetType(IPlugin))>
MustInherit Shadows Class ContractClass
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -71,13 +71,13 @@ Namespace Plugins

<ContractClass(GetType(IPluginFactory.ContractClass))>
Public Interface IPluginFactory
Function CreatePlugin(ByVal bot As Bot.MainBot) As IPlugin
Function CreatePlugin(bot As Bot.MainBot) As IPlugin

<ContractClassFor(GetType(IPluginFactory))>
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()
Expand Down
12 changes: 6 additions & 6 deletions Plugins/Plugin Manager.vb
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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.")
Expand All @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions Plugins/Plugin Socket.vb
Expand Up @@ -12,9 +12,9 @@ Namespace Plugins
End Sub

<CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2001:AvoidCallingProblematicMethods", MessageId:="System.Reflection.Assembly.LoadFrom")>
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
Expand Down Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions Warcraft3/Download/Download Client.vb
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
40 changes: 20 additions & 20 deletions Warcraft3/Download/Download Manager.vb
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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))
Expand All @@ -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 {
Expand All @@ -187,22 +187,22 @@ 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)
Return inQueue.QueueAction(Sub() OnReceiveClientMapInfo(player:=player,
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

Expand All @@ -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

Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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()
Expand Down
12 changes: 6 additions & 6 deletions Warcraft3/Download/Download Transfer.vb
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 38ae200

Please sign in to comment.