WIP
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
Imports System.Globalization
|
||||
Imports System.IO
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports MultiTool.Shared.Exceptions
|
||||
Imports MultiTool.Shared.Schemas
|
||||
Imports MultiTool.Shared.Winline
|
||||
|
||||
@@ -8,7 +9,7 @@ Namespace Documents
|
||||
Public Class DocumentLoader
|
||||
Inherits BaseClass
|
||||
|
||||
Private ReadOnly Winline As Winline.Data
|
||||
Private ReadOnly Winline As WinlineData
|
||||
|
||||
Public Property Files As New List(Of Document)
|
||||
Public Event FileLoadComplete As EventHandler(Of FileLoadInfo)
|
||||
@@ -18,7 +19,7 @@ Namespace Documents
|
||||
Public FilesTotal As Integer
|
||||
End Structure
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pWinline As Winline.Data)
|
||||
Public Sub New(pLogConfig As LogConfig, pWinline As WinlineData)
|
||||
MyBase.New(pLogConfig, pLogConfig.GetLogger())
|
||||
Winline = pWinline
|
||||
End Sub
|
||||
@@ -39,14 +40,23 @@ Namespace Documents
|
||||
Logger.Debug("Found [{0}] files in directory [{1}]", oFiles.Count, oDirectory)
|
||||
|
||||
For Each oFile In oFiles
|
||||
Dim oDocument = LoadFile(oFile, pSchema, pMandator)
|
||||
Files.Add(oDocument)
|
||||
Try
|
||||
Dim oDocument = LoadFile(oFile, pSchema, pMandator)
|
||||
Files.Add(oDocument)
|
||||
|
||||
Dim oInfo As FileLoadInfo
|
||||
oInfo.FilesLoaded = Files.Count
|
||||
oInfo.FilesTotal = oFiles.Count
|
||||
Dim oInfo As FileLoadInfo
|
||||
oInfo.FilesLoaded = Files.Count
|
||||
oInfo.FilesTotal = oFiles.Count
|
||||
|
||||
RaiseEvent FileLoadComplete(Me, oInfo)
|
||||
RaiseEvent FileLoadComplete(Me, oInfo)
|
||||
Catch ex As MissingAttributeException
|
||||
Logger.Error(ex)
|
||||
Throw New DocumentLoaderException($"Missing Attribute '{ex.Message}' in File '{oFile.Name}'")
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
Next
|
||||
|
||||
Return True
|
||||
|
||||
Reference in New Issue
Block a user