ZooFlow: Use BaseClass in Globix classes

This commit is contained in:
Jonathan Jenne 2021-12-14 11:40:24 +01:00
parent 2436fd296f
commit a595a75065
5 changed files with 74 additions and 101 deletions

View File

@ -5,9 +5,10 @@ Imports DigitalData.Modules.Logging
Imports Microsoft.Office.Interop Imports Microsoft.Office.Interop
Public Class ClassFileDrop Public Class ClassFileDrop
Public files_dropped As String() Inherits Base.BaseClass
Private _LOGGER As Logger
Private clsFilehandle As ClassFilehandle Public Property files_dropped As List(Of String)
Private ReadOnly FileHandle As ClassFilehandle
Public Class DroppedFile Public Class DroppedFile
Public FilePath As String Public FilePath As String
@ -18,20 +19,21 @@ Public Class ClassFileDrop
End Enum End Enum
End Class End Class
Public Sub New(LogConfig As LogConfig) Public Sub New(pLogConfig As LogConfig)
_LOGGER = LogConfig.GetLogger() MyBase.New(pLogConfig)
clsFilehandle = New ClassFilehandle() FileHandle = New ClassFilehandle(pLogConfig)
End Sub End Sub
Public Function Drop_File(e As DragEventArgs) As Boolean Public Function Drop_File(e As DragEventArgs) As Boolean
Try Try
_LOGGER.Info("Available Drop Formats:") Logger.Info("Available Drop Formats:")
For Each oFormat As String In e.Data.GetFormats() For Each oFormat As String In e.Data.GetFormats()
_LOGGER.Debug(oFormat) Logger.Debug(oFormat)
Next Next
_LOGGER.Info(">> Drop_File") Logger.Info(">> Drop_File")
files_dropped = Nothing files_dropped = New List(Of String)
If e.Data.GetDataPresent(DataFormats.FileDrop) Then If e.Data.GetDataPresent(DataFormats.FileDrop) Then
Dim MyFiles() As String Dim MyFiles() As String
Dim i As Integer Dim i As Integer
@ -39,10 +41,8 @@ Public Class ClassFileDrop
MyFiles = DirectCast(e.Data.GetData(DataFormats.FileDrop), String()) MyFiles = DirectCast(e.Data.GetData(DataFormats.FileDrop), String())
' Loop through the array and add the files to the list. ' Loop through the array and add the files to the list.
For i = 0 To MyFiles.Length - 1 For i = 0 To MyFiles.Length - 1
_LOGGER.Info(">> Simple FileDrop - File: " & MyFiles(i)) Logger.Info(">> Simple FileDrop - File: " & MyFiles(i))
ReDim Preserve files_dropped(i) files_dropped.Add("|DROPFROMFSYSTEM|" & MyFiles(i))
files_dropped(i) = "|DROPFROMFSYSTEM|" & MyFiles(i)
' ListBox1.Items.Add(MyFiles(i))
Next Next
Return True Return True
ElseIf (e.Data.GetDataPresent("FileGroupDescriptor")) AndAlso (e.Data.GetDataPresent("FileContents")) Then ElseIf (e.Data.GetDataPresent("FileGroupDescriptor")) AndAlso (e.Data.GetDataPresent("FileContents")) Then
@ -66,7 +66,7 @@ Public Class ClassFileDrop
Loop Loop
stmInput.Close() stmInput.Close()
'Sonderzeichen entfernen 'Sonderzeichen entfernen
Dim Tempfilename = clsFilehandle.InvalidCharacters(stbFileName.ToString) Dim Tempfilename = FileHandle.InvalidCharacters(stbFileName.ToString)
Dim anhaenge = e.Data.GetDataPresent("FileContents") Dim anhaenge = e.Data.GetDataPresent("FileContents")
'Dim path As String = "C:\VBProjekte\Dateien" 'Dim path As String = "C:\VBProjekte\Dateien"
'// put the zip file into the temp directory '// put the zip file into the temp directory
@ -89,19 +89,21 @@ Public Class ClassFileDrop
Dim fsOutput As IO.FileStream = New IO.FileStream(strOutFile, IO.FileMode.Create) '; Dim fsOutput As IO.FileStream = New IO.FileStream(strOutFile, IO.FileMode.Create) ';
fsOutput.Write(aryFileBytes, 0, aryFileBytes.Length) fsOutput.Write(aryFileBytes, 0, aryFileBytes.Length)
fsOutput.Close() ' // close the file fsOutput.Close() ' // close the file
Dim resultVersion = clsFilehandle.Versionierung_Datei(strOutFile) Dim resultVersion = FileHandle.Versionierung_Datei(strOutFile)
If resultVersion <> "" Then If resultVersion <> "" Then
strOutFile = resultVersion strOutFile = resultVersion
End If End If
Dim finTemp As IO.FileInfo = New IO.FileInfo(strOutFile) Dim finTemp As IO.FileInfo = New IO.FileInfo(strOutFile)
'// always good to make sure we actually created the file '// always good to make sure we actually created the file
If (finTemp.Exists = True) Then If (finTemp.Exists = True) Then
ReDim Preserve files_dropped(0) files_dropped.Add("|OUTLOOK_ATTACHMENT|" & strOutFile)
files_dropped(0) = "|OUTLOOK_ATTACHMENT|" & strOutFile
_LOGGER.Info(">> Drop an Attachment - File: " & strOutFile) 'ReDim Preserve files_dropped(0)
'files_dropped(0) = "|OUTLOOK_ATTACHMENT|" & strOutFile
Logger.Info(">> Drop an Attachment - File: " & strOutFile)
Return True Return True
Else Else
_LOGGER.Info(">> Attachment File from Outlook could not be created") Logger.Info(">> Attachment File from Outlook could not be created")
End If End If
End If End If
End If End If
@ -113,7 +115,7 @@ Public Class ClassFileDrop
MsgBox("Unexpected error in Initialisieren von Outlook-API:" & vbNewLine & ex.Message & vbNewLine & vbNewLine & "Evtl ist Outlook nicht in der dafür vorgesehenen For") MsgBox("Unexpected error in Initialisieren von Outlook-API:" & vbNewLine & ex.Message & vbNewLine & vbNewLine & "Evtl ist Outlook nicht in der dafür vorgesehenen For")
End Try End Try
_LOGGER.Info(">> Drop of msg") Logger.Info(">> Drop of msg")
'supports a drop of a Outlook message 'supports a drop of a Outlook message
Dim myobj As Object Dim myobj As Object
For i As Integer = 1 To oApp.ActiveExplorer.Selection.Count For i As Integer = 1 To oApp.ActiveExplorer.Selection.Count
@ -129,14 +131,14 @@ Public Class ClassFileDrop
subj = subj.Replace("/", "-") subj = subj.Replace("/", "-")
End If End If
'Sonderzeichen entfernen 'Sonderzeichen entfernen
subj = clsFilehandle.InvalidCharacters(subj) subj = FileHandle.InvalidCharacters(subj)
'hardcode a destination path for testing 'hardcode a destination path for testing
Dim strFile As String = IO.Path.Combine(Path.GetTempPath, subj + ".msg") Dim strFile As String = IO.Path.Combine(Path.GetTempPath, subj + ".msg")
strFile = strFile.Replace("?", "") strFile = strFile.Replace("?", "")
strFile = strFile.Replace("!", "") strFile = strFile.Replace("!", "")
strFile = strFile.Replace("%", "") strFile = strFile.Replace("%", "")
strFile = strFile.Replace("$", "") strFile = strFile.Replace("$", "")
_LOGGER.Info(">> Drop of msg - File:" & strFile) Logger.Info(">> Drop of msg - File:" & strFile)
Try Try
myobj.SaveAs(strFile) myobj.SaveAs(strFile)
Catch ex As Exception Catch ex As Exception
@ -144,8 +146,9 @@ Public Class ClassFileDrop
Return False Return False
End Try End Try
ReDim Preserve files_dropped(i) 'ReDim Preserve files_dropped(i)
files_dropped(i) = "|OUTLOOK_MESSAGE|" & strFile 'files_dropped(i) = "|OUTLOOK_MESSAGE|" & strFile
files_dropped.Add("|OUTLOOK_MESSAGE|" & strFile)
Next Next
Return True Return True
'Drop eines Outlook Attachments 'Drop eines Outlook Attachments

