From fa930c92fa6d8dfe0ea2588f526fc692f2617043 Mon Sep 17 00:00:00 2001 From: xieguigang Date: Fri, 5 Oct 2018 21:53:43 +0800 Subject: [PATCH] code style improvements --- .../Network/Protocol/Reflection/AppMgr.vb | 95 ++++++++++--------- .../Protocol/Reflection/ProtocolHandler.vb | 73 +++++++------- 2 files changed, 84 insertions(+), 84 deletions(-) diff --git a/ApplicationServices/Tools/Network/Protocol/Reflection/AppMgr.vb b/ApplicationServices/Tools/Network/Protocol/Reflection/AppMgr.vb index a4871c07..e48950c8 100644 --- a/ApplicationServices/Tools/Network/Protocol/Reflection/AppMgr.vb +++ b/ApplicationServices/Tools/Network/Protocol/Reflection/AppMgr.vb @@ -1,51 +1,51 @@ #Region "Microsoft.VisualBasic::2b0445de7dfb962360dc63693f8cbfeb, Microsoft.VisualBasic.Core\ApplicationServices\Tools\Network\Protocol\Reflection\AppMgr.vb" - ' Author: - ' - ' asuka (amethyst.asuka@gcmodeller.org) - ' xie (genetics@smrucc.org) - ' xieguigang (xie.guigang@live.com) - ' - ' Copyright (c) 2018 GPL3 Licensed - ' - ' - ' GNU GENERAL PUBLIC LICENSE (GPL3) - ' - ' - ' This program is free software: you can redistribute it and/or modify - ' it under the terms of the GNU General Public License as published by - ' the Free Software Foundation, either version 3 of the License, or - ' (at your option) any later version. - ' - ' This program is distributed in the hope that it will be useful, - ' but WITHOUT ANY WARRANTY; without even the implied warranty of - ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ' GNU General Public License for more details. - ' - ' You should have received a copy of the GNU General Public License - ' along with this program. If not, see . +' Author: +' +' asuka (amethyst.asuka@gcmodeller.org) +' xie (genetics@smrucc.org) +' xieguigang (xie.guigang@live.com) +' +' Copyright (c) 2018 GPL3 Licensed +' +' +' GNU GENERAL PUBLIC LICENSE (GPL3) +' +' +' This program is free software: you can redistribute it and/or modify +' it under the terms of the GNU General Public License as published by +' the Free Software Foundation, either version 3 of the License, or +' (at your option) any later version. +' +' This program is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU General Public License for more details. +' +' You should have received a copy of the GNU General Public License +' along with this program. If not, see . - ' /********************************************************************************/ +' /********************************************************************************/ - ' Summaries: +' Summaries: - ' Class AppMgr - ' - ' Properties: ProtocolApps, ProtocolEntry - ' - ' Constructor: (+1 Overloads) Sub New - ' Function: HandleRequest, Register, RegisterApp - ' - ' - ' /********************************************************************************/ +' Class AppMgr +' +' Properties: ProtocolApps, ProtocolEntry +' +' Constructor: (+1 Overloads) Sub New +' Function: HandleRequest, Register, RegisterApp +' +' +' /********************************************************************************/ #End Region -Imports System.Net Imports Microsoft.VisualBasic.Net.Abstract Imports Microsoft.VisualBasic.Net.Http +Imports TcpEndPoint = System.Net.IPEndPoint Namespace Net.Protocols.Reflection @@ -54,8 +54,7 @@ Namespace Net.Protocols.Reflection ''' Public Class AppMgr : Inherits IProtocolHandler - Public ReadOnly Property ProtocolApps As Dictionary(Of Long, ProtocolHandler) = - New Dictionary(Of Long, ProtocolHandler) + Public ReadOnly Property ProtocolApps As New Dictionary(Of Long, ProtocolHandler) Public Overrides ReadOnly Property ProtocolEntry As Long Get @@ -68,20 +67,22 @@ Namespace Net.Protocols.Reflection End Sub Public Function Register(app As Object, [overrides] As Boolean) As Boolean - Dim Protocol = ProtocolHandler.SafelyCreateObject(app) + Dim protocol = ProtocolHandler.SafelyCreateObject(app) - If Protocol Is Nothing Then + If protocol Is Nothing Then Return False End If - If ProtocolApps.ContainsKey(Protocol.ProtocolEntry) Then + If ProtocolApps.ContainsKey(protocol.ProtocolEntry) Then If [overrides] Then - Call ProtocolApps.Remove(Protocol.ProtocolEntry) ' 覆盖掉原有的协议数据 + ' 覆盖掉原有的协议数据 + Call ProtocolApps.Remove(protocol.ProtocolEntry) Else - Return False ' 没有被注册 + ' 没有被注册 + Return False End If End If - Call ProtocolApps.Add(Protocol.ProtocolEntry, Protocol) + Call ProtocolApps.Add(protocol.ProtocolEntry, protocol) Return True End Function @@ -97,13 +98,13 @@ Namespace Net.Protocols.Reflection Return Register(DirectCast(App, Object), [overrides]) End Function - Public Overrides Function HandleRequest(request As RequestStream, remoteDevcie As System.Net.IPEndPoint) As RequestStream + Public Overrides Function HandleRequest(request As RequestStream, remoteDevcie As TcpEndPoint) As RequestStream If Not ProtocolApps.ContainsKey(request.ProtocolCategory) Then Return NetResponse.RFC_NOT_FOUND End If - Dim Protocol As ProtocolHandler = ProtocolApps(request.ProtocolCategory) - Return Protocol.HandleRequest(request, remoteDevcie) + Dim protocol As ProtocolHandler = ProtocolApps(request.ProtocolCategory) + Return protocol.HandleRequest(request, remoteDevcie) End Function End Class End Namespace diff --git a/ApplicationServices/Tools/Network/Protocol/Reflection/ProtocolHandler.vb b/ApplicationServices/Tools/Network/Protocol/Reflection/ProtocolHandler.vb index 0ccf69af..e6675b50 100644 --- a/ApplicationServices/Tools/Network/Protocol/Reflection/ProtocolHandler.vb +++ b/ApplicationServices/Tools/Network/Protocol/Reflection/ProtocolHandler.vb @@ -1,49 +1,48 @@ #Region "Microsoft.VisualBasic::c398a6f52c8a576693287a14ae9a4418, Microsoft.VisualBasic.Core\ApplicationServices\Tools\Network\Protocol\Reflection\ProtocolHandler.vb" - ' Author: - ' - ' asuka (amethyst.asuka@gcmodeller.org) - ' xie (genetics@smrucc.org) - ' xieguigang (xie.guigang@live.com) - ' - ' Copyright (c) 2018 GPL3 Licensed - ' - ' - ' GNU GENERAL PUBLIC LICENSE (GPL3) - ' - ' - ' This program is free software: you can redistribute it and/or modify - ' it under the terms of the GNU General Public License as published by - ' the Free Software Foundation, either version 3 of the License, or - ' (at your option) any later version. - ' - ' This program is distributed in the hope that it will be useful, - ' but WITHOUT ANY WARRANTY; without even the implied warranty of - ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ' GNU General Public License for more details. - ' - ' You should have received a copy of the GNU General Public License - ' along with this program. If not, see . +' Author: +' +' asuka (amethyst.asuka@gcmodeller.org) +' xie (genetics@smrucc.org) +' xieguigang (xie.guigang@live.com) +' +' Copyright (c) 2018 GPL3 Licensed +' +' +' GNU GENERAL PUBLIC LICENSE (GPL3) +' +' +' This program is free software: you can redistribute it and/or modify +' it under the terms of the GNU General Public License as published by +' the Free Software Foundation, either version 3 of the License, or +' (at your option) any later version. +' +' This program is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU General Public License for more details. +' +' You should have received a copy of the GNU General Public License +' along with this program. If not, see . - ' /********************************************************************************/ +' /********************************************************************************/ - ' Summaries: +' Summaries: - ' Class ProtocolHandler - ' - ' Properties: DeclaringType, ProtocolEntry - ' - ' Constructor: (+1 Overloads) Sub New - ' Function: GetMethod, HandlePush, HandleRequest, (+2 Overloads) SafelyCreateObject, ToString - ' - ' - ' /********************************************************************************/ +' Class ProtocolHandler +' +' Properties: DeclaringType, ProtocolEntry +' +' Constructor: (+1 Overloads) Sub New +' Function: GetMethod, HandlePush, HandleRequest, (+2 Overloads) SafelyCreateObject, ToString +' +' +' /********************************************************************************/ #End Region -Imports System.Net Imports Microsoft.VisualBasic.Net.Abstract Imports Microsoft.VisualBasic.Net.Http @@ -54,7 +53,7 @@ Namespace Net.Protocols.Reflection ''' Public Class ProtocolHandler : Inherits IProtocolHandler - Protected Protocols As Dictionary(Of Long, Net.Abstract.DataRequestHandler) + Protected Protocols As Dictionary(Of Long, DataRequestHandler) ''' ''' 这个类型建议一般为某种枚举类型 '''