2023-09-11 - THUMBNAILS!!!!!
This commit is contained in:
58
EnvelopeGenerator.Form/Helper/TempFiles.vb
Normal file
58
EnvelopeGenerator.Form/Helper/TempFiles.vb
Normal file
@@ -0,0 +1,58 @@
|
||||
Imports System.IO
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class TempFiles
|
||||
Inherits BaseClass
|
||||
|
||||
Public Property TempPath As String
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig)
|
||||
MyBase.New(pLogConfig)
|
||||
|
||||
Dim oTempDirectoryPath = Path.GetTempPath()
|
||||
TempPath = Path.Combine(oTempDirectoryPath, "EnvelopeGenerator")
|
||||
End Sub
|
||||
|
||||
Public Function Create() As Boolean
|
||||
Try
|
||||
If Directory.Exists(TempPath) = False Then
|
||||
Directory.CreateDirectory(TempPath)
|
||||
Else
|
||||
CleanUpFiles()
|
||||
End If
|
||||
Return True
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
Private Function CleanUpFiles() As Boolean
|
||||
Try
|
||||
For Each fileItem As String In Directory.GetFiles(TempPath)
|
||||
File.Delete(fileItem)
|
||||
Next
|
||||
|
||||
Return True
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function CleanUp() As Boolean
|
||||
Try
|
||||
Directory.Delete(TempPath)
|
||||
Return True
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user