MONSTER: Rename Monorepo to Modules, only keep Projects under Modules.*

This commit is contained in:
Jonathan Jenne
2022-09-29 13:46:00 +02:00
parent e87b97bfec
commit 042bbce9f4
1557 changed files with 380 additions and 160017 deletions

48
EDMIAPI/Helpers.vb Normal file
View File

@@ -0,0 +1,48 @@
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
Imports DigitalData.Modules.Logging
Public Class Helpers
Private ReadOnly LogConfig As LogConfig
Private ReadOnly Logger As Logger
Private ReadOnly FileEx As Filesystem.File
Public Sub New(pLogConfig As LogConfig)
LogConfig = pLogConfig
Logger = pLogConfig.GetLogger()
FileEx = New Filesystem.File(pLogConfig)
End Sub
Public Function GetFileProperties(pFilePath As String, pDateImportedAt As Date) As FileProperties
Try
Using oFileStream As New IO.FileStream(pFilePath, IO.FileMode.Open, IO.FileAccess.Read)
Using oMemoryStream As New IO.MemoryStream()
oFileStream.CopyTo(oMemoryStream)
Dim oContents = oMemoryStream.ToArray()
Dim oFileInfo As New IO.FileInfo(pFilePath)
Dim oExtension As String = oFileInfo.Extension
Dim oFileName As String = oFileInfo.Name
Dim oFileCreatedAt As Date = oFileInfo?.CreationTime
Dim oFileModifiedAt As Date = oFileInfo?.LastWriteTime
Dim oFileHash As String = FileEx.GetChecksum(oFileInfo.FullName)
Return New FileProperties With {
.FileName = oFileInfo.Name,
.FileCreatedAt = oFileCreatedAt,
.FileChangedAt = oFileModifiedAt,
.FileContents = oContents,
.FileImportedAt = pDateImportedAt,
.FileChecksum = oFileHash,
.FileInfoRaw = oFileInfo
}
End Using
End Using
Catch ex As Exception
Logger.Error(ex)
Return Nothing
End Try
End Function
End Class