Imports DigitalData.Modules.Logging Imports System.IO Public Class Path Private ReadOnly _LogConfig As LogConfig Private ReadOnly _Logger As Logger Private ReadOnly _BasePath As String Public Sub New(LogConfig As LogConfig, DatastoreBasePath As String) _LogConfig = LogConfig _Logger = LogConfig.GetLogger() _BasePath = DatastoreBasePath End Sub Public Function GetFullPath(DocumentType As String, Optional FileName As String = "") As String Dim oParts = New List(Of String) From {_BasePath} oParts.AddRange(Do_GetRelativePath(DocumentType, FileName)) Return IO.Path.Combine(oParts.ToArray()) End Function Public Function GetFullPathFromRelativePath(RelativePath As String) As String Dim oParts = New List(Of String) From {_BasePath} oParts.Add(RelativePath) Return IO.Path.Combine(oParts.ToArray) End Function Public Function GetRelativePath(DocumentType As String, Optional FileName As String = "") As String Return IO.Path.Combine(Do_GetRelativePath(DocumentType, FileName).ToArray) End Function Private Function Do_GetRelativePath(DocumentType As String, Optional FileName As String = "") As List(Of String) Dim oPathParts As New List(Of String) From {DocumentType} oPathParts.AddRange(GetDatePath()) oPathParts.Add(FileName) Return oPathParts 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