From 6391b3b24387b9f87058e0373be2fc7a0306ac55 Mon Sep 17 00:00:00 2001 From: ikpil Date: Sun, 30 Apr 2023 19:19:37 +0900 Subject: [PATCH] refactoring --- src/DotRecast.Recast.Demo/Program.cs | 30 ++++++++++++++++++---------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/DotRecast.Recast.Demo/Program.cs b/src/DotRecast.Recast.Demo/Program.cs index 6608e9a..32ca4d7 100644 --- a/src/DotRecast.Recast.Demo/Program.cs +++ b/src/DotRecast.Recast.Demo/Program.cs @@ -10,15 +10,13 @@ public static class Program { public static void Main(string[] args) { - 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); - } + InitializeLogger(); + InitializeWorkingDirectory(); + StartDemo(); + } + private static void InitializeLogger() + { var format = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff} [{Level:u3}] {Message:lj} [{ThreadName}:{ThreadId}]{NewLine}{Exception}"; Log.Logger = new LoggerConfiguration() .MinimumLevel.Verbose() @@ -34,11 +32,21 @@ public static class Program outputTemplate: format) ) .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(); demo.Run();