View File

@ -6,10 +6,12 @@ Imports DigitalData.Modules.Logging
Imports Independentsoft Imports Independentsoft
Public Class ClassFilehandle Public Class ClassFilehandle
Private _LOGGER As Logger Inherits Base.BaseClass
Public Sub New()
_LOGGER = My.LogConfig.GetLogger Public Sub New(pLogConfig As LogConfig)
MyBase.New(pLogConfig)
End Sub End Sub
''' <summary> ''' <summary>
''' Diese Funktion entfernt alle Zeichen aus dem übergebenen String ''' Diese Funktion entfernt alle Zeichen aus dem übergebenen String
''' die in Dateinamen nicht erlaubt sind. ''' die in Dateinamen nicht erlaubt sind.
@ -85,6 +87,7 @@ Public Class ClassFilehandle
Return Insert_GI_File(filename, handletype) Return Insert_GI_File(filename, handletype)
Catch ex As Exception Catch ex As Exception
Logger.Error(ex)
MsgBox("Unexpected Error in Decide_FileHandle: " & ex.Message, MsgBoxStyle.Critical) MsgBox("Unexpected Error in Decide_FileHandle: " & ex.Message, MsgBoxStyle.Critical)
Return False Return False
End Try End Try
@ -103,7 +106,7 @@ Public Class ClassFilehandle
If Not msg.InternetMessageId Is Nothing Then If Not msg.InternetMessageId Is Nothing Then
My.Application.Globix.CurrMessageID = msg.InternetMessageId My.Application.Globix.CurrMessageID = msg.InternetMessageId
Else Else
_LOGGER.Info(">> Email_Decay: Es konnte keine Message-ID gelesen werden. Eine GUID wird erzeugt!") Logger.Info(">> Email_Decay: Es konnte keine Message-ID gelesen werden. Eine GUID wird erzeugt!")
Dim sGUID As String Dim sGUID As String
sGUID = System.Guid.NewGuid.ToString() sGUID = System.Guid.NewGuid.ToString()
My.Application.Globix.CurrMessageID = sGUID My.Application.Globix.CurrMessageID = sGUID
@ -127,7 +130,7 @@ Public Class ClassFilehandle
Dim _msg As New Msg.Message(msgname) Dim _msg As New Msg.Message(msgname)
Dim i1 As Integer = 1 Dim i1 As Integer = 1
_LOGGER.Info(">> Anzahl der Attachments: " & _msg.Attachments.Count) Logger.Info(">> Anzahl der Attachments: " & _msg.Attachments.Count)
For Each attachment As Independentsoft.Msg.Attachment In _msg.Attachments For Each attachment As Independentsoft.Msg.Attachment In _msg.Attachments
If erfolgreich = False Then If erfolgreich = False Then
Exit For Exit For
@ -147,7 +150,7 @@ Public Class ClassFilehandle
Dim oMessage = attachment.EmbeddedMessage Dim oMessage = attachment.EmbeddedMessage
oMessage.Save(tempfile) oMessage.Save(tempfile)
My.Application.Globix.TEMP_FILES.Add(tempfile) My.Application.Globix.TEMP_FILES.Add(tempfile)
_LOGGER.Info(">> Attachment (" & i1 & "):" & tempfile) Logger.Info("Attachment (" & i1 & "):" & tempfile)
erfolgreich = Insert_GI_File(tempfile, ATT_EXTR) erfolgreich = Insert_GI_File(tempfile, ATT_EXTR)
i1 += 1 i1 += 1
End If End If
@ -160,7 +163,7 @@ Public Class ClassFilehandle
attachment.Save(tempfile) attachment.Save(tempfile)
'Datei in Array zum Templöschen speichern 'Datei in Array zum Templöschen speichern
My.Application.Globix.TEMP_FILES.Add(tempfile) My.Application.Globix.TEMP_FILES.Add(tempfile)
_LOGGER.Info(">> Attachment (" & i1 & "):" & tempfile) Logger.Info("Attachment (" & i1 & "):" & tempfile)
'nun der Insert des Anhanges 'nun der Insert des Anhanges
erfolgreich = Insert_GI_File(tempfile, ATT_EXTR) erfolgreich = Insert_GI_File(tempfile, ATT_EXTR)
i1 += 1 i1 += 1
@ -170,7 +173,9 @@ Public Class ClassFilehandle
End If End If
Return erfolgreich Return erfolgreich
Catch ex As Exception Catch ex As Exception
Logger.Error(ex)
MsgBox("Error in Email_Decay: " & ex.Message, MsgBoxStyle.Critical) MsgBox("Error in Email_Decay: " & ex.Message, MsgBoxStyle.Critical)
Return False
End Try End Try
End Function End Function
@ -200,19 +205,20 @@ Public Class ClassFilehandle
' Ist ein Fehler aufgetreten, so wird nach außen hin generell ' Ist ein Fehler aufgetreten, so wird nach außen hin generell
' davon ausgegangen, dass die Datei in Benutzung ist (obwohl ' davon ausgegangen, dass die Datei in Benutzung ist (obwohl
' auch andere Ursachen, etwa Rechteprobleme, möglich sind). ' auch andere Ursachen, etwa Rechteprobleme, möglich sind).
_LOGGER.Info(">> FileInUse Message: " & ex.Message) Logger.Info(">> FileInUse Message: " & ex.Message)
IsFileInUse = True Return True
Finally Finally
' Die eventuell geöffnete Datei schließen ' Die eventuell geöffnete Datei schließen
FileClose(ff) FileClose(ff)
End Try End Try
Return False Return False
Else
Return False
End If End If
End Function End Function
Public Function Versionierung_Datei(Dateiname As String) As String Public Function Versionierung_Datei(Dateiname As String) As String
Dim extension As String Dim extension As String
Dim _NewFileString As String Dim _NewFileString As String = ""
Try Try
Dim version As Integer = 1 Dim version As Integer = 1
@ -233,36 +239,10 @@ Public Class ClassFilehandle
End If End If
Return _NewFileString & extension Return _NewFileString & extension
Catch ex As Exception Catch ex As Exception
_LOGGER.Info(" - Error in versioning file - error: " & vbNewLine & ex.Message) Logger.Info(" - Error in versioning file - error: " & vbNewLine & ex.Message)
_LOGGER.Error(ex.Message) Logger.Error(ex)
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error in versioning file:") MsgBox(ex.Message, MsgBoxStyle.Critical, "Error in versioning file:")
Return "" Return ""
End Try End Try
End Function End Function
''' <summary>
'''' Ersetzt alle nicht zulässigen Zeichen im angegebenen Dateinamen
'''' </summary>
'''' <param name="sFilename">Dateiname ohne Pfadangabe</param>
'''' <param name="sChar">Ersatzzeichen für alle unzulässigen Zeichen
'''' im Dateinamen</param>
'Public Function CleanFilename(ByVal sFilename As String, Optional ByVal REPLACEChar As String = "") As String
' _LOGGER.Info(" Filename before CleanFilename: '" & sFilename & "'")
' If sFilename.Contains(".\") Then
' sFilename = sFilename.Replace(".\", "\")
' End If
' 'If sFilename.Contains("'") Then
' ' sFilename = sFilename.Replace("'", "")
' 'End If
' 'If sFilename.Contains("..") Then
' ' sFilename = sFilename.Replace("..", ".")
' 'End If
' ' alle nicht zulässigen Zeichen ersetzen
' sFilename = System.Text.RegularExpressions.Regex.Replace(sFilename, My.Application.Globix.REGEX_CLEAN_FILENAME, REPLACEChar)
' sFilename = System.Text.RegularExpressions.Regex.Replace(sFilename, "[\\/:*?""<>|\r\n]", "", System.Text.RegularExpressions.RegexOptions.Singleline)
' 'Dim oCleanFileName As String = String.Join(REPLACEChar, sFilename.Split(Path.GetInvalidFileNameChars()))
' Dim oCleanFileName As New System.IO.FileInfo(System.Text.RegularExpressions.Regex.Replace(sFilename, String.Format("[{0}]", String.Join(String.Empty, Path.GetInvalidFileNameChars)), REPLACEChar))
' _LOGGER.Info("Filename after CleanFilename: '" & sFilename & "'")
' Return sFilename
'End Function
End Class End Class

