refactoring

This commit is contained in:
ikpil 2023-04-30 19:19:37 +09:00
parent d682d0f6a3
commit 6391b3b243
1 changed files with 19 additions and 11 deletions

View File

@ -10,15 +10,13 @@ public static class Program
{ {
public static void Main(string[] args) public static void Main(string[] args)
{ {
var path = Loader.ToRPath("dungeon.obj"); InitializeLogger();
path = Path.GetDirectoryName(path); InitializeWorkingDirectory();
if (!string.IsNullOrEmpty(path)) StartDemo();
{ }
var workingDirectory = Path.Combine(path, "..");
workingDirectory = Path.GetFullPath(workingDirectory);
Directory.SetCurrentDirectory(workingDirectory);
}
private static void InitializeLogger()
{
var format = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff} [{Level:u3}] {Message:lj} [{ThreadName}:{ThreadId}]{NewLine}{Exception}"; var format = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff} [{Level:u3}] {Message:lj} [{ThreadName}:{ThreadId}]{NewLine}{Exception}";
Log.Logger = new LoggerConfiguration() Log.Logger = new LoggerConfiguration()
.MinimumLevel.Verbose() .MinimumLevel.Verbose()
@ -34,11 +32,21 @@ public static class Program
outputTemplate: format) outputTemplate: format)
) )
.CreateLogger(); .CreateLogger();
Run();
} }
public static void Run() private static void InitializeWorkingDirectory()
{
var path = Loader.ToRPath("dungeon.obj");
path = Path.GetDirectoryName(path);
if (!string.IsNullOrEmpty(path))
{
var workingDirectory = Path.Combine(path, "..");
workingDirectory = Path.GetFullPath(workingDirectory);
Directory.SetCurrentDirectory(workingDirectory);
}
}
private static void StartDemo()
{ {
var demo = new RecastDemo(); var demo = new RecastDemo();
demo.Run(); demo.Run();