From 82be34b28e397434b5aaa044344a6a8b50617a11 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Wed, 7 Jul 2021 10:59:23 +0200 Subject: [PATCH] Duplicate files message box with top most, only hash filename for msg files directly from outlook --- Global_Indexer/ClassFileDrop.vb | 5 +++-- Global_Indexer/ClassIndexFunctions.vb | 20 +++++++++++--------- Global_Indexer/frmIndex.designer.vb | 4 ++-- Global_Indexer/frmIndex.resx | 24 ++++++++++++------------ Global_Indexer/frmIndex.vb | 10 ++++++---- Global_Indexer/frmStart.vb | 2 +- 6 files changed, 35 insertions(+), 30 deletions(-) diff --git a/Global_Indexer/ClassFileDrop.vb b/Global_Indexer/ClassFileDrop.vb index 1be9535..eb2645f 100644 --- a/Global_Indexer/ClassFileDrop.vb +++ b/Global_Indexer/ClassFileDrop.vb @@ -91,8 +91,7 @@ Public Class ClassFileDrop LOGGER.Info("Attachment File from Outlook could not be created") End If End If - End If - If e.Data.GetDataPresent("FileGroupDescriptor") Then + ElseIf e.Data.GetDataPresent("FileGroupDescriptor") Then Dim oApp As Outlook.Application Try oApp = New Outlook.Application() @@ -141,6 +140,8 @@ Public Class ClassFileDrop Next Return True 'Drop eines Outlook Attachments + Else + Return False End If Catch ex As Exception MsgBox("Error in Drop-File" & vbNewLine & ex.Message, MsgBoxStyle.Critical) diff --git a/Global_Indexer/ClassIndexFunctions.vb b/Global_Indexer/ClassIndexFunctions.vb index 8091211..ccd7da2 100644 --- a/Global_Indexer/ClassIndexFunctions.vb +++ b/Global_Indexer/ClassIndexFunctions.vb @@ -1,7 +1,7 @@ Imports System.IO Public Class ClassIndexFunctions - Public Shared Function FileExistsinDropTable(pFilename As String) As Date + Public Shared Function FileExistsinDropTable(pFilename As String, pHandleType As String) As Date Dim oSQL As String Dim oHash As String @@ -10,7 +10,7 @@ Public Class ClassIndexFunctions pFilename = pFilename.Replace("'", "''") End If - If pFilename.ToUpper.EndsWith(".MSG") Then + If pFilename.ToUpper.EndsWith(".MSG") And pHandleType = "|OUTLOOK_MESSAGE|" Then ' MSG Files cannot be hashed based on filecontents, so we use the filename instead oHash = FILESYSTEM.GetChecksumFromString(pFilename) Else @@ -55,25 +55,27 @@ Public Class ClassIndexFunctions End Try End Function - Public Shared Function CheckDuplicateFiles(Filepath As String, ModuleTitle As String) - Dim oFileInfo As New FileInfo(Filepath) + Public Shared Function CheckDuplicateFiles(pFilepath As String, pModuleTitle As String, Optional pHandleType As String = "") + Dim oFileInfo As New FileInfo(pFilepath) Dim oFilename As String = oFileInfo.Name - Dim oFileExists As Date = FileExistsinDropTable(Filepath) + Dim oFileExists As Date = FileExistsinDropTable(pFilepath, pHandleType) If oFileExists.Equals(Date.MinValue) Then Return True Else Dim oResult As DialogResult Dim oDate As String = oFileExists.ToString("d") - Dim oBoxTitle = $"GLOBIX - {ModuleTitle}" - Dim oBoxOptions = MsgBoxStyle.Question Or MsgBoxStyle.YesNo + Dim oBoxTitle = $"GLOBIX - {pModuleTitle}" + Dim oMessage As String If USER_LANGUAGE = "de-DE" Then - oResult = MsgBox($"Die Datei [{oFilename}] wurde bereits am [{oDate}] verarbeitet. Wollen Sie die gleiche Datei noch einmal verarbeiten?", oBoxOptions, oBoxTitle) + oMessage = $"Die Datei [{oFilename}] wurde bereits am [{oDate}] verarbeitet. Wollen Sie die gleiche Datei noch einmal verarbeiten?" Else - oResult = MsgBox($"The file [{oFilename}] has already been processed at [{oDate}]. Do you want to process the same file again?", oBoxOptions, oBoxTitle) + oMessage = $"The file [{oFilename}] has already been processed at [{oDate}]. Do you want to process the same file again?" End If + oResult = MessageBox.Show(oMessage, oBoxTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly) + If oResult = DialogResult.Yes Then Return True End If diff --git a/Global_Indexer/frmIndex.designer.vb b/Global_Indexer/frmIndex.designer.vb index b8d9302..1a2e4d4 100644 --- a/Global_Indexer/frmIndex.designer.vb +++ b/Global_Indexer/frmIndex.designer.vb @@ -107,9 +107,9 @@ Partial Class frmIndex Me.ComboboxDoctype.Name = "ComboboxDoctype" SerializableAppearanceObject1.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(214, Byte), Integer), CType(CType(49, Byte), Integer)) SerializableAppearanceObject1.Options.UseBackColor = True - Me.ComboboxDoctype.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons"), DevExpress.XtraEditors.Controls.ButtonPredefines), resources.GetString("ComboBoxEdit1.Properties.Buttons1"), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons2"), Integer), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons3"), Boolean), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons4"), Boolean), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons5"), Boolean), EditorButtonImageOptions1, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject1, SerializableAppearanceObject2, SerializableAppearanceObject3, SerializableAppearanceObject4, resources.GetString("ComboBoxEdit1.Properties.Buttons6"), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons7"), Object), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons8"), DevExpress.Utils.SuperToolTip), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons9"), DevExpress.Utils.ToolTipAnchor))}) + Me.ComboboxDoctype.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(CType(resources.GetObject("ComboboxDoctype.Properties.Buttons"), DevExpress.XtraEditors.Controls.ButtonPredefines), resources.GetString("ComboboxDoctype.Properties.Buttons1"), CType(resources.GetObject("ComboboxDoctype.Properties.Buttons2"), Integer), CType(resources.GetObject("ComboboxDoctype.Properties.Buttons3"), Boolean), CType(resources.GetObject("ComboboxDoctype.Properties.Buttons4"), Boolean), CType(resources.GetObject("ComboboxDoctype.Properties.Buttons5"), Boolean), EditorButtonImageOptions1, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject1, SerializableAppearanceObject2, SerializableAppearanceObject3, SerializableAppearanceObject4, resources.GetString("ComboboxDoctype.Properties.Buttons6"), CType(resources.GetObject("ComboboxDoctype.Properties.Buttons7"), Object), CType(resources.GetObject("ComboboxDoctype.Properties.Buttons8"), DevExpress.Utils.SuperToolTip), CType(resources.GetObject("ComboboxDoctype.Properties.Buttons9"), DevExpress.Utils.ToolTipAnchor))}) Me.ComboboxDoctype.Properties.ButtonsStyle = DevExpress.XtraEditors.Controls.BorderStyles.UltraFlat - Me.ComboboxDoctype.Properties.NullText = resources.GetString("ComboBoxEdit1.Properties.NullText") + Me.ComboboxDoctype.Properties.NullText = resources.GetString("ComboboxDoctype.Properties.NullText") Me.ComboboxDoctype.Properties.Padding = New System.Windows.Forms.Padding(5) ' 'RibbonControl1 diff --git a/Global_Indexer/frmIndex.resx b/Global_Indexer/frmIndex.resx index 956b782..591f3fa 100644 --- a/Global_Indexer/frmIndex.resx +++ b/Global_Indexer/frmIndex.resx @@ -433,37 +433,37 @@ 2 - + Combo - + - + 20 - + True - + True - + False - + - + - + - + Default - + Bitte wählen Sie ein Profil @@ -619,7 +619,7 @@ DocumentViewer1 - DigitalData.Controls.DocumentViewer.DocumentViewer, DigitalData.Controls.DocumentViewer, Version=1.4.4.0, Culture=neutral, PublicKeyToken=null + DigitalData.Controls.DocumentViewer.DocumentViewer, DigitalData.Controls.DocumentViewer, Version=1.6.3.0, Culture=neutral, PublicKeyToken=null SplitContainer1.Panel2 diff --git a/Global_Indexer/frmIndex.vb b/Global_Indexer/frmIndex.vb index 166201b..de73679 100644 --- a/Global_Indexer/frmIndex.vb +++ b/Global_Indexer/frmIndex.vb @@ -1658,11 +1658,11 @@ Public Class frmIndex If Directory.Exists(oDestination) = False Then MsgBox($"Profile Path [{oNewDestination}] is not available. Please select another profile.", MsgBoxStyle.Exclamation, Text) ComboboxDoctype.SelectedIndex = -1 + Else + WDDirect = oDocType.Item("WINDREAM_DIRECT") + CURRENT_DOKART_DUPLICATE_HANDLING = oDocType.Item("DUPLICATE_HANDLING") + Refresh_IndexeMan(oSelectedItem.Guid) End If - - WDDirect = oDocType.Item("WINDREAM_DIRECT") - CURRENT_DOKART_DUPLICATE_HANDLING = oDocType.Item("DUPLICATE_HANDLING") - Refresh_IndexeMan(oSelectedItem.Guid) End If End Sub @@ -2747,5 +2747,7 @@ Public Class frmIndex CONFIG.Save() End Sub + Private Sub RibbonControl1_Click(sender As Object, e As EventArgs) Handles RibbonControl1.Click + End Sub End Class diff --git a/Global_Indexer/frmStart.vb b/Global_Indexer/frmStart.vb index f5f979d..fe3468b 100644 --- a/Global_Indexer/frmStart.vb +++ b/Global_Indexer/frmStart.vb @@ -168,7 +168,7 @@ Public Class frmStart Dim oHandleType As String = oFiledropString.Substring(0, oLastPipe + 1) Dim oFilename As String = oFiledropString.Substring(oLastPipe + 1) - If ClassIndexFunctions.CheckDuplicateFiles(oFilename, "Manuelle Ablage") Then + If ClassIndexFunctions.CheckDuplicateFiles(oFilename, "Manuelle Ablage", oHandleType) Then ClassFilehandle.Decide_FileHandle(oFilename, oHandleType) End If End If