View File

@ -2,14 +2,16 @@
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
Public Class ClassFolderwatcher Public Class ClassFolderwatcher
Inherits Base.BaseClass
Public Shared FWFolderWatcher As FileSystemWatcher Public Shared FWFolderWatcher As FileSystemWatcher
Public Shared FWScan As FileSystemWatcher Public Shared FWScan As FileSystemWatcher
Private clsFilehandle As ClassFilehandle
Private Logger As Logger
Public Sub New() Private ReadOnly FileHandle As ClassFilehandle
Logger = My.LogConfig.GetLogger()
clsFilehandle = New ClassFilehandle() Public Sub New(pLogConfig As LogConfig)
MyBase.New(pLogConfig)
FileHandle = New ClassFilehandle(pLogConfig)
End Sub End Sub
Public Function Restart_FolderWatch() As Boolean Public Function Restart_FolderWatch() As Boolean
@ -19,7 +21,7 @@ Public Class ClassFolderwatcher
FWFolderWatcher.EnableRaisingEvents = False FWFolderWatcher.EnableRaisingEvents = False
My.Application.Globix.Folderwatchstarted = False My.Application.Globix.Folderwatchstarted = False
'FolderWatch neu instanzieren 'FolderWatch neu instanzieren
FWFolderWatcher = New System.IO.FileSystemWatcher(My.Application.Globix.CurrentFolderWatchPath, "*.*") FWFolderWatcher = New FileSystemWatcher(My.Application.Globix.CurrentFolderWatchPath, "*.*")
Logger.Info(" >> FolderWatch neu instanziert") Logger.Info(" >> FolderWatch neu instanziert")
FWFolderWatcher.IncludeSubdirectories = False FWFolderWatcher.IncludeSubdirectories = False
FWFolderWatcher.EnableRaisingEvents = True FWFolderWatcher.EnableRaisingEvents = True
@ -65,7 +67,6 @@ Public Class ClassFolderwatcher
FWFolderWatcher.EnableRaisingEvents = True FWFolderWatcher.EnableRaisingEvents = True
AddHandler FWFolderWatcher.Created, AddressOf OnCreated AddHandler FWFolderWatcher.Created, AddressOf OnCreated
My.Application.Globix.Folderwatchstarted = True My.Application.Globix.Folderwatchstarted = True
'SaveConfigValue("my.Application.Globix.Folderwatchstarted", "True")
My.UIConfig.Globix.FolderWatchStarted = True My.UIConfig.Globix.FolderWatchStarted = True
My.UIConfigManager.Save() My.UIConfigManager.Save()
End If End If
@ -78,7 +79,6 @@ Public Class ClassFolderwatcher
FWFolderWatcher.EnableRaisingEvents = True FWFolderWatcher.EnableRaisingEvents = True
AddHandler FWFolderWatcher.Created, AddressOf OnCreated AddHandler FWFolderWatcher.Created, AddressOf OnCreated
My.Application.Globix.Folderwatchstarted = True My.Application.Globix.Folderwatchstarted = True
'SaveConfigValue("my.Application.Globix.Folderwatchstarted", "True")
My.UIConfig.Globix.FolderWatchStarted = True My.UIConfig.Globix.FolderWatchStarted = True
My.UIConfigManager.Save() My.UIConfigManager.Save()
Else Else
@ -86,7 +86,6 @@ Public Class ClassFolderwatcher
FWFolderWatcher.EnableRaisingEvents = False FWFolderWatcher.EnableRaisingEvents = False
My.Application.Globix.Folderwatchstarted = False My.Application.Globix.Folderwatchstarted = False
Logger.Info(" >> FolderWatch gestoppt") Logger.Info(" >> FolderWatch gestoppt")
'SaveConfigValue("my.Application.Globix.Folderwatchstarted", "False")
My.UIConfig.Globix.FolderWatchStarted = False My.UIConfig.Globix.FolderWatchStarted = False
My.UIConfigManager.Save() My.UIConfigManager.Save()
End If End If
@ -183,8 +182,8 @@ Public Class ClassFolderwatcher
'Die Datei übergeben 'Die Datei übergeben
Logger.Info(">> OnCreated-File:" & e.FullPath) Logger.Info(">> OnCreated-File:" & e.FullPath)
If clsFilehandle.CheckDuplicateFiles(e.FullPath, "FolderWatch/Scan") Then If FileHandle.CheckDuplicateFiles(e.FullPath, "FolderWatch/Scan") Then
clsFilehandle.Decide_FileHandle(e.FullPath, handleType) FileHandle.Decide_FileHandle(e.FullPath, handleType)
Else Else
Logger.Info(">> Folderwatcher: File already exists:" & e.FullPath) Logger.Info(">> Folderwatcher: File already exists:" & e.FullPath)
End If End If

