ThiefLightmapper/KeepersCompound.Lightmapper/Program.cs

56 lines
1.8 KiB
C#
Raw Normal View History

2024-12-09 16:03:27 +00:00
using DotMake.CommandLine;
2025-01-11 12:32:13 +00:00
using Serilog;
using Serilog.Sinks.SystemConsole.Themes;
2024-10-28 20:40:06 +00:00
namespace KeepersCompound.Lightmapper;
2024-10-29 07:43:32 +00:00
internal static class Program
{
2025-01-11 12:32:13 +00:00
private static void ConfigureLogger()
{
const string outputTemplate = "{Timestamp:HH:mm:ss.fff} [{Level}] {Message:lj}{NewLine}{Exception}";
var logPath = $"{AppDomain.CurrentDomain.BaseDirectory}/logs/{DateTime.Now:yyyyMMdd_HHmmss}.log";
var config = new LoggerConfiguration();
#if DEBUG
config.MinimumLevel.Debug();
#endif
Log.Logger = config
.WriteTo.Console(theme: AnsiConsoleTheme.Sixteen, outputTemplate: outputTemplate)
.WriteTo.File(logPath, outputTemplate: outputTemplate)
.CreateLogger();
}
public static async Task<int> Main(string[] args)
{
ConfigureLogger();
return await Cli.RunAsync<LightCommand>(args);
}
2024-10-29 07:43:32 +00:00
}
2024-09-29 09:22:43 +00:00
2024-12-09 16:03:27 +00:00
[CliCommand(Description = "Compute lightmaps for a NewDark .MIS/.COW")]
public class LightCommand
2024-10-29 07:43:32 +00:00
{
2024-12-09 16:03:27 +00:00
[CliArgument(Description = "The path to the root Thief installation.")]
public required string InstallPath { get; set; }
[CliArgument(Description = "The folder name of the fan mission. For OMs this is blank.")]
public required string CampaignName { get; set; }
[CliArgument(Description = "The name of the mission file including extension.")]
public required string MissionName { get; set; }
[CliOption(Description = "Name of output file excluding extension.")]
public string OutputName { get; set; } = "kc_lit";
2024-12-09 16:03:27 +00:00
public void Run()
2024-10-29 07:43:32 +00:00
{
Timing.Reset();
2024-12-09 16:03:27 +00:00
2024-10-29 07:43:32 +00:00
var lightMapper = new LightMapper(InstallPath, CampaignName, MissionName);
lightMapper.Light();
2024-10-29 07:43:32 +00:00
lightMapper.Save(OutputName);
2024-12-09 16:03:27 +00:00
2024-10-29 07:43:32 +00:00
Timing.LogAll();
2024-09-23 15:57:02 +00:00
}
}