2021-11-04 10:40:56 +01:00

61 lines
2.6 KiB
VB.net

Imports DigitalData.Modules.Logging
Namespace [PatternModule]
Public Class User
Inherits BaseModule
Implements IModule
Public Const USER_VALUE_PRENAME = "PRENAME"
Public Const USER_VALUE_SURNAME = "SURNAME"
Public Const USER_VALUE_EMAIL = "EMAIL"
Public Const USER_VALUE_SHORTNAME = "SHORTNAME"
Public Const USER_VALUE_LANGUAGE = "LANGUAGE"
Public Const USER_VALUE_USER_ID = "USER_ID"
Public Const USER_VALUE_USER_NAME = "USER_NAME"
Public Property PatternIdentifier As String = "USER" Implements IModule.PatternIdentifier
Public Property IsComplex As Boolean = True Implements IModule.IsComplex
Public Sub New(pLogConfig As LogConfig)
MyBase.New(pLogConfig)
End Sub
Public Function Replace(pInput As String, pReplaceMap As Dictionary(Of String, Object)) As String Implements IModule.Replace
Dim oResult = pInput
Dim oCounter = 0
While ContainsPatternAndValue(oResult, PatternIdentifier, USER_VALUE_PRENAME)
oResult = ReplacePattern(oResult, PatternIdentifier, pReplaceMap.Item(USER_VALUE_PRENAME))
IncrementCounterOrThrow(oCounter)
End While
While ContainsPatternAndValue(oResult, PatternIdentifier, USER_VALUE_SURNAME)
oResult = ReplacePattern(oResult, PatternIdentifier, pReplaceMap.Item(USER_VALUE_SURNAME))
IncrementCounterOrThrow(oCounter)
End While
While ContainsPatternAndValue(oResult, PatternIdentifier, USER_VALUE_EMAIL)
oResult = ReplacePattern(oResult, PatternIdentifier, pReplaceMap.Item(USER_VALUE_EMAIL))
IncrementCounterOrThrow(oCounter)
End While
While ContainsPatternAndValue(oResult, PatternIdentifier, USER_VALUE_SHORTNAME)
oResult = ReplacePattern(oResult, PatternIdentifier, pReplaceMap.Item(USER_VALUE_SHORTNAME))
IncrementCounterOrThrow(oCounter)
End While
While ContainsPatternAndValue(oResult, PatternIdentifier, USER_VALUE_LANGUAGE)
oResult = ReplacePattern(oResult, PatternIdentifier, pReplaceMap.Item(USER_VALUE_LANGUAGE))
IncrementCounterOrThrow(oCounter)
End While
While ContainsPatternAndValue(oResult, PatternIdentifier, USER_VALUE_USER_ID)
oResult = ReplacePattern(oResult, PatternIdentifier, pReplaceMap.Item(USER_VALUE_USER_ID))
IncrementCounterOrThrow(oCounter)
End While
Return oResult
End Function
End Class
End Namespace