MS18042016
This commit is contained in:
@@ -39,11 +39,12 @@ Public Class ClassDragDrop
|
||||
intCnt += 1
|
||||
Loop
|
||||
stmInput.Close()
|
||||
|
||||
'Sonderzeichen entfernen
|
||||
Dim Tempfilename = ClassFilehandle.InvalidCharacters(stbFileName.ToString)
|
||||
Dim anhaenge = e.Data.GetDataPresent("FileContents")
|
||||
'Dim path As String = "C:\VBProjekte\Dateien"
|
||||
'// put the zip file into the temp directory
|
||||
Dim strOutFile As String = Path.GetTempPath() & stbFileName.ToString()
|
||||
Dim strOutFile As String = Path.GetTempPath() & Tempfilename
|
||||
'// create the full-path name
|
||||
'//
|
||||
'// Second step: we have the file name.
|
||||
@@ -62,7 +63,10 @@ Public Class ClassDragDrop
|
||||
Dim fsOutput As IO.FileStream = New IO.FileStream(strOutFile, IO.FileMode.Create) ';
|
||||
fsOutput.Write(aryFileBytes, 0, aryFileBytes.Length)
|
||||
fsOutput.Close() ' // close the file
|
||||
|
||||
Dim resultVersion = ClassFilehandle.Versionierung_Datei(strOutFile)
|
||||
If resultVersion <> "" Then
|
||||
strOutFile = resultVersion
|
||||
End If
|
||||
Dim finTemp As IO.FileInfo = New IO.FileInfo(strOutFile)
|
||||
'// always good to make sure we actually created the file
|
||||
If (finTemp.Exists = True) Then
|
||||
@@ -80,7 +84,7 @@ Public Class ClassDragDrop
|
||||
Try
|
||||
oApp = New Outlook.Application()
|
||||
Catch ex As Exception
|
||||
MsgBox("Fehler bei 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
|
||||
|
||||
ClassLogger.Add(">> Drop of msg", False)
|
||||
@@ -89,18 +93,26 @@ Public Class ClassDragDrop
|
||||
For i As Integer = 1 To oApp.ActiveExplorer.Selection.Count
|
||||
myobj = oApp.ActiveExplorer.Selection.Item(i)
|
||||
Dim subj As String = myobj.Subject
|
||||
If subj = "" Then
|
||||
subj = "NO_SUBJECT"
|
||||
End If
|
||||
If subj.Contains("\") Then
|
||||
subj = subj.Replace("\", "-")
|
||||
End If
|
||||
If subj.Contains("/") Then
|
||||
subj = subj.Replace("/", "-")
|
||||
End If
|
||||
'Sonderzeichen entfernen
|
||||
subj = ClassFilehandle.InvalidCharacters(subj)
|
||||
'hardcode a destination path for testing
|
||||
Dim strFile As String = IO.Path.Combine(Path.GetTempPath, (subj + ".msg").Replace(":", ""))
|
||||
Dim strFile As String = IO.Path.Combine(Path.GetTempPath, subj + ".msg")
|
||||
strFile = strFile.Replace("?", "")
|
||||
strFile = strFile.Replace("!", "")
|
||||
strFile = strFile.Replace("%", "")
|
||||
strFile = strFile.Replace("$", "")
|
||||
|
||||
|
||||
|
||||
ClassLogger.Add(">> Drop of msg - File:" & strFile, False)
|
||||
Try
|
||||
myobj.SaveAs(strFile)
|
||||
@@ -122,13 +134,5 @@ Public Class ClassDragDrop
|
||||
|
||||
|
||||
End Function
|
||||
''' <summary>
|
||||
''' Diese Funktion entfernt alle Zeichen aus dem übergebenen String
|
||||
''' die in Dateinamen nicht erlaubt sind.
|
||||
''' </summary>
|
||||
''' <param name="Input">Der zu prüfende String</param>
|
||||
''' <returns>String ohne nichterlaubte Zeichen</returns>
|
||||
Private Shared Function AdjustPath(Input As String) As String
|
||||
Return System.Text.RegularExpressions.Regex.Replace(Input, "[\\/:*?""<>|]", String.Empty)
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user