ZooFlow: clean up

This commit is contained in:
Jonathan Jenne
2021-01-12 16:05:35 +01:00
parent b49d4b4ff7
commit 4b2ef12a55
8 changed files with 93 additions and 178 deletions

View File

@@ -94,7 +94,7 @@ Public Class ClassFileDrop
End If
End If
If e.Data.GetDataPresent("FileGroupDescriptor") Then
Dim oApp
Dim oApp As Outlook.Application
Try
oApp = New Outlook.Application()
Catch ex As Exception

View File

@@ -5,10 +5,10 @@ Imports DigitalData.Modules.Logging
Public Class GlobixPatterns
Private _Logger As Logger
Private _idbdata As clsIDBData
Private _idbdata As ClassIDBData
Public Sub New(LogConfig As LogConfig)
_Logger = LogConfig.GetLogger
_idbdata = New clsIDBData(LogConfig)
_idbdata = New ClassIDBData(LogConfig)
End Sub
' Complex patterns that rely on a datasource like a Database or Windream
Public Const PATTERN_WMI = "WMI"
@@ -261,12 +261,12 @@ Public Class GlobixPatterns
End Function
Public Function ReplaceIDBAttributes(IDB_OBJ_ID As Long, pInput As String, IS_SQL As Boolean) As String
Try
Dim result = pInput
Dim oResult = pInput
Dim oTryCounter As Integer = 0
While ContainsPattern(result, PATTERN_IDBA)
While ContainsPattern(oResult, PATTERN_IDBA)
Dim indexName As String = GetNextPattern(result, PATTERN_IDBA).Value
Dim oIDBValue
Dim indexName As String = GetNextPattern(oResult, PATTERN_IDBA).Value
Dim oIDBValue As Object
If indexName = "ObjectID" Then
oIDBValue = IDB_OBJ_ID
ElseIf indexName = "OBJID" Then
@@ -280,7 +280,7 @@ Public Class GlobixPatterns
If IsNothing(oIDBValue) And oTryCounter = MAX_TRY_COUNT Then
_Logger.Warn($"Max tries for [{indexName}] in ReplaceIDBAttributes exceeded - Replacing with [0]!")
Dim oReplaceValue = "{" + $"#{PATTERN_IDBA}#{indexName}" + "}"
result = result.Replace(oReplaceValue, 0)
oResult = oResult.Replace(oReplaceValue, 0)
Throw New Exception("Max tries in ReplaceIDBAttributes exceeded.")
End If
@@ -299,87 +299,24 @@ Public Class GlobixPatterns
End If
_Logger.Debug($"oIDBValue = {oIDBValue}")
End If
result = result.Replace(oReplaceValue, oIDBValue)
oResult = oResult.Replace(oReplaceValue, oIDBValue)
Else
_Logger.Warn($"IDBValue for [{indexName}] in ReplaceIDBAttributes is nothing or dbnull - Replacing with [0]!")
Dim oReplaceValue = "{" + $"#{PATTERN_IDBA}#{indexName}" + "}"
result = result.Replace(oReplaceValue, 0)
oResult = oResult.Replace(oReplaceValue, 0)
End If
oTryCounter += 100
End While
_Logger.Debug("sql after ReplaceIDBAttributes: " & pInput)
Return result
Return oResult
Catch ex As Exception
_Logger.Error(ex)
_Logger.Info("Error in ReplaceIDBAttributes:" & ex.Message)
Return pInput
End Try
End Function
'Public Function ReplaceWindreamIndicies(input As String, document As WMObject) As String
' Try
' Dim result = input
' Dim oTryCounter As Integer = 0
' While ContainsPattern(result, PATTERN_WMI)
' Dim indexName As String = GetNextPattern(result, PATTERN_WMI).Value
' Dim oWMValue = document.GetVariableValue(indexName)
' If IsNothing(oWMValue) And oTryCounter = MAX_TRY_COUNT Then
' _Logger.Warn("Exit from ReplaceWindreamIndicies as oWMValue is still nothing and oTryCounter is 500!")
' Throw New Exception("Max tries in ReplaceWindreamIndicies exceeded.")
' End If
' If oWMValue IsNot Nothing Then
' result = ReplacePattern(result, PATTERN_WMI, oWMValue)
' End If
' oTryCounter += 100
' End While
' _Logger.Debug("sql after ReplaceWindreamIndicies: " & input)
' Return result
' Catch ex As Exception
' _Logger.Error(ex)
' _Logger.Info("Error in ReplaceWindreamIndicies:" & ex.Message)
' End Try
'End Function
'Public Function ReplaceIDBAttributes(input As String) As String
' Try
' Dim result = input
' Dim oTryCounter As Integer = 0
' While ContainsPattern(result, PATTERN_IDBA)
' Dim indexName As String = GetNextPattern(result, PATTERN_IDBA).Value
' Dim oIDBValue
' If indexName = "ObjectID" Then
' oIDBValue = CURRENT_DOC_ID
' ElseIf indexName = "OBJID" Then
' oIDBValue = CURRENT_DOC_ID
' ElseIf indexName = "DocID" Then
' oIDBValue = CURRENT_DOC_ID
' Else
' oIDBValue = IDBData.GetVariableValue(indexName)
' End If
' If IsNothing(oIDBValue) And oTryCounter = MAX_TRY_COUNT Then
' _Logger.Warn("Exit from ReplaceIDBIndicies as Value is still nothing and oTryCounter is 500!")
' Throw New Exception("Max tries in ReplaceIDBAttributes exceeded.")
' End If
' If oIDBValue IsNot Nothing Then
' Dim oReplaceValue = "{" + $"#{PATTERN_IDBA}#{indexName}" + "}"
' result = result.Replace(oReplaceValue, oIDBValue)
' 'result = ReplacePattern(result, oReplaceValue, oIDBValue)
' End If
' oTryCounter += 100
' End While
' _Logger.Debug("sql after ReplaceIDBAttributes: " & input)
' Return result
' Catch ex As Exception
' _Logger.Error(ex)
' _Logger.Info("Error in ReplaceIDBAttributes:" & ex.Message)
' End Try
'End Function
Private Function ContainsPattern(input As String, type As String) As String
Private Function ContainsPattern(input As String, type As String) As Boolean
Dim elements As MatchCollection = myregex.Matches(input)
For Each element As Match In elements
@@ -459,9 +396,9 @@ Public Class GlobixPatterns
Return False
End Function
Public Function HasAnyPatterns(input) As Boolean
Public Function HasAnyPatterns(pInput As String) As Boolean
Return allPatterns.Any(Function(p)
Return HasPattern(input, p)
Return HasPattern(pInput, p)
End Function)
End Function

