diff --git a/Global_Indexer/ClassHelper.vb b/Global_Indexer/ClassHelper.vb deleted file mode 100644 index 400bc16..0000000 --- a/Global_Indexer/ClassHelper.vb +++ /dev/null @@ -1,65 +0,0 @@ -Imports System.Text -Imports System.Text.RegularExpressions - -Public Class ClassHelper - Public Shared Function encode_utf8(ByVal str As String) As String - Try - 'supply True as the construction parameter to indicate - 'that you wanted the class to emit BOM (Byte Order Mark) - 'NOTE: this BOM value is the indicator of a UTF-8 string - Dim utf8Encoding As New System.Text.UTF8Encoding(True) - Dim encodedString() As Byte - encodedString = utf8Encoding.GetBytes(str) - LOGGER.Info(String.Format(" >> String {0} was encoded via utf8 to {1}", str, utf8Encoding.GetString(encodedString))) - Return utf8Encoding.GetString(encodedString) - Catch ex As Exception - LOGGER.Info("Unexpected error in encode_utf8: " & ex.Message) - LOGGER.Error(ex) - Return Nothing - End Try - - End Function - Public Shared Function StringAsUtf8Bytes(ByVal strData As String) As Byte() - Try - Dim bytes() As Byte - ' get unicode string as bytes - bytes = Encoding.UTF8.GetBytes(strData) - ' return byte data - Return bytes - Catch ex As Exception - LOGGER.Info("Unexpected error in StringAsUtf8Bytes: " & ex.Message) - LOGGER.Error(ex) - Return Nothing - End Try - - End Function - Public Shared Function CheckSpecialSigns(ByVal str As String) - Try - Dim pattern As String = "[!""#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~\s]" - Dim matches As MatchCollection = Regex.Matches(str, pattern) - Return matches.Count - Catch ex As Exception - LOGGER.Info("Unexpected error in CheckSpecialSigns: " & ex.Message) - LOGGER.Error(ex) - Return 0 - End Try - End Function - Public Shared Sub Refresh_RegexTable() - CURRENT_DT_REGEX = DATABASE_ECM.GetDatatable("SELECT * FROM TBGI_FUNCTION_REGEX") - End Sub - - ''' - ''' Überprüft einen Wert auf verschiedene Arten von "Null" und gibt einen Standard-Wert zurück, wenn der Wert "Null" ist. - ''' - ''' Der zu überprüfende Wert - ''' Der Standard Wert - ''' value oder wenn dieser "Null" ist, defaultValue - Public Shared Function NotNull(Of T)(ByVal value As T, ByVal defaultValue As T) As T - If IsNothing(value) OrElse String.IsNullOrEmpty(value.ToString) OrElse IsDBNull(value) Then - Return defaultValue - Else - Return value - End If - End Function - -End Class diff --git a/Global_Indexer/Global_Indexer.vbproj b/Global_Indexer/Global_Indexer.vbproj index 80e1d98..0a784b5 100644 --- a/Global_Indexer/Global_Indexer.vbproj +++ b/Global_Indexer/Global_Indexer.vbproj @@ -264,7 +264,6 @@ - diff --git a/Global_Indexer/frmIndex.vb b/Global_Indexer/frmIndex.vb index 7014555..9cd0fef 100644 --- a/Global_Indexer/frmIndex.vb +++ b/Global_Indexer/frmIndex.vb @@ -2113,17 +2113,17 @@ Public Class frmIndex ' 1. Schritt: Einfach-Indexe und Platzhalter ersetzen For Each oAutoIndexRow As DataRow In oDatatable _Logger.Info("Working on AutomaticIndex: " & oAutoIndexRow.Item("INDEXNAME") & "...") - Dim oSqlResult As String = ClassHelper.NotNull(oAutoIndexRow.Item("SQL_RESULT"), "") - Dim oSqlActive As Boolean = ClassHelper.NotNull(oAutoIndexRow.Item("SQL_ACTIVE"), False) - Dim oSqlConnectionId As Integer = ClassHelper.NotNull(oAutoIndexRow.Item("CONNECTION_ID"), -1) - Dim oSqlProvider As String = ClassHelper.NotNull(oAutoIndexRow.Item("SQL_PROVIDER"), "") + Dim oSqlResult As String = Utils.NotNull(oAutoIndexRow.Item("SQL_RESULT"), "") + Dim oSqlActive As Boolean = Utils.NotNull(oAutoIndexRow.Item("SQL_ACTIVE"), False) + Dim oSqlConnectionId As Integer = Utils.NotNull(oAutoIndexRow.Item("CONNECTION_ID"), -1) + Dim oSqlProvider As String = Utils.NotNull(oAutoIndexRow.Item("SQL_PROVIDER"), "") Dim oEndResult As New List(Of String) ' Wenn kein SQL Befehl vorhanden oder aktiv ist, ' versuchen wir, die Spalte VALUE zu ersetzen If oSqlResult = String.Empty Or oSqlActive = 0 Then Dim oPlaceholderResult As String - Dim oValue As String = ClassHelper.NotNull(oAutoIndexRow.Item("VALUE"), "") + Dim oValue As String = Utils.NotNull(oAutoIndexRow.Item("VALUE"), "") oPlaceholderResult = GetPlaceholderValue(oValue, CURRENT_WORKFILE, USER_SHORTNAME)