MS Handling Löschen
This commit is contained in:
@@ -5,19 +5,23 @@ Imports DigitalData.Modules.Logging
|
||||
Public Class TempFiles
|
||||
Inherits BaseClass
|
||||
|
||||
Public Property TempPath As String
|
||||
Public Property _TempPath As String
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig)
|
||||
MyBase.New(pLogConfig)
|
||||
|
||||
Dim oTempDirectoryPath = Path.GetTempPath()
|
||||
TempPath = Path.Combine(oTempDirectoryPath, "EnvelopeGenerator")
|
||||
_TempPath = Path.Combine(oTempDirectoryPath, "EnvelopeGenerator")
|
||||
|
||||
If Not Directory.Exists(_TempPath) Then
|
||||
Directory.CreateDirectory(_TempPath)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Function Create() As Boolean
|
||||
Try
|
||||
If Directory.Exists(TempPath) = False Then
|
||||
Directory.CreateDirectory(TempPath)
|
||||
If Directory.Exists(_TempPath) = False Then
|
||||
Directory.CreateDirectory(_TempPath)
|
||||
Else
|
||||
CleanUpFiles()
|
||||
End If
|
||||
@@ -32,10 +36,13 @@ Public Class TempFiles
|
||||
|
||||
Private Function CleanUpFiles() As Boolean
|
||||
Try
|
||||
For Each fileItem As String In Directory.GetFiles(TempPath)
|
||||
Logger.Debug("Deleting tempPath-file: {0} ...", fileItem)
|
||||
File.Delete(fileItem)
|
||||
Next
|
||||
If Directory.Exists(_TempPath) Then
|
||||
For Each fileItem As String In Directory.GetFiles(_TempPath)
|
||||
Logger.Debug("Deleting tempPath-file: {0} ...", fileItem)
|
||||
File.Delete(fileItem)
|
||||
Next
|
||||
End If
|
||||
|
||||
|
||||
Return True
|
||||
|
||||
@@ -47,8 +54,8 @@ Public Class TempFiles
|
||||
|
||||
Public Function CleanUp() As Boolean
|
||||
Try
|
||||
Logger.Debug("Deleting tempPath-Data: {0} ...", TempPath)
|
||||
Directory.Delete(TempPath, True)
|
||||
Logger.Debug("Deleting tempPath-Data: {0} ...", _TempPath)
|
||||
Directory.Delete(_TempPath, True)
|
||||
Return True
|
||||
|
||||
Catch ex As Exception
|
||||
|
||||
Reference in New Issue
Block a user