From f3bc77c132819f60f3ad4fa7bc1a0a0ac33f5653 Mon Sep 17 00:00:00 2001 From: ikpil Date: Tue, 21 Mar 2023 00:33:17 +0900 Subject: [PATCH] add silk demo --- DotRecast.sln | 7 +++++ .../DotRecast.Recast.Demo.csproj | 5 ++-- src/DotRecast.Recast.Demo/Program.cs | 19 +++++++++----- src/DotRecast.Silk/DotRecast.Silk.csproj | 19 ++++++++++++++ src/DotRecast.Silk/Program.cs | 26 +++++++++++++++++++ src/DotRecast.Silk/SilkDemo.cs | 8 ++++++ 6 files changed, 75 insertions(+), 9 deletions(-) create mode 100644 src/DotRecast.Silk/DotRecast.Silk.csproj create mode 100644 src/DotRecast.Silk/Program.cs create mode 100644 src/DotRecast.Silk/SilkDemo.cs diff --git a/DotRecast.sln b/DotRecast.sln index e07d120..95795cc 100644 --- a/DotRecast.sln +++ b/DotRecast.sln @@ -35,6 +35,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotRecast.Detour.TileCache. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotRecast.Recast.Demo", "src\DotRecast.Recast.Demo\DotRecast.Recast.Demo.csproj", "{023E1E6A-4895-4573-89AE-3D5D8E0B39C8}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotRecast.Silk", "src\DotRecast.Silk\DotRecast.Silk.csproj", "{330F016B-70AE-473F-A06E-1976721B87CC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -100,6 +102,10 @@ Global {023E1E6A-4895-4573-89AE-3D5D8E0B39C8}.Debug|Any CPU.Build.0 = Debug|Any CPU {023E1E6A-4895-4573-89AE-3D5D8E0B39C8}.Release|Any CPU.ActiveCfg = Release|Any CPU {023E1E6A-4895-4573-89AE-3D5D8E0B39C8}.Release|Any CPU.Build.0 = Release|Any CPU + {330F016B-70AE-473F-A06E-1976721B87CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {330F016B-70AE-473F-A06E-1976721B87CC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {330F016B-70AE-473F-A06E-1976721B87CC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {330F016B-70AE-473F-A06E-1976721B87CC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {FFE40BBF-843B-41FA-8504-F4ABD166762E} = {8ED75CF7-A3D6-423D-8499-9316DD413DAD} @@ -116,5 +122,6 @@ Global {DEB16B90-CCD4-497E-A2E9-4CC66FD7EF47} = {8ED75CF7-A3D6-423D-8499-9316DD413DAD} {3CAA7306-088E-4373-A406-99755CC2B605} = {A7CB8D8B-70DA-4567-8316-0659FCAE1C73} {023E1E6A-4895-4573-89AE-3D5D8E0B39C8} = {8ED75CF7-A3D6-423D-8499-9316DD413DAD} + {330F016B-70AE-473F-A06E-1976721B87CC} = {8ED75CF7-A3D6-423D-8499-9316DD413DAD} EndGlobalSection EndGlobal diff --git a/src/DotRecast.Recast.Demo/DotRecast.Recast.Demo.csproj b/src/DotRecast.Recast.Demo/DotRecast.Recast.Demo.csproj index f29a100..198e703 100644 --- a/src/DotRecast.Recast.Demo/DotRecast.Recast.Demo.csproj +++ b/src/DotRecast.Recast.Demo/DotRecast.Recast.Demo.csproj @@ -8,10 +8,11 @@ - + + - + diff --git a/src/DotRecast.Recast.Demo/Program.cs b/src/DotRecast.Recast.Demo/Program.cs index a3d3a19..4faba5b 100644 --- a/src/DotRecast.Recast.Demo/Program.cs +++ b/src/DotRecast.Recast.Demo/Program.cs @@ -1,6 +1,7 @@ using System.IO; using DotRecast.Core; using Serilog; +using Serilog.Enrichers; namespace DotRecast.Recast.Demo; @@ -18,16 +19,20 @@ public static class Program Directory.SetCurrentDirectory(workingDirectory); } + var format = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff} [{Level:u3}] {Message:lj} [{MemberName}()] [{ThreadName}:{ThreadId}] at {FilePath}:{LineNumber} {NewLine}{Exception}"; Log.Logger = new LoggerConfiguration() - .Enrich.WithThreadId() - //.Enrich.WithExceptionDetails() - .Enrich.FromLogContext() - //.Enrich.WithMethodFullName() .MinimumLevel.Verbose() - .WriteTo.File("logs/log.txt") - .WriteTo.Console() + .Enrich.WithThreadId() + .Enrich.WithThreadName() + .Enrich.WithProperty(ThreadNameEnricher.ThreadNamePropertyName, "main") + .WriteTo.Console(outputTemplate: format) + .WriteTo.File( + "logs/log.log", + rollingInterval: RollingInterval.Day, + rollOnFileSizeLimit: true, + outputTemplate: format) .CreateLogger(); - + var demo = new RecastDemo(); demo.start(); } diff --git a/src/DotRecast.Silk/DotRecast.Silk.csproj b/src/DotRecast.Silk/DotRecast.Silk.csproj new file mode 100644 index 0000000..4735394 --- /dev/null +++ b/src/DotRecast.Silk/DotRecast.Silk.csproj @@ -0,0 +1,19 @@ + + + + Exe + net7.0 + + + + + + + + + + + + + + diff --git a/src/DotRecast.Silk/Program.cs b/src/DotRecast.Silk/Program.cs new file mode 100644 index 0000000..1b3e80d --- /dev/null +++ b/src/DotRecast.Silk/Program.cs @@ -0,0 +1,26 @@ +using System; +using Serilog; +using Serilog.Enrichers; + +public class Program +{ + // Only Graphics Test + public static void Main(string[] args) + { + var format = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff} [{Level:u3}] {Message:lj} [{MemberName}()] [{ThreadName}:{ThreadId}] at {FilePath}:{LineNumber} {NewLine}{Exception}"; + Log.Logger = new LoggerConfiguration() + .MinimumLevel.Verbose() + .Enrich.WithThreadId() + .Enrich.WithThreadName() + .Enrich.WithProperty(ThreadNameEnricher.ThreadNamePropertyName, "main") + .WriteTo.Console(outputTemplate: format) + .WriteTo.File( + "logs/log.log", + rollingInterval: RollingInterval.Day, + rollOnFileSizeLimit: true, + outputTemplate: format) + .CreateLogger(); + + Log.Logger.Information("Hello, World!"); + } +} \ No newline at end of file diff --git a/src/DotRecast.Silk/SilkDemo.cs b/src/DotRecast.Silk/SilkDemo.cs new file mode 100644 index 0000000..92b7ede --- /dev/null +++ b/src/DotRecast.Silk/SilkDemo.cs @@ -0,0 +1,8 @@ +using Serilog; + +namespace DotRecast.Silk; + +public class SilkDemo +{ + private static readonly ILogger Logger = Log.ForContext(); +} \ No newline at end of file