7 Commits

Author SHA1 Message Date
Jonathan Jenne
47e98fe1a6 Merge branch 'master' of http://dd-vmp07-com04:3000/AppStd/Monorepo 2021-01-14 13:24:31 +01:00
Jonathan Jenne
8a934eb581 ZooFlow: Add Clipboard Watcher Class 2021-01-14 13:24:23 +01:00
Jonathan Jenne
845237963a ZugferdService: Version 1.2.5.0 2021-01-13 14:02:38 +01:00
Jonathan Jenne
4a43df9225 Logging: Version 2.0.4.1 2021-01-13 14:02:14 +01:00
Jonathan Jenne
711c380e5f Logging: Tweak debug settings for more performance 2021-01-13 14:01:38 +01:00
Jonathan Jenne
2f60998c3e Jobs: Version 1.3.1.0 2021-01-13 14:01:14 +01:00
Jonathan Jenne
96b1004749 Jobs/Zugferd: dont move files on application errors 2021-01-13 14:00:59 +01:00
10 changed files with 130 additions and 32 deletions

View File

@@ -1,6 +1,17 @@
Imports System.Runtime.InteropServices
Public Class ClassWin32
Public Const ULW_COLORKEY As Int32 = &H1
Public Const ULW_ALPHA As Int32 = &H2
Public Const ULW_OPAQUE As Int32 = &H4
Public Const AC_SRC_OVER As Byte = &H0
Public Const AC_SRC_ALPHA As Byte = &H1
Public Const WM_NCLBUTTONDOWN As Integer = &HA1
Public Const HTCAPTION As Integer = &H2
Public Const WM_DRAWCLIPBOARD As Integer = &H308
Public Enum Bool
[False] = 0
[True]
@@ -44,40 +55,51 @@ Public Class ClassWin32
Public AlphaFormat As Byte
End Structure
Public Const ULW_COLORKEY As Int32 = &H1
Public Const ULW_ALPHA As Int32 = &H2
Public Const ULW_OPAQUE As Int32 = &H4
Public Const AC_SRC_OVER As Byte = &H0
Public Const AC_SRC_ALPHA As Byte = &H1
Public Const WM_NCLBUTTONDOWN As Integer = &HA1
Public Const HTCAPTION As Integer = &H2
<DllImport("user32.dll", ExactSpelling:=True, SetLastError:=True)>
Public Shared Function UpdateLayeredWindow(ByVal hwnd As IntPtr, ByVal hdcDst As IntPtr, ByRef pptDst As Point, ByRef psize As Size, ByVal hdcSrc As IntPtr, ByRef pprSrc As Point, ByVal crKey As Int32, ByRef pblend As BLENDFUNCTION, ByVal dwFlags As Int32) As Bool
End Function
<DllImport("user32.dll", ExactSpelling:=True, SetLastError:=True)>
Public Shared Function GetDC(ByVal hWnd As IntPtr) As IntPtr
End Function
<DllImport("user32.dll", ExactSpelling:=True)>
Public Shared Function ReleaseDC(ByVal hWnd As IntPtr, ByVal hDC As IntPtr) As Integer
End Function
<DllImport("gdi32.dll", ExactSpelling:=True, SetLastError:=True)>
Public Shared Function CreateCompatibleDC(ByVal hDC As IntPtr) As IntPtr
End Function
<DllImport("gdi32.dll", ExactSpelling:=True, SetLastError:=True)>
Public Shared Function DeleteDC(ByVal hdc As IntPtr) As Bool
End Function
<DllImport("gdi32.dll", ExactSpelling:=True)>
Public Shared Function SelectObject(ByVal hDC As IntPtr, ByVal hObject As IntPtr) As IntPtr
End Function
<DllImport("gdi32.dll", ExactSpelling:=True, SetLastError:=True)>
Public Shared Function DeleteObject(ByVal hObject As IntPtr) As Bool
End Function
<DllImport("User32.dll")>
Public Shared Function ReleaseCapture() As Boolean
End Function
<DllImport("User32.dll")>
Public Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
End Function
<DllImport("user32", EntryPoint:="AddClipboardFormatListener")>
Public Shared Function AddClipboardFormatListener(ByVal hWnd As IntPtr) As Boolean
End Function
<DllImport("user32", EntryPoint:="RemoveClipboardFormatListener")>
Public Shared Function RemoveClipboardFormatListener(ByVal hWnd As IntPtr) As Boolean
End Function
<DllImport("user32", EntryPoint:="SetClipboardViewer")>
Public Shared Function SetClipboardViewer(ByVal hWnd As IntPtr) As IntPtr
End Function
End Class

