23-12-2022
This commit is contained in:
@@ -46,7 +46,7 @@ Namespace Scheduler.Jobs
|
||||
State.JobStatus.Update(ctx, pCurrentValue, pTotalValue)
|
||||
End Sub
|
||||
|
||||
Public Sub LogDebug(pMessage As String, ParamArray pArgs As String())
|
||||
Public Sub LogDebug(pMessage As String, ParamArray pArgs As Object())
|
||||
Logger.Debug(pMessage, pArgs)
|
||||
JobSteps.Add(New StatusItem.HistoryStep With {
|
||||
.Message = String.Format(pMessage, pArgs),
|
||||
@@ -54,15 +54,16 @@ Namespace Scheduler.Jobs
|
||||
})
|
||||
End Sub
|
||||
|
||||
Public Sub LogInfo(pMessage As String, ParamArray pArgs As String())
|
||||
Public Sub LogInfo(pMessage As String, ParamArray pArgs As Object())
|
||||
Logger.Info(pMessage, pArgs)
|
||||
|
||||
JobSteps.Add(New StatusItem.HistoryStep With {
|
||||
.Message = String.Format(pMessage, pArgs),
|
||||
.Level = StatusItem.STEP_INFO
|
||||
})
|
||||
End Sub
|
||||
|
||||
Public Sub LogWarning(pMessage As String, ParamArray pArgs As String())
|
||||
Public Sub LogWarning(pMessage As String, ParamArray pArgs As Object())
|
||||
Logger.Warn(pMessage, pArgs)
|
||||
JobSteps.Add(New StatusItem.HistoryStep With {
|
||||
.Message = String.Format(pMessage, pArgs),
|
||||
@@ -70,15 +71,13 @@ Namespace Scheduler.Jobs
|
||||
})
|
||||
End Sub
|
||||
|
||||
Public Sub LogError(pMessage As String, ParamArray pArgs As String())
|
||||
Public Sub LogError(pMessage As String, ParamArray pArgs As Object())
|
||||
Logger.Error(pMessage, pArgs)
|
||||
JobSteps.Add(New StatusItem.HistoryStep With {
|
||||
.Message = String.Format(pMessage, pArgs),
|
||||
.Level = StatusItem.STEP_ERROR
|
||||
})
|
||||
End Sub
|
||||
|
||||
|
||||
Public Function CompleteJob(pMessage As String) As Task(Of Boolean)
|
||||
ctx.Result = State.JobStatus.CompleteWithSuccess(ctx, JobSteps, pMessage)
|
||||
Return Task.FromResult(True)
|
||||
|
||||
@@ -3,6 +3,7 @@ Imports Quartz
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports DigitalData.Modules.Filesystem
|
||||
Imports ECM.JobRunner.Common
|
||||
Imports FxResources.System
|
||||
|
||||
Namespace Scheduler.Jobs
|
||||
|
||||
@@ -176,11 +177,28 @@ Namespace Scheduler.Jobs
|
||||
'Check if target folder exists
|
||||
If Windream.TestFolderExists(pProfile.TargetFolder) = False Then
|
||||
If Windream.NewFolder(pProfile.TargetFolder) = False Then
|
||||
Logger.Warn("Folder [{0}] could not be created!", pProfile.TargetFolder)
|
||||
Logger.Warn("Folder [{0}] could not be created! Exiting.", pProfile.TargetFolder)
|
||||
Return Nothing
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim oFinalDirectoryPath = pProfile.TargetFolder
|
||||
|
||||
If pProfile.SubfolderDateFormat <> String.Empty Then
|
||||
' ToString formatter needs the backslashes escaped again.
|
||||
Dim oSubfolders = Now.ToString(pProfile.SubfolderDateFormat.Replace())
|
||||
Dim oFullPath = IO.Path.Combine(pProfile.TargetFolder, oSubfolders)
|
||||
|
||||
Logger.Debug("Creating subfolder [{0}] in Target path [{1}]", oSubfolders, pProfile.TargetFolder)
|
||||
|
||||
If Windream.NewFolder(oFullPath) = False Then
|
||||
Logger.Warn("Folder [{0}] could not be created! Exiting.", oFullPath)
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
oFinalDirectoryPath = oFullPath
|
||||
End If
|
||||
|
||||
' Generate new filepath and stream file
|
||||
Dim oFileName = IO.Path.GetFileName(pFile.FilePath)
|
||||
Dim oNewFilePath As String = IO.Path.Combine(pProfile.TargetFolder, oFileName)
|
||||
|
||||
Reference in New Issue
Block a user