Salmon/Salmon.Service/Configuration.cs
2024-04-25 22:02:17 +02:00

47 lines
1.1 KiB
C#

using Salmon.Core;
using Salmon.Model.Monitor;
using System.Security.Cryptography.X509Certificates;
namespace Salmon.Service;
public class Configuration
{
public Uri? Url { get; set; }
public int? Period { get; set; }
public bool? MonitorHardware { get; set; } = true;
public bool? MonitorLocalSoftware { get; set; } = true;
public List<WatcherConfiguration> Watch { get; set; } = new ();
}
public abstract class WatcherConfiguration
{
public abstract Task<IEnumerable<Element>> ForgeElements();
}
public class ExecutableInstanceWatcherConfiguration
: WatcherConfiguration
{
public string Path { get; set; }
public override async Task<IEnumerable<Element>> ForgeElements()
{
List<Element> ret = new();
foreach (var el in Software.FromPath(Path))
ret.Add(el);
return ret;
}
}
public class HttpPageWatcherConfiguration
: WatcherConfiguration
{
public string Method { get; set; } = "GET";
public string Uri { get; set; }
public override async Task<IEnumerable<Element>> ForgeElements()
{
throw new NotImplementedException();
}
}