View File

@@ -0,0 +1,64 @@
Imports System.Runtime.InteropServices
Namespace ClipboardWatcher
Public Class Watcher
Inherits NativeWindow
Implements IDisposable
Public Event ClipboardChanged As EventHandler(Of IDataObject)
Public Shared Singleton As New Watcher
Private _Handle As IntPtr
Private Sub New()
MyBase.CreateHandle(New CreateParams)
_Handle = ClassWin32.SetClipboardViewer(Handle)
End Sub
Protected Overrides Sub WndProc(ByRef m As Message)
Select Case m.Msg
Case ClassWin32.WM_DRAWCLIPBOARD
Dim oData As IDataObject = Clipboard.GetDataObject
RaiseEvent ClipboardChanged(Me, oData)
End Select
MyBase.WndProc(m)
End Sub
#Region "IDisposable Support"
' Für diese Klasse ist korrekte Ressourcenbereinigung besonders wichtig, da
' mit systemübergreifenden Ressourcen gearbeitet wird
' So ermitteln Sie überflüssige Aufrufe
Private _DisposedValue As Boolean = False
Protected Overridable Sub Dispose(ByVal pDisposing As Boolean)
If Not _DisposedValue Then
If pDisposing Then
' TODO: Verwaltete Ressourcen freigeben, wenn sie explizit
' aufgerufen werden
End If
MyBase.DestroyHandle()
Dim H As IntPtr = ClassWin32.SetClipboardViewer(_Handle)
End If
_DisposedValue = True
End Sub
' Dieser Code wird von Visual Basic hinzugefügt, um das Dispose-Muster
' richtig zu implementieren.
Public Sub Dispose() Implements IDisposable.Dispose
' Sie sollten diesen Code nicht ändern, sondern stattdessen ihren
' Bereinigungscode oben in
' Dispose(ByVal disposing As Boolean) einfügen.
Dispose(True)
System.GC.SuppressFinalize(Me)
End Sub
Protected Overrides Sub Finalize()
MyBase.Finalize()
Dispose(False)
End Sub
#End Region
End Class
End Namespace

View File

@@ -112,7 +112,7 @@
<ItemGroup>
<Compile Include="ApplicationEvents.vb" />
<Compile Include="Base\BaseClass.vb" />
<Compile Include="ClassClipboardWatcher.vb" />
<Compile Include="ClipboardWatcher\Watcher.vb" />
<Compile Include="ClassCommandlineArgs.vb" />
<Compile Include="ClassDataASorDB.vb" />
<Compile Include="modCurrent.vb" />

View File

@@ -33,7 +33,7 @@ Public Class frmFlowForm
' Events
Public Event ClipboardChanged As EventHandler(Of IDataObject)
Private WithEvents Watcher As ClassClipboardWatcher = ClassClipboardWatcher.Singleton
Private WithEvents Watcher As ClipboardWatcher.Watcher = ClipboardWatcher.Watcher.Singleton
Public Sub New()
' Dieser Aufruf ist für den Designer erforderlich.
@@ -89,6 +89,7 @@ Public Class frmFlowForm
' === Register As Event Listener ===
EventBus.Instance.Register(Me)
' === Set Form Properties ===
TopMost = True
AllowDrop = True
@@ -105,6 +106,9 @@ Public Class frmFlowForm
AddHandler oControl.MouseLeave, AddressOf frmFlowForm_MouseLeave
Next
AddHandler Watcher.ClipboardChanged, AddressOf Watcher_ClipboardChanged
' TODO: Clean up
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)
@@ -115,7 +119,7 @@ Public Class frmFlowForm
DTIDB_SEARCHES = oDatatable
PictureBoxSearch.Visible = True
End If
If My.Application.ModulesActive.Contains(ClassConstants.MODULE_GLOBAL_INDEXER) Then
If My.Application.ModulesActive.Contains(MODULE_GLOBAL_INDEXER) Then
FileDrop = New ClassFileDrop(My.LogConfig)
FileHandle = New ClassFilehandle(My.LogConfig)
Refresh_RegexTable()
@@ -124,6 +128,9 @@ Public Class frmFlowForm
Me.Cursor = Cursors.Default
End Sub
Private Sub Watcher_ClipboardChanged(sender As Object, e As IDataObject)
Throw New NotImplementedException()
End Sub
Private Sub TimerRefreshData_Tick(sender As Object, e As EventArgs)
'TODO: Refresh Data

View File

