simplify code with generic Enum.GetValues

This commit is contained in:
Jesse Plamondon-Willard 2022-04-09 13:10:54 -04:00
parent ccf760452d
commit ad4d065fe7
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
1 changed files with 3 additions and 6 deletions

View File

@ -16,18 +16,15 @@
IDictionary<string, LogModInfo[]> contentPacks = Model.GetContentPacksByMod(); IDictionary<string, LogModInfo[]> contentPacks = Model.GetContentPacksByMod();
IDictionary<string, bool> defaultFilters = Enum IDictionary<string, bool> defaultFilters = Enum
.GetValues(typeof(LogLevel)) .GetValues<LogLevel>()
.Cast<LogLevel>()
.ToDictionary(level => level.ToString().ToLower(), level => level != LogLevel.Trace); .ToDictionary(level => level.ToString().ToLower(), level => level != LogLevel.Trace);
IDictionary<int, string> logLevels = Enum IDictionary<int, string> logLevels = Enum
.GetValues(typeof(LogLevel)) .GetValues<LogLevel>()
.Cast<LogLevel>()
.ToDictionary(level => (int)level, level => level.ToString().ToLower()); .ToDictionary(level => (int)level, level => level.ToString().ToLower());
IDictionary<int, string> logSections = Enum IDictionary<int, string> logSections = Enum
.GetValues(typeof(LogSection)) .GetValues<LogSection>()
.Cast<LogSection>()
.ToDictionary(section => (int)section, section => section.ToString()); .ToDictionary(section => (int)section, section => section.ToString());
string curPageUrl = this.Url.PlainAction("Index", "LogParser", new { id = Model.PasteID }, absoluteUrl: true); string curPageUrl = this.Url.PlainAction("Index", "LogParser", new { id = Model.PasteID }, absoluteUrl: true);