From deb7f67e593d0cc0d1d49a06ba4dcbfe872a7c5d Mon Sep 17 00:00:00 2001 From: cake Date: Sat, 3 Jan 2026 23:12:18 +0100 Subject: [PATCH 1/2] Added another try on fetching download status --- LightlessSync/UI/DownloadUi.cs | 53 +++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/LightlessSync/UI/DownloadUi.cs b/LightlessSync/UI/DownloadUi.cs index 2d9cdc1..f898232 100644 --- a/LightlessSync/UI/DownloadUi.cs +++ b/LightlessSync/UI/DownloadUi.cs @@ -1,4 +1,5 @@ using Dalamud.Bindings.ImGui; +using Dalamud.Game.ClientState.Statuses; using Dalamud.Interface.Colors; using LightlessSync.LightlessConfiguration; using LightlessSync.LightlessConfiguration.Models; @@ -167,22 +168,30 @@ public class DownloadUi : WindowMediatorSubscriberBase List>> transfers; try { - transfers = _currentDownloads.ToList(); + transfers = _currentDownloads?.ToList() ?? []; } catch (ArgumentException) { return; } - foreach (var transfer in transfers) { var transferKey = transfer.Key; - - // Skip if no valid game object - if (transferKey.GetGameObject() == null) + if (transferKey is null) continue; + var statusDict = transfer.Value; + if (statusDict is null) + continue; + + var gameObj = transferKey.GetGameObject(); + if (gameObj is null) + { + _smoothed.Remove(transferKey); + continue; + } + var rawPos = _dalamudUtilService.WorldToScreen(transferKey.GetGameObject()); // If RawPos is zero, remove it from smoothed dictionary @@ -207,25 +216,29 @@ public class DownloadUi : WindowMediatorSubscriberBase var dlProg = 0; var dlDecomp = 0; - foreach (var entry in transfer.Value) + try { - var fileStatus = entry.Value; - switch (fileStatus.DownloadStatus) + foreach (var entry in statusDict) { - case DownloadStatus.WaitingForSlot: - dlSlot++; - break; - case DownloadStatus.WaitingForQueue: - dlQueue++; - break; - case DownloadStatus.Downloading: - dlProg++; - break; - case DownloadStatus.Decompressing: - dlDecomp++; - break; + var fileStatus = entry.Value; + if (fileStatus is null) continue; + + totalBytes += fileStatus.TotalBytes; + transferredBytes += fileStatus.TransferredBytes; + + switch (fileStatus.DownloadStatus) + { + case DownloadStatus.WaitingForSlot: dlSlot++; break; + case DownloadStatus.WaitingForQueue: dlQueue++; break; + case DownloadStatus.Downloading: dlProg++; break; + case DownloadStatus.Decompressing: dlDecomp++; break; + } } } + catch (InvalidOperationException) + { + continue; + } string statusText; if (dlProg > 0) From 3bbda696994f64d7af386867e87078ce844444e5 Mon Sep 17 00:00:00 2001 From: cake Date: Sat, 3 Jan 2026 23:22:18 +0100 Subject: [PATCH 2/2] Revert "Added another try on fetching download status" This reverts commit deb7f67e593d0cc0d1d49a06ba4dcbfe872a7c5d. --- LightlessSync/UI/DownloadUi.cs | 51 +++++++++++++--------------------- 1 file changed, 19 insertions(+), 32 deletions(-) diff --git a/LightlessSync/UI/DownloadUi.cs b/LightlessSync/UI/DownloadUi.cs index f898232..2d9cdc1 100644 --- a/LightlessSync/UI/DownloadUi.cs +++ b/LightlessSync/UI/DownloadUi.cs @@ -1,5 +1,4 @@ using Dalamud.Bindings.ImGui; -using Dalamud.Game.ClientState.Statuses; using Dalamud.Interface.Colors; using LightlessSync.LightlessConfiguration; using LightlessSync.LightlessConfiguration.Models; @@ -168,30 +167,22 @@ public class DownloadUi : WindowMediatorSubscriberBase List>> transfers; try { - transfers = _currentDownloads?.ToList() ?? []; + transfers = _currentDownloads.ToList(); } catch (ArgumentException) { return; } + foreach (var transfer in transfers) { var transferKey = transfer.Key; - if (transferKey is null) - continue; - var statusDict = transfer.Value; - if (statusDict is null) + // Skip if no valid game object + if (transferKey.GetGameObject() == null) continue; - var gameObj = transferKey.GetGameObject(); - if (gameObj is null) - { - _smoothed.Remove(transferKey); - continue; - } - var rawPos = _dalamudUtilService.WorldToScreen(transferKey.GetGameObject()); // If RawPos is zero, remove it from smoothed dictionary @@ -216,29 +207,25 @@ public class DownloadUi : WindowMediatorSubscriberBase var dlProg = 0; var dlDecomp = 0; - try + foreach (var entry in transfer.Value) { - foreach (var entry in statusDict) + var fileStatus = entry.Value; + switch (fileStatus.DownloadStatus) { - var fileStatus = entry.Value; - if (fileStatus is null) continue; - - totalBytes += fileStatus.TotalBytes; - transferredBytes += fileStatus.TransferredBytes; - - switch (fileStatus.DownloadStatus) - { - case DownloadStatus.WaitingForSlot: dlSlot++; break; - case DownloadStatus.WaitingForQueue: dlQueue++; break; - case DownloadStatus.Downloading: dlProg++; break; - case DownloadStatus.Decompressing: dlDecomp++; break; - } + case DownloadStatus.WaitingForSlot: + dlSlot++; + break; + case DownloadStatus.WaitingForQueue: + dlQueue++; + break; + case DownloadStatus.Downloading: + dlProg++; + break; + case DownloadStatus.Decompressing: + dlDecomp++; + break; } } - catch (InvalidOperationException) - { - continue; - } string statusText; if (dlProg > 0)