33 lines
1.1 KiB
C#
33 lines
1.1 KiB
C#
namespace JD.Nas.Reporting.Console.Module
|
|
{
|
|
using Plume.Interfaces.Console.Modules;
|
|
using Plume.Interfaces.Modules;
|
|
using JD.Nas.Service;
|
|
using JetBrains.Annotations;
|
|
using System;
|
|
|
|
public class ReportingConsoleModule: IConsoleModule
|
|
{
|
|
private ReportingConsoleModuleSetup _setup;
|
|
|
|
public void Initialize([NotNull] IConsoleModuleContext context)
|
|
{
|
|
context.CommandLineManager.Register<ReportingConsoleOption>(new ReportingConsoleAction(context.GetService<INasReportingService>(), _setup.ApplicationLogPath));
|
|
}
|
|
|
|
public void Setup(IModuleSetup setup)
|
|
{
|
|
if (setup == null)
|
|
{
|
|
throw new ArgumentNullException(nameof(setup));
|
|
}
|
|
var configuration = setup as ReportingConsoleModuleSetup;
|
|
_setup = configuration ?? throw new ArgumentException($"Expecting an {nameof(ReportingConsoleModuleSetup)} not a {setup.GetType()}", nameof(setup));
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
// Nothing to dispose
|
|
}
|
|
}
|
|
}
|