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
|
|
|
|
{
|
2024-11-06 23:43:00 +03:00
|
|
|
|
protected readonly ReaderFactory _readerFactory;
|
|
|
|
|
protected readonly WriterFactory _writerFactory;
|
|
|
|
|
protected IReader _reader;
|
|
|
|
|
protected IWriter _writer;
|
2023-04-06 08:29:39 +03:00
|
|
|
|
|
2024-11-06 23:43:00 +03:00
|
|
|
|
public Tool(ReaderFactory readerFactory, WriterFactory writerFactory)
|
|
|
|
|
{
|
|
|
|
|
_readerFactory = readerFactory;
|
|
|
|
|
_writerFactory = writerFactory;
|
|
|
|
|
}
|
2023-04-06 08:29:39 +03:00
|
|
|
|
|
2024-11-06 23:43:00 +03:00
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
|
|
|
|
_reader?.Dispose();
|
|
|
|
|
_writer?.Dispose();
|
|
|
|
|
}
|
2023-04-07 07:19:49 +03:00
|
|
|
|
|
2024-11-06 23:43:00 +03:00
|
|
|
|
public abstract void Execute();
|
|
|
|
|
}
|