From e75baf43e7c1adbfe12464d03612c44dcd8b934a Mon Sep 17 00:00:00 2001 From: Dimon <12370535+DimonByte@users.noreply.github.com> Date: Sun, 30 Aug 2026 22:25:05 +0100 Subject: [PATCH] Small Commit Update -Simplified FilesToCreateString. -CommitToMasterLists now shows the line difference between the new compiled combined list and the old combined list. (e.g 320 lines or -10 lines) --- .../HostListDownloaderInternals/HostListManager.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/HostDownloader/Modules/HostListDownloaderInternals/HostListManager.cs b/HostDownloader/Modules/HostListDownloaderInternals/HostListManager.cs index 2a744e0..2bc7641 100644 --- a/HostDownloader/Modules/HostListDownloaderInternals/HostListManager.cs +++ b/HostDownloader/Modules/HostListDownloaderInternals/HostListManager.cs @@ -150,6 +150,12 @@ private static void CommitToMasterLists() //Move the temp combined lists to their final locations //e.g. HLDcombined-blocklist-TEMP.txt and HLDcombined-whitelist-TEMP.txt will be moved to HLDcombined-blocklist.txt and HLDcombined-whitelist.txt respectively. //This is done to ensure that the combined lists are only updated if the entire process completes successfully. And also to prevent OS file locks from preventing the combined lists from being updated. + + //First get lines of temp and final and print the difference in the logs for debugging purposes. + + var tempCombinedList = File.Exists(IOManager.CombinedListFileLocationTemp) ? File.ReadAllLines(IOManager.CombinedListFileLocationTemp).Length : 0; + var finalCombinedList = File.Exists(IOManager.CombinedListFileLocation) ? File.ReadAllLines(IOManager.CombinedListFileLocation).Length : 0; + TraceLogger.Log("Committing temporary combined lists to final locations..."); try { @@ -168,17 +174,18 @@ private static void CommitToMasterLists() File.Move(IOManager.CombinedListFileLocationTemp, IOManager.CombinedListFileLocation, overwrite: true); TraceLogger.Log($"Committed {IOManager.CombinedListFileLocationTemp} to {IOManager.CombinedListFileLocation}", Enums.StatusSeverityType.Debug); } - string[] FilesToCreate = new string[] - { + string[] FilesToCreate = + [ IOManager.CombinedBlockListFileLocationTemp, IOManager.CombinedWhiteListFileLocationTemp, IOManager.CombinedListFileLocationTemp - }; + ]; foreach (string file in FilesToCreate) { File.Create(file).Dispose(); } TraceLogger.Log("Temporary combined lists cleared after committing to final locations.",Enums.StatusSeverityType.Debug); + TraceLogger.Log($"Commit Complete: Difference between temporary and final combined lists: {tempCombinedList - finalCombinedList} lines"); } catch (Exception ex) {