add EDMI.File Module

This commit is contained in:
Jonathan Jenne
2020-04-06 15:17:18 +02:00
parent 7de03b4889
commit 77b6658988
13 changed files with 537 additions and 3 deletions

41
EDMI.File/Path.vb Normal file
View File

@@ -0,0 +1,41 @@
Imports DigitalData.Modules.Logging
Imports System.IO
Public Class Path
Private ReadOnly _LogConfig As LogConfig
Private ReadOnly _Logger As Logger
Public Const BASE_PATH_ACTIVE As String = "Active"
Public Const BASE_PATH_ARCHIVE As String = "Archive"
Public Const BASE_PATH_EDMI As String = "EDMI"
Public Sub New(LogConfig As LogConfig)
_LogConfig = LogConfig
_Logger = LogConfig.GetLogger()
End Sub
Public Function GetActivePath(DocumentType As String)
Dim oPathParts As New List(Of String) From {BASE_PATH_EDMI, BASE_PATH_ACTIVE, DocumentType}
oPathParts.AddRange(GetDatePath())
Return IO.Path.Combine(oPathParts.ToArray())
End Function
Public Function GetArchivePath(DocumentType As String)
Dim oPathParts As New List(Of String) From {BASE_PATH_EDMI, BASE_PATH_ARCHIVE, DocumentType}
oPathParts.AddRange(GetDatePath())
Return IO.Path.Combine(oPathParts.ToArray())
End Function
Private Function GetDatePath() As List(Of String)
Dim oDate = DateTime.Now
Dim oResultList As New List(Of String) From {
oDate.Year,
oDate.Month.ToString.PadLeft(2, "0"),
oDate.Day.ToString.PadLeft(2, "0")
}
Return oResultList
End Function
End Class