@@ -26,6 +26,8 @@ Public Class ImportZUGFeRDFiles
Public Const ZUGFERD_ATTACHMENTS = "ZUGFeRD Attachments"
Public HISTORY_ID As Integer
Private Const DIRECTORY_DONT_MOVE = "DIRECTORY_DONT_MOVE"
' List of allowed extensions for PDF/A Attachments
' This list should not contain xml so the zugferd xml file will be filtered out
Private ReadOnly AllowedExtensions As List(Of String) = New List(Of String) From {"docx", "doc", "pdf", "xls", "xlsx", "ppt", "pptx", "txt"}
@@ -406,29 +408,34 @@ Public Class ImportZUGFeRDFiles
_logger.Error(ex)
oTransaction.Rollback()
Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - Out of memory' WHERE GUID = '{HISTORY_ID}'"
_firebird.ExecuteNonQuery(oSQL)
oMoveDirectory = DIRECTORY_DONT_MOVE
AddRejectedState(oMessageId, "OutOfMemoryException", "", ex.Message)
'Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - Out of memory' WHERE GUID = '{HISTORY_ID}'"
'_firebird.ExecuteNonQuery(oSQL)
'AddRejectedState(oMessageId, "OutOfMemoryException", "", ex.Message)
Catch ex As Exception
_logger.Warn("Unknown Error occurred: {0}", ex.Message)
_logger.Error(ex)
oTransaction.Rollback()
Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - Unknown error occured' WHERE GUID = '{HISTORY_ID}'"
_firebird.ExecuteNonQuery(oSQL)
oMoveDirectory = oArgs.ErrorDirectory
AddRejectedState(oMessageId, "UnexpectedException", "", ex.Message)
oMoveDirectory = DIRECTORY_DONT_MOVE
'Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - Unknown error occured' WHERE GUID = '{HISTORY_ID}'"
'_firebird.ExecuteNonQuery(oSQL)
'oMoveDirectory = oArgs.ErrorDirectory
'AddRejectedState(oMessageId, "UnexpectedException", "", ex.Message)
Finally
oConnection.Close()
' Move all files of the current group
Try
MoveFiles(oArgs, oMessageId, oFileGroupFiles, oEmailAttachmentFiles, oEmbeddedAttachmentFiles, oMoveDirectory, oIsSuccess)
' If an application error occurred, dont move files so they will be processed again later
If oMoveDirectory = DIRECTORY_DONT_MOVE Then
_logger.Info("Application Error occurred. Files for message Id {0} will not be moved.", oMessageId)
Else
' Move all files of the current group
MoveFiles(oArgs, oMessageId, oFileGroupFiles, oEmailAttachmentFiles, oEmbeddedAttachmentFiles, oMoveDirectory, oIsSuccess)
End If
_logger.Info("Finished processing file group {0}", oMessageId)
Catch ex As Exception
_logger.Warn("Could not move files!")

View File

@@ -30,5 +30,5 @@ Imports System.Runtime.InteropServices
' Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
' übernehmen, indem Sie "*" eingeben:
<Assembly: AssemblyVersion("1.3.0.12")>
<Assembly: AssemblyFileVersion("1.3.0.12")>
<Assembly: AssemblyVersion("1.3.1.0")>
<Assembly: AssemblyFileVersion("1.3.1.0")>

View File

@@ -56,9 +56,9 @@ Imports NLog.Targets
''' </remarks>
Public Class LogConfig
#Region "Private Properties"
Private Const OPEN_FILE_CACHE_TIMEOUT As Integer = 5
Private Const OPEN_FILE_CACHE_TIMEOUT As Integer = 30
Private Const OPEN_FILE_FLUSH_TIMEOUT As Integer = 5
Private Const AUTO_FLUSH As Boolean = True
Private Const AUTO_FLUSH As Boolean = False
Private Const KEEP_FILES_OPEN As Boolean = False
Private Const KEEP_FILES_OPEN_DEBUG As Boolean = True

View File

@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.0.4.0")>
<Assembly: AssemblyFileVersion("2.0.4.0")>
<Assembly: AssemblyVersion("2.0.4.1")>
<Assembly: AssemblyFileVersion("2.0.4.1")>

View File

@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.2.4.0")>
<Assembly: AssemblyVersion("1.2.5.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>

View File

@@ -25,8 +25,6 @@ Public Class ThreadRunner
Private _jobArguments As WorkerArgs
Private _mssql As MSSQLServer
Private Const TIMER_INTERVAL_MS = 10_000
Public Sub New(LogConfig As LogConfig, Firebird As Firebird, Optional MSSQL As MSSQLServer = Nothing)
_logConfig = LogConfig
_logger = _logConfig.GetLogger()