diff --git a/src/LogExpert.Configuration/ConfigManager.cs b/src/LogExpert.Configuration/ConfigManager.cs index 5b8e716a..d3fa4903 100644 --- a/src/LogExpert.Configuration/ConfigManager.cs +++ b/src/LogExpert.Configuration/ConfigManager.cs @@ -817,9 +817,8 @@ PathTooLongException or private static void SaveHighlightGroupsAsJSON (FileInfo fileInfo, List groups) { - using StreamWriter sw = new(fileInfo.Create()); - JsonSerializer serializer = new(); - serializer.Serialize(sw, groups); + string json = JsonConvert.SerializeObject(groups, Formatting.Indented); + File.WriteAllText(fileInfo.FullName, json, System.Text.Encoding.UTF8); } /// diff --git a/src/LogExpert.Core/Config/Preferences.cs b/src/LogExpert.Core/Config/Preferences.cs index f3965980..8673acfa 100644 --- a/src/LogExpert.Core/Config/Preferences.cs +++ b/src/LogExpert.Core/Config/Preferences.cs @@ -8,8 +8,32 @@ namespace LogExpert.Core.Config; [Serializable] public class Preferences { + + /// + /// List of highlight groups for syntax highlighting and text coloring. + /// + /// + /// Supports legacy property name "hilightGroupList" (with typo) for backward compatibility. + /// Old settings files using the incorrect spelling will be automatically imported. + /// + [Newtonsoft.Json.JsonProperty("HighlightGroupList")] + [System.Text.Json.Serialization.JsonPropertyName("HighlightGroupList")] public List HighlightGroupList { get; set; } = []; + /// + /// Legacy property for backward compatibility with old settings files that used the typo "hilightGroupList". + /// This setter redirects data to the correct property. + /// Will be removed in a future version once migration period is complete. + /// + [Obsolete("This property exists only for backward compatibility with old settings files. Use HighlightGroupList instead.")] + [Newtonsoft.Json.JsonProperty("hilightGroupList")] + [System.Text.Json.Serialization.JsonPropertyName("hilightGroupList")] + public List HilightGroupList + { + get => HighlightGroupList; + set => HighlightGroupList = value ?? []; + } + public bool PortableMode { get; set; } /// diff --git a/src/LogExpert.Core/Config/Settings.cs b/src/LogExpert.Core/Config/Settings.cs index 7ba088cf..5921663e 100644 --- a/src/LogExpert.Core/Config/Settings.cs +++ b/src/LogExpert.Core/Config/Settings.cs @@ -1,6 +1,8 @@ using System.Drawing; using LogExpert.Core.Classes.Filter; +using LogExpert.Core.Classes.Highlight; +using LogExpert.Core.Entities; using LogExpert.Entities; namespace LogExpert.Core.Config; @@ -34,6 +36,47 @@ public class Settings public bool HideLineColumn { get; set; } + /// + /// Legacy property for backward compatibility with old settings files that had hilightEntryList at root level. + /// This property redirects data to Preferences.HighlightGroupList during import. + /// Will be removed in a future version once migration period is complete. + /// + [Obsolete("This property exists only for backward compatibility with old settings files. Data is stored in Preferences.HighlightGroupList.")] + [Newtonsoft.Json.JsonProperty("hilightEntryList")] + [System.Text.Json.Serialization.JsonPropertyName("hilightEntryList")] + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public List HilightEntryList + { + get => null; // Never serialize this + set + { + // This was likely empty in old files as entries were in groups + // Keep for compatibility but likely unused + } + } + + /// + /// Legacy property for backward compatibility with old settings files that had hilightGroupList at root level. + /// This property redirects data to Preferences.HighlightGroupList during import. + /// Will be removed in a future version once migration period is complete. + /// + [Obsolete("This property exists only for backward compatibility with old settings files. Data is stored in Preferences.HighlightGroupList.")] + [Newtonsoft.Json.JsonProperty("hilightGroupList")] + [System.Text.Json.Serialization.JsonPropertyName("hilightGroupList")] + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public List HilightGroupList + { + get => null; // Never serialize this + set + { + if (value != null && value.Count > 0) + { + Preferences ??= new Preferences(); + Preferences.HighlightGroupList = value; + } + } + } + public bool IsMaximized { get; set; } public string LastDirectory { get; set; } diff --git a/src/LogExpert.Core/Entities/HighlightGroup.cs b/src/LogExpert.Core/Entities/HighlightGroup.cs index e8f5d8ce..3b244792 100644 --- a/src/LogExpert.Core/Entities/HighlightGroup.cs +++ b/src/LogExpert.Core/Entities/HighlightGroup.cs @@ -9,8 +9,31 @@ public class HighlightGroup : ICloneable public string GroupName { get; set; } = string.Empty; + /// + /// List of highlight entries defining text patterns and their formatting. + /// + /// + /// Supports legacy property name "hilightEntryList" (with typo) for backward compatibility. + /// Old settings files using the incorrect spelling will be automatically imported. + /// + [Newtonsoft.Json.JsonProperty("HighlightEntryList")] + [System.Text.Json.Serialization.JsonPropertyName("HighlightEntryList")] public List HighlightEntryList { get; set; } = []; + /// + /// Legacy property for backward compatibility with old settings files that used the typo "hilightEntryList". + /// This setter redirects data to the correct property. + /// Will be removed in a future version once migration period is complete. + /// + [Obsolete("This property exists only for backward compatibility with old settings files. Use HighlightEntryList instead.")] + [Newtonsoft.Json.JsonProperty("hilightEntryList")] + [System.Text.Json.Serialization.JsonPropertyName("hilightEntryList")] + public List HilightEntryList + { + get => HighlightEntryList; + set => HighlightEntryList = value ?? []; + } + public object Clone () { HighlightGroup clone = new() diff --git a/src/PluginRegistry/PluginHashGenerator.Generated.cs b/src/PluginRegistry/PluginHashGenerator.Generated.cs index 5a92dced..b1e7657f 100644 --- a/src/PluginRegistry/PluginHashGenerator.Generated.cs +++ b/src/PluginRegistry/PluginHashGenerator.Generated.cs @@ -10,7 +10,7 @@ public static partial class PluginValidator { /// /// Gets pre-calculated SHA256 hashes for built-in plugins. - /// Generated: 2026-01-22 07:56:13 UTC + /// Generated: 2026-01-22 15:36:59 UTC /// Configuration: Release /// Plugin count: 22 /// @@ -18,28 +18,28 @@ public static Dictionary GetBuiltInPluginHashes() { return new Dictionary(StringComparer.OrdinalIgnoreCase) { - ["AutoColumnizer.dll"] = "9C8F3E7BFBAA93A67FCBB8F6D55632468C57030EAE15FC3E96BC269F83E244A1", + ["AutoColumnizer.dll"] = "7BC68D6CAED29AA844E0C3D0EEF354DDD4CBFC4468343F060D6E09D80DC90B95", ["BouncyCastle.Cryptography.dll"] = "E5EEAF6D263C493619982FD3638E6135077311D08C961E1FE128F9107D29EBC6", ["BouncyCastle.Cryptography.dll (x86)"] = "E5EEAF6D263C493619982FD3638E6135077311D08C961E1FE128F9107D29EBC6", - ["CsvColumnizer.dll"] = "C526D416E88ED8EB59934C2CABD55E86C873C1D2822F160077B9D0A172E759CC", - ["CsvColumnizer.dll (x86)"] = "C526D416E88ED8EB59934C2CABD55E86C873C1D2822F160077B9D0A172E759CC", - ["DefaultPlugins.dll"] = "B37B0571F251C0689227C267E95A57D16F6EFD9FCE024E35A7499ED0977863A3", - ["FlashIconHighlighter.dll"] = "024F7D300FF3106E60FF9796CF40E477AC31E36706ADC285D9FB5276E872B0E5", - ["GlassfishColumnizer.dll"] = "D58B9D11609A76E5B515F758560DD984576B59DCDF9B80BC22FA4AF5F4384E68", - ["JsonColumnizer.dll"] = "6CB92960BEA2BFCFD971F753F288EDB75250FA0B6A42500847ED789361A86DF6", - ["JsonCompactColumnizer.dll"] = "786094F70FF7BD793D8B47CDFFA2F9794859240ED1DCDD369F6727CEB6BB627E", - ["Log4jXmlColumnizer.dll"] = "2C2521F0862409C5F67D7471C32608D4DD50221E7F393D7536A33CC1321C5B15", - ["LogExpert.Core.dll"] = "D7B4672FBD21BD9C0707C3D098ED6DC3B94FEFCA593FEB2A5B0D4729FC2278F0", - ["LogExpert.Resources.dll"] = "53281AD7771FA28D1CE64A3C4893196130681A22A741703EF980A1E5A31C140A", + ["CsvColumnizer.dll"] = "D67A6A7B0EAB65B5C352EAED26B89104BC057612279ECD7ADD34BBEE3830019E", + ["CsvColumnizer.dll (x86)"] = "D67A6A7B0EAB65B5C352EAED26B89104BC057612279ECD7ADD34BBEE3830019E", + ["DefaultPlugins.dll"] = "E0503BC7A1CE12E8F18F058C62AB84C2402733E76F9E871C163A3A7900841B5A", + ["FlashIconHighlighter.dll"] = "32510C6566AA4321EFD39190471F9622EED1934D4E415E73D176A150CD4963B5", + ["GlassfishColumnizer.dll"] = "D504BFF6EC14F54C073BF23778C8BB0513F6385B21A10363D6C4415E18ED724A", + ["JsonColumnizer.dll"] = "2C786E6C1E9917EDEB224720C8B4AC7F322A0F9489C07E44F5F62AB887801E79", + ["JsonCompactColumnizer.dll"] = "63E5AE492888DF52C0B5F4584F6CDD35FA8B2DDF8192C75A9DD662C2C4FEDD96", + ["Log4jXmlColumnizer.dll"] = "3E85454E4CFD2563F77B26A3BD7E1A6F85D6B7C0E96338B3FFED1B8BC472C8D7", + ["LogExpert.Core.dll"] = "B8977B248A9A11632B9632D2905A364F98F8625391DDCA40F76CF8CDA185EAE6", + ["LogExpert.Resources.dll"] = "43507497CCBECB8E9A3285A7E837A4B8C88679FC030CF4AA7B2611B203A3AB9C", ["Microsoft.Extensions.DependencyInjection.Abstractions.dll"] = "67FA4325000DB017DC0C35829B416F024F042D24EFB868BCF17A895EE6500A93", ["Microsoft.Extensions.DependencyInjection.Abstractions.dll (x86)"] = "67FA4325000DB017DC0C35829B416F024F042D24EFB868BCF17A895EE6500A93", ["Microsoft.Extensions.Logging.Abstractions.dll"] = "BB853130F5AFAF335BE7858D661F8212EC653835100F5A4E3AA2C66A4D4F685D", ["Microsoft.Extensions.Logging.Abstractions.dll (x86)"] = "BB853130F5AFAF335BE7858D661F8212EC653835100F5A4E3AA2C66A4D4F685D", - ["RegexColumnizer.dll"] = "E58187975AC91B7CF1339511C741C5D571AA015C9DAB0E9694579EAABEEEE69F", - ["SftpFileSystem.dll"] = "65A6149D52DB7A7089FDAFAE6DA78B7197025BBB04C56EC466F3FEF73804B73A", - ["SftpFileSystem.dll (x86)"] = "6D455A9F064804CB7A0639C210629B008B75EDABC6DB30666A7230A14AE4C0B4", - ["SftpFileSystem.Resources.dll"] = "F9045AA68358565F6310B22C960240BDEFFE338888368AEC1CF4B07B8A149F3E", - ["SftpFileSystem.Resources.dll (x86)"] = "F9045AA68358565F6310B22C960240BDEFFE338888368AEC1CF4B07B8A149F3E", + ["RegexColumnizer.dll"] = "0E6C500586C79D0280973B5D2A69AC0DB16FCF1AB963C6016965AE6CE3DB1103", + ["SftpFileSystem.dll"] = "A2C0E76211A0DE50F0C9B2B9BD1B97519ED390382179ACB73AED232245F42D2B", + ["SftpFileSystem.dll (x86)"] = "453EA3A17F9F6CAE24C76C6368264C0FA6745DC0FC8A2E6DAD86B127227A02E5", + ["SftpFileSystem.Resources.dll"] = "A1185922C0FF4ED0E8CE734FDA6B238ADE7C4DD4C8DC3811C41F618FCD4D4C5E", + ["SftpFileSystem.Resources.dll (x86)"] = "A1185922C0FF4ED0E8CE734FDA6B238ADE7C4DD4C8DC3811C41F618FCD4D4C5E", }; }