downloadmanager/Program.cs
Robert Morrison 9a1838becc
EVIL COMMIT!
That one evil commit that means you've actually started development like
a real developer.
But before that you just wrote things
2023-05-12 22:58:58 +01:00

39 lines
1.0 KiB
C#

using Serilog;
using System.CommandLine;
namespace DownloadManager;
class Program
{
static void Main(string[] args)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.Console()
.CreateLogger();
Log.Information("Starting DownloadManager");
configuration config = new();
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.Console()
.WriteTo.File($"{config.logDirectory}/log.txt", rollingInterval: RollingInterval.Day)
.CreateLogger();
Log.Information("Configuration created, Logger re-created with file logging.");
RootCommand root = new RootCommand("Download Manager");
root.SetHandler(() => { run(config); });
root.Invoke(args);
}
/* Handler method for root command */
static void run(configuration config)
{
RuleManager ruleManager = new(ref config);
ruleManager.ApplyRules();
}
}