Add project files.
This commit is contained in:
54
PatchEmAll-CLI/Program.cs
Normal file
54
PatchEmAll-CLI/Program.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using Serilog;
|
||||
using Serilog.Formatting.Display;
|
||||
using Serilog.Sinks.LogEmAll;
|
||||
|
||||
namespace PatchEmAll_CLI
|
||||
{
|
||||
/// <summary>
|
||||
/// The Main Program Class.
|
||||
/// </summary>
|
||||
class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The Main entry point for the program.
|
||||
/// </summary>
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// Configure the Logger.
|
||||
ConfigureSerilog();
|
||||
|
||||
// Create a new program object.
|
||||
PatchEmAll.PatchEmAll pea = new PatchEmAll.PatchEmAll();
|
||||
|
||||
// Set the title.
|
||||
pea.UpdateTitle();
|
||||
|
||||
// Print the version.
|
||||
pea.PrintVersion();
|
||||
|
||||
// Load the default options passed from the default options file.
|
||||
pea.LoadOptionsFromFile();
|
||||
|
||||
// Load the default options passed from the command line arguments.
|
||||
pea.LoadOptionsFromCLI(args);
|
||||
|
||||
// Process the command switch.
|
||||
pea.ProcessCommandSwitch();
|
||||
|
||||
// Output the log to a text file.
|
||||
pea.SaveLogToFile();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configure the logger.
|
||||
/// </summary>
|
||||
public static void ConfigureSerilog()
|
||||
{
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.MinimumLevel.Information()
|
||||
.WriteTo.Console(outputTemplate: "{Level:u4}: {Message:lj}{NewLine}{Exception}")
|
||||
.WriteToListString(new MessageTemplateTextFormatter("{Level:u4}: {Message:lj}{Exception}"))
|
||||
.CreateLogger();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user