Fixed many warnings

This commit is contained in:
cake
2025-11-16 07:57:59 +01:00
parent a869b369aa
commit f3a6c7b5b9
14 changed files with 112 additions and 128 deletions

View File

@@ -539,7 +539,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
}
}
private bool DrawStyleResetButton(string key, bool hasOverride, string? tooltipOverride = null)
private static bool DrawStyleResetButton(string key, bool hasOverride, string? tooltipOverride = null)
{
using var id = ImRaii.PushId($"reset-{key}");
using var disabled = ImRaii.Disabled(!hasOverride);
@@ -663,7 +663,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_uiShared.DrawHelpText("Controls how many uploads can run at once.");
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurple"), 2f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessPurple"), 2f);
if (ImGui.Checkbox("Enable Pair Download Limiter", ref limitPairApplications))
{
@@ -710,7 +710,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.TextColored(ImGuiColors.DalamudGrey, "Pair apply limiter is disabled.");
}
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurple"), 2f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessPurple"), 2f);
if (ImGui.Checkbox("Use Alternative Upload Method", ref useAlternativeUpload))
{
@@ -826,13 +826,10 @@ public class SettingsUi : WindowMediatorSubscriberBase
using var tree = ImRaii.TreeNode("Speed Test to Servers");
if (tree)
{
if (_downloadServersTask == null || ((_downloadServersTask?.IsCompleted ?? false) &&
(!_downloadServersTask?.IsCompletedSuccessfully ?? false)))
if ((_downloadServersTask == null || ((_downloadServersTask?.IsCompleted ?? false) &&
(!_downloadServersTask?.IsCompletedSuccessfully ?? false))) && _uiShared.IconTextButton(FontAwesomeIcon.GroupArrowsRotate, "Update Download Server List"))
{
if (_uiShared.IconTextButton(FontAwesomeIcon.GroupArrowsRotate, "Update Download Server List"))
{
_downloadServersTask = GetDownloadServerList();
}
_downloadServersTask = GetDownloadServerList();
}
if (_downloadServersTask != null && _downloadServersTask.IsCompleted &&
@@ -1063,9 +1060,9 @@ public class SettingsUi : WindowMediatorSubscriberBase
.DeserializeAsync<List<string>>(await result.Content.ReadAsStreamAsync().ConfigureAwait(false))
.ConfigureAwait(false);
}
catch (Exception ex)
catch (Exception)
{
_logger.LogWarning(ex, "Failed to get download server list");
_logger.LogWarning("Failed to get download server list");
throw;
}
}
@@ -1146,7 +1143,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
UiSharedService.TooltipSeparator
+ "Keeping LOD enabled can lead to more crashes. Use at your own risk.");
_uiShared.ColoredSeparator(UIColors.Get("LightlessYellow"), 2f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessYellow"), 2f);
}
private void DrawFileStorageSettings()
@@ -1348,7 +1345,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
}
}
_uiShared.ColoredSeparator(UIColors.Get("LightlessYellow"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessYellow"), 1.5f);
ImGui.TreePop();
}
@@ -1380,7 +1377,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
}
catch (IOException ex)
{
_logger.LogWarning(ex, $"Could not delete file {file} because it is in use.");
_logger.LogWarning(ex, "Could not delete file {file} because it is in use.", file);
}
}
});
@@ -1398,7 +1395,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.EndDisabled();
ImGui.Unindent();
_uiShared.ColoredSeparator(UIColors.Get("DimRed"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("DimRed"), 1.5f);
ImGui.TreePop();
}
}
@@ -1411,8 +1408,6 @@ public class SettingsUi : WindowMediatorSubscriberBase
}
_lastTab = "General";
//UiSharedService.FontText("Experimental", _uiShared.UidFont);
//ImGui.Separator();
_uiShared.UnderlinedBigText("General Settings", UIColors.Get("LightlessBlue"));
ImGui.Dummy(new Vector2(10));
@@ -1449,7 +1444,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGuiColors.DalamudRed);
}
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
ImGui.TreePop();
}
@@ -1477,7 +1472,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_uiShared.DrawHelpText(
"This will automatically populate user notes using the first encountered player name if the note was not set prior");
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
ImGui.TreePop();
}
@@ -1545,7 +1540,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
}
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
ImGui.TreePop();
}
@@ -1585,7 +1580,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
}
_uiShared.DrawHelpText("When enabled, Lightfinder will automatically turn on after reconnecting to the Lightless server.");
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurpleDefault"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessPurpleDefault"), 1.5f);
ImGui.TextUnformatted("Lightfinder Nameplate Colors");
if (ImGui.BeginTable("##LightfinderColorTable", 3, ImGuiTableFlags.Borders | ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingFixedFit))
@@ -1641,7 +1636,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.Spacing();
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurpleDefault"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessPurpleDefault"), 1.5f);
ImGui.TextUnformatted("Lightfinder Info Bar");
if (ImGui.Checkbox("Show Lightfinder status in Server info bar", ref showLightfinderInDtr))
@@ -1737,7 +1732,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
}
ImGui.EndDisabled();
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurpleDefault"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessPurpleDefault"), 1.5f);
ImGui.TextUnformatted("Alignment");
ImGui.BeginDisabled(autoAlign);
@@ -1862,7 +1857,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
}
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurpleDefault"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessPurpleDefault"), 1.5f);
ImGui.TextUnformatted("Visibility");
var showOwn = _configService.Current.LightfinderLabelShowOwn;
@@ -1900,7 +1895,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
}
_uiShared.DrawHelpText("Toggles Lightfinder label when no nameplate(s) is visible.");
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurpleDefault"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessPurpleDefault"), 1.5f);
ImGui.TextUnformatted("Label");
var useIcon = _configService.Current.LightfinderLabelUseIcon;
@@ -2006,7 +2001,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_lightfinderIconPresetIndex = -1;
}
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
ImGui.TreePop();
}
@@ -2094,7 +2089,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.Spacing();
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurpleDefault"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessPurpleDefault"), 1.5f);
ImGui.TextUnformatted("Server Info Bar Colors");
@@ -2146,7 +2141,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.Spacing();
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurpleDefault"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessPurpleDefault"), 1.5f);
ImGui.TextUnformatted("Nameplate Colors");
@@ -2199,7 +2194,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.Spacing();
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurpleDefault"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessPurpleDefault"), 1.5f);
ImGui.TextUnformatted("UI Theme");
@@ -2221,7 +2216,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
DrawThemeOverridesSection();
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
ImGui.TreePop();
}
@@ -2319,7 +2314,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Save();
}
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
ImGui.TreePop();
}
@@ -2362,7 +2357,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_uiShared.DrawHelpText("Will show profiles that have the NSFW tag enabled");
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
ImGui.TreePop();
}
ImGui.Separator();
@@ -2444,7 +2439,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
+ "Default: 165 thousand");
}
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
ImGui.TreePop();
}
@@ -2548,7 +2543,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
+ "Default: 250 thousand");
}
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
ImGui.TreePop();
}
@@ -2696,7 +2691,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.EndPopup();
}
_uiShared.ColoredSeparator(UIColors.Get("DimRed"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("DimRed"), 1.5f);
ImGui.TreePop();
}
@@ -3274,15 +3269,13 @@ public class SettingsUi : WindowMediatorSubscriberBase
private int _lastSelectedServerIndex = -1;
private Task<(bool Success, bool PartialSuccess, string Result)>? _secretKeysConversionTask = null;
private CancellationTokenSource _secretKeysConversionCts = new CancellationTokenSource();
private CancellationTokenSource _secretKeysConversionCts = new();
private async Task<(bool Success, bool partialSuccess, string Result)> ConvertSecretKeysToUIDs(
ServerStorage serverStorage, CancellationToken token)
{
List<Authentication> failedConversions = serverStorage.Authentications
.Where(u => u.SecretKeyIdx == -1 && string.IsNullOrEmpty(u.UID)).ToList();
List<Authentication> conversionsToAttempt = serverStorage.Authentications
.Where(u => u.SecretKeyIdx != -1 && string.IsNullOrEmpty(u.UID)).ToList();
List<Authentication> failedConversions = [.. serverStorage.Authentications.Where(u => u.SecretKeyIdx == -1 && string.IsNullOrEmpty(u.UID))];
List<Authentication> conversionsToAttempt = [.. serverStorage.Authentications.Where(u => u.SecretKeyIdx != -1 && string.IsNullOrEmpty(u.UID))];
List<Authentication> successfulConversions = [];
Dictionary<string, List<Authentication>> secretKeyMapping = new(StringComparer.Ordinal);
foreach (var authEntry in conversionsToAttempt)
@@ -3352,6 +3345,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
sb.Append(string.Join(", ", failedConversions.Select(k => k.CharacterName)));
}
_secretKeysConversionCts.Dispose();
return (true, failedConversions.Count != 0, sb.ToString());
}
@@ -3720,7 +3714,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.Unindent();
}
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
ImGui.TreePop();
}
@@ -3762,7 +3756,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_uiShared.DrawHelpText("Click anywhere on a notification to dismiss it. Notifications with action buttons (like pair requests) are excluded.");
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
ImGui.TreePop();
}
@@ -3925,7 +3919,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.SetTooltip("Right click to reset to default (3).");
_uiShared.DrawHelpText("Width of the colored accent bar on the left side.");
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
ImGui.TreePop();
}
}
@@ -4020,7 +4014,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
if (ImGui.IsItemHovered())
ImGui.SetTooltip("Right click to reset to default (20).");
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
ImGui.TreePop();
}
@@ -4035,7 +4029,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_uiShared.DrawHelpText(
"Configure which sounds play for each notification type. Use the play button to preview sounds.");
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
ImGui.TreePop();
}
@@ -4083,7 +4077,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
"Only show online notifications for pairs where you have set an individual note.");
ImGui.Unindent();
_uiShared.ColoredSeparator(UIColors.Get("LightlessGreen"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessGreen"), 1.5f);
ImGui.TreePop();
}
@@ -4099,7 +4093,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_uiShared.DrawHelpText(
"When you receive a pair request, show Accept/Decline buttons in the notification.");
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
ImGui.TreePop();
}
@@ -4115,7 +4109,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_uiShared.DrawHelpText(
"When a player exceeds performance thresholds or is auto-paused, show Pause/Unpause buttons in the notification.");
_uiShared.ColoredSeparator(UIColors.Get("LightlessOrange"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessOrange"), 1.5f);
ImGui.TreePop();
}
@@ -4130,7 +4124,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_uiShared.DrawHelpText("Disable warning notifications for missing optional plugins.");
_uiShared.ColoredSeparator(UIColors.Get("LightlessYellow"), 1.5f);
UiSharedService.ColoredSeparator(UIColors.Get("LightlessYellow"), 1.5f);
ImGui.TreePop();
}
@@ -4140,32 +4134,32 @@ public class SettingsUi : WindowMediatorSubscriberBase
}
}
private NotificationLocation[] GetLightlessNotificationLocations()
private static NotificationLocation[] GetLightlessNotificationLocations()
{
return new[]
{
return
[
NotificationLocation.LightlessUi, NotificationLocation.Chat, NotificationLocation.ChatAndLightlessUi, NotificationLocation.Nowhere
};
];
}
private NotificationLocation[] GetDownloadNotificationLocations()
private static NotificationLocation[] GetDownloadNotificationLocations()
{
return new[]
{
return
[
NotificationLocation.LightlessUi, NotificationLocation.TextOverlay, NotificationLocation.Nowhere
};
];
}
private NotificationLocation[] GetClassicNotificationLocations()
private static NotificationLocation[] GetClassicNotificationLocations()
{
return new[]
{
return
[
NotificationLocation.Toast, NotificationLocation.Chat, NotificationLocation.Both,
NotificationLocation.Nowhere
};
];
}
private string GetNotificationLocationLabel(NotificationLocation location)
private static string GetNotificationLocationLabel(NotificationLocation location)
{
return location switch
{
@@ -4180,7 +4174,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
};
}
private string GetNotificationCornerLabel(NotificationCorner corner)
private static string GetNotificationCornerLabel(NotificationCorner corner)
{
return corner switch
{