EDMIService: Automatic indexing, more consolidation of globix logic
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports System.IO
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports System.Windows.Forms
|
||||
Imports DigitalData.Controls.LookupGrid
|
||||
Imports DigitalData.Modules.Logging
|
||||
@@ -65,7 +66,8 @@ Public Class Patterns2
|
||||
New Modules.Internal(LogConfig),
|
||||
New Modules.Clipboard(LogConfig),
|
||||
New Modules.Controls(LogConfig),
|
||||
New Modules.User(LogConfig)
|
||||
New Modules.User(LogConfig),
|
||||
New Modules.FileInformation(LogConfig)
|
||||
})
|
||||
End Sub
|
||||
|
||||
@@ -75,12 +77,12 @@ Public Class Patterns2
|
||||
IDBActive = pIDBActive
|
||||
End Sub
|
||||
|
||||
Public Function ReplaceAllValues(pInput As String, pPanel As Panel, pUser As State.UserState) As String
|
||||
Public Function ReplaceAllValues(pInput As String, pPanel As Panel, pUser As State.UserState, pFIleinfo As FileInfo) As String
|
||||
Dim oResult = pInput
|
||||
|
||||
For Each oModule In Modules
|
||||
Try
|
||||
Dim oArgs = GetReplaceMapForModule(oModule, pPanel, pUser)
|
||||
Dim oArgs = GetReplaceMapForModule(oModule, pPanel:=pPanel, pUser:=pUser, pFileInfo:=pFIleinfo)
|
||||
oResult = oModule.Replace(oResult, oArgs)
|
||||
Catch ex As Exception
|
||||
Logger.Warn("Placeholders for String [{0}] could not be replaced completely in Module [{1}]. Skipping.", pInput, oModule.GetType.Name)
|
||||
@@ -101,6 +103,16 @@ Public Class Patterns2
|
||||
Return oResult
|
||||
End Function
|
||||
|
||||
Public Function ReplaceFileValues(pInput As String, pFileInfo As FileInfo) As String
|
||||
Dim oResult = pInput
|
||||
|
||||
Dim oModule = GetModule(Of Modules.User)()
|
||||
Dim oArgs = GetReplaceMapForModule(oModule, pFileInfo:=pFileInfo)
|
||||
oResult = DoReplaceForModule(oResult, oModule, oArgs)
|
||||
|
||||
Return oResult
|
||||
End Function
|
||||
|
||||
Public Function ReplaceControlValues(pInput As String, pPanel As Panel) As String
|
||||
Dim oResult = pInput
|
||||
|
||||
@@ -135,16 +147,18 @@ Public Class Patterns2
|
||||
Return oResult
|
||||
End Function
|
||||
|
||||
Public Function ReplaceGlobixValues(pInput As String) As String
|
||||
Public Function ReplaceGlobixValues(pInput As String, pGlobixIndexes As Dictionary(Of String, List(Of String))) As String
|
||||
Dim oResult = pInput
|
||||
|
||||
Dim oGlobixModule = GetModule(Of Modules.Globix)()
|
||||
Dim oGlobixArgs = GetReplaceMapForModule(oGlobixModule)
|
||||
Dim oGlobixArgs = GetReplaceMapForModule(oGlobixModule, pGlobixIndexes:=pGlobixIndexes)
|
||||
oResult = DoReplaceForModule(oResult, oGlobixModule, oGlobixArgs)
|
||||
|
||||
Return oResult
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
Private Function DoReplaceForModule(pInput As String, pModule As IModule, pArgs As Dictionary(Of String, Object)) As String
|
||||
Try
|
||||
pInput = pModule.Replace(pInput, pArgs)
|
||||
@@ -166,7 +180,8 @@ Public Class Patterns2
|
||||
Optional pPanel As Panel = Nothing,
|
||||
Optional pUser As State.UserState = Nothing,
|
||||
Optional pWMObject As WMObject = Nothing,
|
||||
Optional pGlobixIndexes As Dictionary(Of String, List(Of String)) = Nothing
|
||||
Optional pGlobixIndexes As Dictionary(Of String, List(Of String)) = Nothing,
|
||||
Optional pFileInfo As FileInfo = Nothing
|
||||
) As Dictionary(Of String, Object)
|
||||
Dim oArgs As New Dictionary(Of String, Object)
|
||||
|
||||
@@ -177,12 +192,9 @@ Public Class Patterns2
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
|
||||
ElseIf TypeOf pModule Is Modules.Internal Then
|
||||
ElseIf TypeOf pModule Is Modules.FileInformation Then
|
||||
Try
|
||||
oArgs.Add(Patterns.Modules.Internal.INT_VALUE_USERNAME, System.Environment.UserName)
|
||||
oArgs.Add(Patterns.Modules.Internal.INT_VALUE_MACHINE, System.Environment.MachineName)
|
||||
oArgs.Add(Patterns.Modules.Internal.INT_VALUE_DOMAIN, System.Environment.UserDomainName)
|
||||
oArgs.Add(Patterns.Modules.Internal.INT_VALUE_DATE, Now.ToShortDateString)
|
||||
oArgs.Add(Patterns.Modules.FileInformation.FILE_VALUE_FILEINFO, pFileInfo)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
|
||||
Reference in New Issue
Block a user