That one evil commit that means you've actually started development like a real developer. But before that you just wrote things
39 lines
1.0 KiB
C#
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();
|
|
}
|
|
}
|