RhSolutions-AddIn/RhSolutions.AddIn/Tools/Tool.cs

31 lines
595 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(ReaderFactory readerFactory, WriterFactory writerFactory)
{
_readerFactory = readerFactory;
_writerFactory = writerFactory;
}
public void Dispose()
{
_reader?.Dispose();
_writer?.Dispose();
}
public abstract void Execute();
}