Add project files.
This commit is contained in:
55
Files2Folders2Files-CLI/Program.cs
Normal file
55
Files2Folders2Files-CLI/Program.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using Serilog;
|
||||
using Serilog.Formatting.Display;
|
||||
using Serilog.Sinks.LogEmAll;
|
||||
|
||||
namespace Files2Folders2Files_CLI
|
||||
{
|
||||
/// <summary>
|
||||
/// The Main Program Class.
|
||||
/// </summary>
|
||||
class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
/// <param name="args"></param>
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// Configure the Logger.
|
||||
ConfigureSerilog();
|
||||
|
||||
// Create a new program object.
|
||||
Files2Folders2Files.Files2Folders2Files f2f2f = new Files2Folders2Files.Files2Folders2Files();
|
||||
|
||||
// Set the title.
|
||||
f2f2f.UpdateTitle();
|
||||
|
||||
// Print the version.
|
||||
f2f2f.PrintVersion();
|
||||
|
||||
// Load the default options passed from the default options file.
|
||||
f2f2f.LoadOptionsFromFile();
|
||||
|
||||
// Load the default options passed from the command line arguments.
|
||||
f2f2f.LoadOptionsFromCLI(args);
|
||||
|
||||
// Process the command switch.
|
||||
f2f2f.ProcessCommandSwitch();
|
||||
|
||||
// Output the log to a text file.
|
||||
f2f2f.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