2023-04-06 08:29:39 +03:00
|
|
|
|
#if !NET472
|
|
|
|
|
using System.Runtime.Versioning;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
namespace RhSolutions.Tools;
|
|
|
|
|
|
|
|
|
|
#if !NET472
|
|
|
|
|
[SupportedOSPlatform("windows")]
|
|
|
|
|
#endif
|
2023-04-14 08:08:46 +03:00
|
|
|
|
internal abstract class Tool : IDisposable
|
2023-04-06 08:29:39 +03:00
|
|
|
|
{
|
2023-05-22 07:39:48 +03:00
|
|
|
|
protected readonly ReaderFactory _readerFactory;
|
2023-04-17 08:49:26 +03:00
|
|
|
|
protected readonly WriterFactory _writerFactory;
|
2023-05-22 07:39:48 +03:00
|
|
|
|
protected IReader _reader;
|
2023-04-20 09:37:07 +03:00
|
|
|
|
protected IWriter _writer;
|
2023-04-06 08:29:39 +03:00
|
|
|
|
|
2023-06-20 11:51:52 +03:00
|
|
|
|
public Tool(ReaderFactory readerFactory, WriterFactory writerFactory)
|
2023-04-06 08:29:39 +03:00
|
|
|
|
{
|
2023-06-20 11:51:52 +03:00
|
|
|
|
_readerFactory = readerFactory;
|
|
|
|
|
_writerFactory = writerFactory;
|
2023-04-06 08:29:39 +03:00
|
|
|
|
}
|
|
|
|
|
|
2023-04-07 07:19:49 +03:00
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
2023-06-20 11:51:52 +03:00
|
|
|
|
_reader?.Dispose();
|
|
|
|
|
_writer?.Dispose();
|
2023-04-07 07:19:49 +03:00
|
|
|
|
}
|
|
|
|
|
|
2023-04-06 08:29:39 +03:00
|
|
|
|
public abstract void Execute();
|
|
|
|
|
}
|