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

29 lines
623 B
C#
Raw Normal View History

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-04-20 09:37:07 +03:00
protected readonly IReader _reader;
2023-04-17 08:49:26 +03:00
protected readonly WriterFactory _writerFactory;
2023-04-20 09:37:07 +03:00
protected IWriter _writer;
2023-04-06 08:29:39 +03:00
2023-04-17 08:49:26 +03:00
public Tool(IServiceProvider provider)
2023-04-06 08:29:39 +03:00
{
2023-04-20 09:37:07 +03:00
_reader = provider.GetRequiredService<IReader>();
2023-04-17 08:49:26 +03:00
_writerFactory = provider.GetRequiredService<WriterFactory>();
2023-04-06 08:29:39 +03:00
}
2023-04-07 07:19:49 +03:00
public void Dispose()
{
_reader.Dispose();
_writer.Dispose();
}
2023-04-06 08:29:39 +03:00
public abstract void Execute();
}