51 lines
2.0 KiB
VB.net
51 lines
2.0 KiB
VB.net
Imports DigitalData.Modules.Logging
|
|
|
|
Namespace Modules
|
|
Public Class Clipboard
|
|
Inherits BaseModule
|
|
Implements IModule
|
|
|
|
Public Const CLIP_VALUE_BOARD As String = "BOARD"
|
|
|
|
Public Const CLIPBOARD_VALUE_DE = "@Zwischenablage"
|
|
Public Const CLIPBOARD_VALUE_EN = "@Clipboard"
|
|
|
|
Public Property PatternIdentifier As String = "CLIP" Implements IModule.PatternIdentifier
|
|
Public Property IsComplex As Boolean = False 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
|
|
Dim oClipboardContents = pReplaceMap.Item(CLIP_VALUE_BOARD)
|
|
|
|
Try
|
|
' LEGACY: Replace Clipboard Contents
|
|
oResult = oResult.Replace(CLIPBOARD_VALUE_DE.ToLower, oClipboardContents)
|
|
oResult = oResult.Replace(CLIPBOARD_VALUE_DE.ToUpper, oClipboardContents)
|
|
oResult = oResult.Replace(CLIPBOARD_VALUE_DE, oClipboardContents)
|
|
|
|
oResult = oResult.Replace(CLIPBOARD_VALUE_EN.ToLower, oClipboardContents)
|
|
oResult = oResult.Replace(CLIPBOARD_VALUE_EN.ToUpper, oClipboardContents)
|
|
oResult = oResult.Replace(CLIPBOARD_VALUE_EN, oClipboardContents)
|
|
|
|
' Replace Clipboard Contents
|
|
While ContainsPatternAndValue(oResult, PatternIdentifier, CLIP_VALUE_BOARD)
|
|
oResult = ReplacePattern(oResult, PatternIdentifier, oClipboardContents)
|
|
IncrementCounterOrThrow(oCounter)
|
|
End While
|
|
|
|
Logger.Debug("Input after Clipboard.Replace: [{0}]", pInput)
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
|
|
End Try
|
|
|
|
Return oResult
|
|
End Function
|
|
End Class
|
|
End Namespace
|