Windows: Add extensive logging for FileDrop
This commit is contained in:
parent
35116d4b8b
commit
bdb8127a51
@ -54,7 +54,11 @@ Partial Public Class FileDrop
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function GetFileFormat(pEvent As DragEventArgs) As FileFormat
|
Public Function GetFileFormat(pEvent As DragEventArgs) As FileFormat
|
||||||
|
Logger.Debug("Determining FileFormat")
|
||||||
|
|
||||||
If IsThunderbird(pEvent) Then
|
If IsThunderbird(pEvent) Then
|
||||||
|
Logger.Debug("File is a Thunderbird File")
|
||||||
|
|
||||||
If IsThunderbirdAttachment(pEvent) Then
|
If IsThunderbirdAttachment(pEvent) Then
|
||||||
Return FileFormat.ThunderbirdAttachment
|
Return FileFormat.ThunderbirdAttachment
|
||||||
|
|
||||||
@ -67,6 +71,8 @@ Partial Public Class FileDrop
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
If IsOutlook(pEvent) Then
|
If IsOutlook(pEvent) Then
|
||||||
|
Logger.Debug("File is an Outlook File")
|
||||||
|
|
||||||
If IsOutlookAttachment(pEvent) Then
|
If IsOutlookAttachment(pEvent) Then
|
||||||
Return FileFormat.OutlookAttachment
|
Return FileFormat.OutlookAttachment
|
||||||
|
|
||||||
@ -79,6 +85,8 @@ Partial Public Class FileDrop
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
If IsNormalFile(pEvent) Then
|
If IsNormalFile(pEvent) Then
|
||||||
|
Logger.Debug("File is a normal File")
|
||||||
|
|
||||||
Return FileFormat.LocalFile
|
Return FileFormat.LocalFile
|
||||||
|
|
||||||
Else
|
Else
|
||||||
@ -88,7 +96,13 @@ Partial Public Class FileDrop
|
|||||||
|
|
||||||
Public Function GetFiles(pEvent As DragEventArgs) As List(Of DroppedFile)
|
Public Function GetFiles(pEvent As DragEventArgs) As List(Of DroppedFile)
|
||||||
Try
|
Try
|
||||||
|
Dim oFormats As List(Of String) = GetFileFormats(pEvent)
|
||||||
|
Dim oFormatString = String.Join(", ", oFormats)
|
||||||
|
Logger.Debug("Available Formats: [{0}]", oFormatString)
|
||||||
|
|
||||||
Dim oFormat = GetFileFormat(pEvent)
|
Dim oFormat = GetFileFormat(pEvent)
|
||||||
|
Logger.Debug("Format: [{0}]", oFormat.ToString)
|
||||||
|
|
||||||
Dim oFiles As New List(Of DroppedFile)
|
Dim oFiles As New List(Of DroppedFile)
|
||||||
|
|
||||||
Select Case oFormat
|
Select Case oFormat
|
||||||
@ -115,9 +129,12 @@ Partial Public Class FileDrop
|
|||||||
|
|
||||||
End Select
|
End Select
|
||||||
|
|
||||||
|
Logger.Debug("Handled [{0}] dropped files.", oFiles.Count)
|
||||||
|
|
||||||
Return oFiles
|
Return oFiles
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
|
Logger.Warn("Error while handling dropped files.")
|
||||||
Logger.Error(ex)
|
Logger.Error(ex)
|
||||||
Return Nothing
|
Return Nothing
|
||||||
|
|
||||||
@ -165,10 +182,15 @@ Partial Public Class FileDrop
|
|||||||
End While
|
End While
|
||||||
End Using
|
End Using
|
||||||
|
|
||||||
Return oBuilder.ToString
|
Dim oFileName As String = oBuilder.ToString
|
||||||
|
Logger.Debug("Outlook filename is [{0}]", oFileName)
|
||||||
|
|
||||||
|
Return oFileName
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function GetOutlookFileContents_FromDragEvent(pEvent As DragEventArgs) As List(Of Byte())
|
Private Function GetOutlookFileContents_FromDragEvent(pEvent As DragEventArgs) As List(Of Byte())
|
||||||
|
Logger.Debug("Getting file contents")
|
||||||
|
|
||||||
Using oStream As IO.MemoryStream = pEvent.Data.GetData("FileContents", True)
|
Using oStream As IO.MemoryStream = pEvent.Data.GetData("FileContents", True)
|
||||||
If oStream Is Nothing Then
|
If oStream Is Nothing Then
|
||||||
Return Nothing
|
Return Nothing
|
||||||
@ -185,6 +207,9 @@ Partial Public Class FileDrop
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function GetOutlookFileContents_FromInterop(pEvent As DragEventArgs) As List(Of Byte())
|
Private Function GetOutlookFileContents_FromInterop(pEvent As DragEventArgs) As List(Of Byte())
|
||||||
|
Logger.Debug("Getting file contents")
|
||||||
|
Logger.Debug("Creating Outlook Application")
|
||||||
|
|
||||||
Dim oApp As Outlook.Application
|
Dim oApp As Outlook.Application
|
||||||
Try
|
Try
|
||||||
oApp = New Outlook.Application()
|
oApp = New Outlook.Application()
|
||||||
@ -197,6 +222,8 @@ Partial Public Class FileDrop
|
|||||||
Dim oMailItem As Outlook.MailItem
|
Dim oMailItem As Outlook.MailItem
|
||||||
For oIndex As Integer = 1 To oApp.ActiveExplorer.Selection.Count
|
For oIndex As Integer = 1 To oApp.ActiveExplorer.Selection.Count
|
||||||
Try
|
Try
|
||||||
|
Logger.Debug("Fetching mail [{0}]")
|
||||||
|
|
||||||
oMailItem = oApp.ActiveExplorer.Selection.Item(oIndex)
|
oMailItem = oApp.ActiveExplorer.Selection.Item(oIndex)
|
||||||
|
|
||||||
Dim oSubject As String = ConvertTextToSlug(oMailItem.Subject)
|
Dim oSubject As String = ConvertTextToSlug(oMailItem.Subject)
|
||||||
@ -229,8 +256,11 @@ Partial Public Class FileDrop
|
|||||||
Return oResults
|
Return oResults
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Logger.Error(ex)
|
Logger.Error(ex)
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
Return Nothing
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function GetFormat(pEvent As DragEventArgs, pFormat As String, pAutoConvert As Boolean) As Object
|
Public Function GetFormat(pEvent As DragEventArgs, pFormat As String, pAutoConvert As Boolean) As Object
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user