From 779efd3fe6eba5bc9caa6d99487c0c0c89125016 Mon Sep 17 00:00:00 2001 From: gyk <147011991+gyk4j@users.noreply.github.com> Date: Tue, 12 Mar 2024 13:44:01 +0800 Subject: [PATCH] Improve correction and source enum value name logging (#231) --- Wreck/Logging/Dumper.cs | 7 ++++++- Wreck/Resources/CorrectionEnum.cs | 5 +++++ Wreck/Resources/SourceEnum.cs | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Wreck/Logging/Dumper.cs b/Wreck/Logging/Dumper.cs index 2dbcded..90e3e7e 100644 --- a/Wreck/Logging/Dumper.cs +++ b/Wreck/Logging/Dumper.cs @@ -16,9 +16,14 @@ public static void Dump(IDictionary values) { foreach(KeyValuePair entry in values) { + Type type = entry.Key.GetType(); + string key = type.IsEnum? + Enum.GetName(type, entry.Key): + entry.Key.ToString(); + LOG.DebugFormat( "{0} = {1}", - entry.Key.ToString(), + key, entry.Value.ToString()); } } diff --git a/Wreck/Resources/CorrectionEnum.cs b/Wreck/Resources/CorrectionEnum.cs index 95965b1..25dcd4a 100644 --- a/Wreck/Resources/CorrectionEnum.cs +++ b/Wreck/Resources/CorrectionEnum.cs @@ -58,5 +58,10 @@ public string Description this.name = name; this.description = description; } + + public override string ToString() + { + return Name; + } } } diff --git a/Wreck/Resources/SourceEnum.cs b/Wreck/Resources/SourceEnum.cs index 545ba54..67127b8 100644 --- a/Wreck/Resources/SourceEnum.cs +++ b/Wreck/Resources/SourceEnum.cs @@ -58,5 +58,10 @@ public string Description this.name = name; this.description = description; } + + public override string ToString() + { + return Name; + } } }