View File

@@ -1,10 +1,11 @@
Imports System.IO
Option Explicit On
Imports System.IO
Imports System.Security.AccessControl
Imports System.Security.Principal
Imports System.Text.RegularExpressions
Imports DigitalData.Modules.Logging
Public Class frmGlobix_Index
#Region "+++++ Variablen ++++++"
Public vPathFile As String
@@ -1550,17 +1551,17 @@ Public Class frmGlobix_Index
Function Indexwert_checkValueDB(indexname As String, wert As String)
Try
Dim DR As DataRow
Dim oRow As DataRow
'DT = DD_DMSLiteDataSet.VWINDEX_MAN
For Each DR In DT_INDEXEMAN.Rows
If DR.Item("NAME") = indexname Then
If DR.Item("SQL_CHECK").ToString <> String.Empty Then
For Each oRow In DT_INDEXEMAN.Rows
If oRow.Item("NAME") = indexname Then
If oRow.Item("SQL_CHECK").ToString <> String.Empty Then
Dim connectionString As String
Dim sql As String
connectionString = My.Database.Get_ConnectionStringforID(DR.Item("CONNECTION_ID"))
connectionString = My.Database.Get_ConnectionStringforID(oRow.Item("CONNECTION_ID"))
If connectionString <> "" Then
Dim sqlscalar = DR.Item("SQL_CHECK")
Select Case DR.Item("DATENTYP")
Dim sqlscalar = oRow.Item("SQL_CHECK")
Select Case oRow.Item("DATENTYP")
Case "INTEGER"
sqlscalar = sqlscalar.ToString.Replace("@manValue", wert)
Case Else

View File

@@ -46,7 +46,7 @@ Partial Class frmGlobix_IndexFileList
Me.RibbonControl1.Name = "RibbonControl1"
Me.RibbonControl1.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1})
Me.RibbonControl1.ShowApplicationButton = DevExpress.Utils.DefaultBoolean.[False]
Me.RibbonControl1.Size = New System.Drawing.Size(617, 159)
Me.RibbonControl1.Size = New System.Drawing.Size(617, 157)
Me.RibbonControl1.StatusBar = Me.RibbonStatusBar1
'
'BarButtonItem1
@@ -116,9 +116,9 @@ Partial Class frmGlobix_IndexFileList
'
Me.CheckedListBox1.Dock = System.Windows.Forms.DockStyle.Fill
Me.CheckedListBox1.FormattingEnabled = True
Me.CheckedListBox1.Location = New System.Drawing.Point(0, 159)
Me.CheckedListBox1.Location = New System.Drawing.Point(0, 157)
Me.CheckedListBox1.Name = "CheckedListBox1"
Me.CheckedListBox1.Size = New System.Drawing.Size(617, 216)
Me.CheckedListBox1.Size = New System.Drawing.Size(617, 218)
Me.CheckedListBox1.TabIndex = 2
'
'frmGlobix_IndexFileList