30 lines
680 B
C#
30 lines
680 B
C#
#if !NET472
|
|
using System.Runtime.Versioning;
|
|
#endif
|
|
|
|
namespace RhSolutions.Tools;
|
|
|
|
#if !NET472
|
|
[SupportedOSPlatform("windows")]
|
|
#endif
|
|
internal abstract class Tool : IDisposable
|
|
{
|
|
protected readonly ReaderFactory _readerFactory;
|
|
protected readonly WriterFactory _writerFactory;
|
|
protected IReader _reader;
|
|
protected IWriter _writer;
|
|
|
|
public Tool(IServiceProvider provider)
|
|
{
|
|
_readerFactory = provider.GetRequiredService<ReaderFactory>();
|
|
_writerFactory = provider.GetRequiredService<WriterFactory>();
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
_reader.Dispose();
|
|
_writer.Dispose();
|
|
}
|
|
|
|
public abstract void Execute();
|
|
} |