View File

@ -762,7 +762,7 @@ Public Class frmGlobix_Index
Dim oFilePath As String = My.Application.Globix.CurrentWorkfile.FilePath Dim oFilePath As String = My.Application.Globix.CurrentWorkfile.FilePath
Dim oObjectStore As String = "WORK" Dim oObjectStore As String = SelectedDocType.Name
Dim oObjectKind As String = "DOC" Dim oObjectKind As String = "DOC"
Dim oBusinessEntity As String = "DEFAULT" Dim oBusinessEntity As String = "DEFAULT"
Dim oProfileId As Integer = SelectedDocType.Guid Dim oProfileId As Integer = SelectedDocType.Guid

View File

@ -72,6 +72,7 @@ Public Class frmFlowForm
' === Initialize AppServer Database Connection with Failover ' === Initialize AppServer Database Connection with Failover
AppServerOrDB = New ClassDataASorDB(My.LogConfig) AppServerOrDB = New ClassDataASorDB(My.LogConfig)
' === Initialization === ' === Initialization ===
Init = New ClassInit(My.LogConfig, Me) Init = New ClassInit(My.LogConfig, Me)
AddHandler Init.Completed, AddressOf Init_Completed AddHandler Init.Completed, AddressOf Init_Completed
@ -110,7 +111,7 @@ Public Class frmFlowForm
AddHandler Watcher.ClipboardChanged, AddressOf Watcher_ClipboardChanged AddHandler Watcher.ClipboardChanged, AddressOf Watcher_ClipboardChanged
Dim oSQL = My.Queries.Common.FNIDB_GET_SEARCH_PROFILES(My.Application.User.UserId, My.Application.User.Language) Dim oSQL = My.Queries.Common.FNIDB_GET_SEARCH_PROFILES(My.Application.User.UserId, My.Application.User.Language)
Dim oDatatable As DataTable = My.DatabaseIDB.GetDatatable(oSql) Dim oDatatable As DataTable = My.DatabaseIDB.GetDatatable(oSQL)
PictureBoxSearch1.Visible = False PictureBoxSearch1.Visible = False
If Not IsNothing(oDatatable) OrElse oDatatable.Rows.Count > 0 Then If Not IsNothing(oDatatable) OrElse oDatatable.Rows.Count > 0 Then
IDBSearchActive = True IDBSearchActive = True
@ -161,9 +162,8 @@ Public Class frmFlowForm
If My.Application.ModulesActive.Contains(MODULE_GLOBAL_INDEXER) Then If My.Application.ModulesActive.Contains(MODULE_GLOBAL_INDEXER) Then
FileDrop = New ClassFileDrop(My.LogConfig) FileDrop = New ClassFileDrop(My.LogConfig)
FileHandle = New ClassFilehandle() FileHandle = New ClassFilehandle(My.LogConfig)
FolderWatch = New ClassFolderwatcher() FolderWatch = New ClassFolderwatcher(My.LogConfig)
NNRefresh_RegexTable()
Dim oFileExclusions As New ClassExclusions() Dim oFileExclusions As New ClassExclusions()
If oFileExclusions.Load(My.Application.Globix.PATH_FileExclusions) = False Then If oFileExclusions.Load(My.Application.Globix.PATH_FileExclusions) = False Then
@ -180,9 +180,10 @@ Public Class frmFlowForm
GlobixToolStripMenuItem.Visible = True GlobixToolStripMenuItem.Visible = True
End If End If
oSQL = "SELECT * FROM TBIDB_ATTRIBUTE"
oSQL = "SELECT * FROM TBIDB_ATTRIBUTE"
My.Tables.DTIDB_ATTRIBUTE = AppServerOrDB.GetDatatable("IDB", oSQL, "TBIDB_ATTRIBUTE", "", "") My.Tables.DTIDB_ATTRIBUTE = AppServerOrDB.GetDatatable("IDB", oSQL, "TBIDB_ATTRIBUTE", "", "")
Me.Cursor = Cursors.Default Me.Cursor = Cursors.Default
End Sub End Sub
@ -204,7 +205,6 @@ Public Class frmFlowForm
If oFolderWatchPath = String.Empty Then If oFolderWatchPath = String.Empty Then
Logger.Info("Init_Folderwatch: folderwatchPath is empty") Logger.Info("Init_Folderwatch: folderwatchPath is empty")
My.Application.Globix.Folderwatchstarted = False My.Application.Globix.Folderwatchstarted = False
'SaveConfigValue("my.Application.Globix.Folderwatchstarted", "False")
My.UIConfig.Globix.FolderWatchStarted = False My.UIConfig.Globix.FolderWatchStarted = False
My.UIConfigManager.Save() My.UIConfigManager.Save()
@ -213,7 +213,6 @@ Public Class frmFlowForm
If Not IO.Directory.Exists(oFolderWatchPath) Then If Not IO.Directory.Exists(oFolderWatchPath) Then
Logger.Info("Init_Folderwatch: folderwatchPath does not exists or is invalid path") Logger.Info("Init_Folderwatch: folderwatchPath does not exists or is invalid path")
My.Application.Globix.Folderwatchstarted = False My.Application.Globix.Folderwatchstarted = False
'SaveConfigValue("my.Application.Globix.Folderwatchstarted", "False")
My.UIConfig.Globix.FolderWatchStarted = False My.UIConfig.Globix.FolderWatchStarted = False
My.UIConfigManager.Save() My.UIConfigManager.Save()
@ -493,21 +492,18 @@ Public Class frmFlowForm
End Sub End Sub
Sub Globix_Check_Dropped_Files() Sub Globix_Check_Dropped_Files()
Try Try
My.DatabaseECM.ExecuteNonQuery("DELETE FROM TBGI_FILES_USER WHERE WORKED = 1 AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')") My.DatabaseECM.ExecuteNonQuery($"DELETE FROM TBGI_FILES_USER WHERE WORKED = 1 AND UPPER(USER@WORK) = UPPER('{Environment.UserName}')")
Dim i As Integer Dim i As Integer
For Each Str As Object In FileDrop.files_dropped For Each pFile As String In FileDrop.files_dropped
If Not Str Is Nothing Then If Not pFile Is Nothing Then
Logger.Info(" Check Drop-File: " & Str.ToString) Logger.Info(" Check Drop-File: " & pFile.ToString)
Dim handleType As String = Str.Substring(0, Str.LastIndexOf("|") + 1) Dim handleType As String = pFile.Substring(0, pFile.LastIndexOf("|") + 1)
Dim filename As String = Str.Substring(Str.LastIndexOf("|") + 1) Dim filename As String = pFile.Substring(pFile.LastIndexOf("|") + 1)
If FileHandle.CheckDuplicateFiles(filename, "Manuelle Ablage") Then If FileHandle.CheckDuplicateFiles(filename, "Manuelle Ablage") Then
FileHandle.Decide_FileHandle(filename, handleType) FileHandle.Decide_FileHandle(filename, handleType)
i += 1 i += 1
Else
' Console.WriteLine("File gibt es bereits")
End If End If
End If End If
Next Next
@ -530,11 +526,12 @@ Public Class frmFlowForm
My.Application.Globix.DTACTUAL_FILES = My.DatabaseECM.GetDatatable(sql) My.Application.Globix.DTACTUAL_FILES = My.DatabaseECM.GetDatatable(sql)
End If End If
For Each oFileRow As DataRow In My.Application.Globix.DTACTUAL_FILES.Rows For Each oRow As DataRow In My.Application.Globix.DTACTUAL_FILES.Rows
Dim oFilePath As String = oFileRow.Item("FILENAME2WORK").ToString Dim oFilePath As String = oRow.Item("FILENAME2WORK").ToString
Dim oFileId As Integer = oRow.Item("GUID")
My.Application.Globix.CurrentWorkfile = New Globix.Models.WorkFile With { My.Application.Globix.CurrentWorkfile = New Globix.Models.WorkFile With {
.Id = oFileRow.Item(0), .Id = oFileId,
.FilePath = oFilePath .FilePath = oFilePath
} }
@ -597,12 +594,6 @@ Public Class frmFlowForm
End If End If
If My.Application.Globix.CurrentFolderWatchPath <> "" Or My.Application.Globix.CURRENT_SCAN_FOLDERWATCH <> "" Then If My.Application.Globix.CurrentFolderWatchPath <> "" Or My.Application.Globix.CURRENT_SCAN_FOLDERWATCH <> "" Then
'If My.Application.Globix.Folderwatchstarted = True Then
' tslblFW.Visible = True
'Else
' tslblFW.Visible = False
'End If
Try Try
If My.UIConfigManager.Config.Globix.FolderWatchScanStarted = True Then If My.UIConfigManager.Config.Globix.FolderWatchScanStarted = True Then
Logger.Info("FWSCAN started - Checking file:" & My.Application.Globix.CURRENT_SCAN_FOLDERWATCH) Logger.Info("FWSCAN started - Checking file:" & My.Application.Globix.CURRENT_SCAN_FOLDERWATCH)