diff --git a/Dalamud/Configuration/Internal/DalamudConfiguration.cs b/Dalamud/Configuration/Internal/DalamudConfiguration.cs index da0d7c2c6..beb4e1a8a 100644 --- a/Dalamud/Configuration/Internal/DalamudConfiguration.cs +++ b/Dalamud/Configuration/Internal/DalamudConfiguration.cs @@ -91,7 +91,7 @@ internal sealed class DalamudConfiguration : IInternalDisposableService /// /// Gets or sets a dictionary of seen FTUE levels. /// - public Dictionary SeenFtueLevels { get; set; } = new(); + public Dictionary SeenFtueLevels { get; set; } = []; /// /// Gets or sets the last loaded Dalamud version. @@ -116,7 +116,7 @@ internal sealed class DalamudConfiguration : IInternalDisposableService /// /// Gets or sets a list of custom repos. /// - public List ThirdRepoList { get; set; } = new(); + public List ThirdRepoList { get; set; } = []; /// /// Gets or sets a value indicating whether a disclaimer regarding third-party repos has been dismissed. @@ -126,12 +126,12 @@ internal sealed class DalamudConfiguration : IInternalDisposableService /// /// Gets or sets a list of hidden plugins. /// - public List HiddenPluginInternalName { get; set; } = new(); + public List HiddenPluginInternalName { get; set; } = []; /// /// Gets or sets a list of seen plugins. /// - public List SeenPluginInternalName { get; set; } = new(); + public List SeenPluginInternalName { get; set; } = []; /// /// Gets or sets a list of additional settings for devPlugins. The key is the absolute path @@ -139,14 +139,14 @@ internal sealed class DalamudConfiguration : IInternalDisposableService /// However by specifiying this value manually, you can add arbitrary files outside the normal /// file paths. /// - public Dictionary DevPluginSettings { get; set; } = new(); + public Dictionary DevPluginSettings { get; set; } = []; /// /// Gets or sets a list of additional locations that dev plugins should be loaded from. This can /// be either a DLL or folder, but should be the absolute path, or a path relative to the currently /// injected Dalamud instance. /// - public List DevPluginLoadLocations { get; set; } = new(); + public List DevPluginLoadLocations { get; set; } = []; /// /// Gets or sets the global UI scale. @@ -228,7 +228,7 @@ internal sealed class DalamudConfiguration : IInternalDisposableService /// /// Gets or sets a list representing the command history for the Dalamud Console. /// - public List LogCommandHistory { get; set; } = new(); + public List LogCommandHistory { get; set; } = []; /// /// Gets or sets a value indicating whether the dev bar should open at startup. diff --git a/Dalamud/Configuration/Internal/DevPluginSettings.cs b/Dalamud/Configuration/Internal/DevPluginSettings.cs index 64327e658..400834cf8 100644 --- a/Dalamud/Configuration/Internal/DevPluginSettings.cs +++ b/Dalamud/Configuration/Internal/DevPluginSettings.cs @@ -31,5 +31,5 @@ internal sealed class DevPluginSettings /// /// Gets or sets a list of validation problems that have been dismissed by the user. /// - public List DismissedValidationProblems { get; set; } = new(); + public List DismissedValidationProblems { get; set; } = []; } diff --git a/Dalamud/Console/ConsoleManager.cs b/Dalamud/Console/ConsoleManager.cs index 377bac208..1c50c4ad9 100644 --- a/Dalamud/Console/ConsoleManager.cs +++ b/Dalamud/Console/ConsoleManager.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Runtime.CompilerServices; using System.Text.RegularExpressions; @@ -19,7 +19,7 @@ internal partial class ConsoleManager : IServiceType { private static readonly ModuleLog Log = new("CON"); - private Dictionary entries = new(); + private Dictionary entries = []; /// /// Initializes a new instance of the class. diff --git a/Dalamud/Console/ConsoleManagerPluginScoped.cs b/Dalamud/Console/ConsoleManagerPluginScoped.cs index 41949c7d7..8e7516429 100644 --- a/Dalamud/Console/ConsoleManagerPluginScoped.cs +++ b/Dalamud/Console/ConsoleManagerPluginScoped.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; @@ -65,7 +65,7 @@ internal class ConsoleManagerPluginScoped : IConsole, IInternalDisposableService [ServiceManager.ServiceDependency] private readonly ConsoleManager console = Service.Get(); - private readonly List trackedEntries = new(); + private readonly List trackedEntries = []; /// /// Initializes a new instance of the class. diff --git a/Dalamud/Game/Addon/Events/PluginEventController.cs b/Dalamud/Game/Addon/Events/PluginEventController.cs index afaee9966..0dd4370a3 100644 --- a/Dalamud/Game/Addon/Events/PluginEventController.cs +++ b/Dalamud/Game/Addon/Events/PluginEventController.cs @@ -28,7 +28,7 @@ internal unsafe class PluginEventController : IDisposable private AddonEventListener EventListener { get; init; } - private List Events { get; } = new(); + private List Events { get; } = []; /// /// Adds a tracked event. diff --git a/Dalamud/Game/Addon/Lifecycle/AddonLifecycle.cs b/Dalamud/Game/Addon/Lifecycle/AddonLifecycle.cs index b44ab8764..277ee94e1 100644 --- a/Dalamud/Game/Addon/Lifecycle/AddonLifecycle.cs +++ b/Dalamud/Game/Addon/Lifecycle/AddonLifecycle.cs @@ -69,12 +69,12 @@ internal unsafe class AddonLifecycle : IInternalDisposableService /// /// Gets a list of all AddonLifecycle ReceiveEvent Listener Hooks. /// - internal List ReceiveEventListeners { get; } = new(); + internal List ReceiveEventListeners { get; } = []; /// /// Gets a list of all AddonLifecycle Event Listeners. /// - internal List EventListeners { get; } = new(); + internal List EventListeners { get; } = []; /// void IInternalDisposableService.DisposeService() @@ -387,7 +387,7 @@ internal class AddonLifecyclePluginScoped : IInternalDisposableService, IAddonLi [ServiceManager.ServiceDependency] private readonly AddonLifecycle addonLifecycleService = Service.Get(); - private readonly List eventListeners = new(); + private readonly List eventListeners = []; /// void IInternalDisposableService.DisposeService() diff --git a/Dalamud/Game/BaseAddressResolver.cs b/Dalamud/Game/BaseAddressResolver.cs index 4133117d7..ec1b28681 100644 --- a/Dalamud/Game/BaseAddressResolver.cs +++ b/Dalamud/Game/BaseAddressResolver.cs @@ -12,7 +12,7 @@ public abstract class BaseAddressResolver /// /// Gets a list of memory addresses that were found, to list in /xldata. /// - public static Dictionary> DebugScannedValues { get; } = new(); + public static Dictionary> DebugScannedValues { get; } = []; /// /// Gets or sets a value indicating whether the resolver has successfully run or . diff --git a/Dalamud/Game/Command/CommandManager.cs b/Dalamud/Game/Command/CommandManager.cs index 01442c409..0ebebe83e 100644 --- a/Dalamud/Game/Command/CommandManager.cs +++ b/Dalamud/Game/Command/CommandManager.cs @@ -267,7 +267,7 @@ internal class CommandManagerPluginScoped : IInternalDisposableService, ICommand [ServiceManager.ServiceDependency] private readonly CommandManager commandManagerService = Service.Get(); - private readonly List pluginRegisteredCommands = new(); + private readonly List pluginRegisteredCommands = []; private readonly LocalPlugin pluginInfo; /// diff --git a/Dalamud/Game/Framework.cs b/Dalamud/Game/Framework.cs index 808bbce50..55d89613f 100644 --- a/Dalamud/Game/Framework.cs +++ b/Dalamud/Game/Framework.cs @@ -86,7 +86,7 @@ internal sealed class Framework : IInternalDisposableService, IFramework /// /// Gets the stats history mapping. /// - public static Dictionary> StatsHistory { get; } = new(); + public static Dictionary> StatsHistory { get; } = []; /// public DateTime LastUpdate { get; private set; } = DateTime.MinValue; @@ -106,7 +106,7 @@ internal sealed class Framework : IInternalDisposableService, IFramework /// /// Gets the list of update sub-delegates that didn't get updated this frame. /// - internal List NonUpdatedSubDelegates { get; private set; } = new(); + internal List NonUpdatedSubDelegates { get; private set; } = []; /// /// Gets or sets a value indicating whether to dispatch update events. @@ -333,7 +333,7 @@ internal sealed class Framework : IInternalDisposableService, IFramework internal static void AddToStats(string key, double ms) { if (!StatsHistory.ContainsKey(key)) - StatsHistory.Add(key, new List()); + StatsHistory.Add(key, []); StatsHistory[key].Add(ms); diff --git a/Dalamud/Game/Gui/ChatGui.cs b/Dalamud/Game/Gui/ChatGui.cs index d7303c4ce..eff9641f8 100644 --- a/Dalamud/Game/Gui/ChatGui.cs +++ b/Dalamud/Game/Gui/ChatGui.cs @@ -41,7 +41,7 @@ internal sealed unsafe class ChatGui : IInternalDisposableService, IChatGui private static readonly ModuleLog Log = new("ChatGui"); private readonly Queue chatQueue = new(); - private readonly Dictionary<(string PluginName, uint CommandId), Action> dalamudLinkHandlers = new(); + private readonly Dictionary<(string PluginName, uint CommandId), Action> dalamudLinkHandlers = []; private readonly Hook printMessageHook; private readonly Hook inventoryItemCopyHook; diff --git a/Dalamud/Game/Gui/Dtr/DtrBar.cs b/Dalamud/Game/Gui/Dtr/DtrBar.cs index 2235c5ade..718294447 100644 --- a/Dalamud/Game/Gui/Dtr/DtrBar.cs +++ b/Dalamud/Game/Gui/Dtr/DtrBar.cs @@ -54,7 +54,7 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar private readonly ReaderWriterLockSlim entriesLock = new(); private readonly List entries = []; - private readonly Dictionary> eventHandles = new(); + private readonly Dictionary> eventHandles = []; private ImmutableList? entriesReadOnlyCopy; @@ -516,7 +516,7 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar var node = data.TextNode = this.MakeNode(++this.runningNodeIds); - this.eventHandles.TryAdd(node->NodeId, new List()); + this.eventHandles.TryAdd(node->NodeId, []); this.eventHandles[node->NodeId].AddRange(new List { this.uiEventManager.AddEvent(AddonEventManager.DalamudInternalKey, (nint)dtr, (nint)node, AddonEventType.MouseOver, this.DtrEventHandler), diff --git a/Dalamud/Game/Inventory/GameInventory.cs b/Dalamud/Game/Inventory/GameInventory.cs index 290594874..149aff1fb 100644 --- a/Dalamud/Game/Inventory/GameInventory.cs +++ b/Dalamud/Game/Inventory/GameInventory.cs @@ -18,15 +18,15 @@ namespace Dalamud.Game.Inventory; [ServiceManager.EarlyLoadedService] internal class GameInventory : IInternalDisposableService { - private readonly List subscribersPendingChange = new(); - private readonly List subscribers = new(); + private readonly List subscribersPendingChange = []; + private readonly List subscribers = []; - private readonly List addedEvents = new(); - private readonly List removedEvents = new(); - private readonly List changedEvents = new(); - private readonly List movedEvents = new(); - private readonly List splitEvents = new(); - private readonly List mergedEvents = new(); + private readonly List addedEvents = []; + private readonly List removedEvents = []; + private readonly List changedEvents = []; + private readonly List movedEvents = []; + private readonly List splitEvents = []; + private readonly List mergedEvents = []; [ServiceManager.ServiceDependency] private readonly Framework framework = Service.Get(); diff --git a/Dalamud/Game/Network/Internal/MarketBoardUploaders/Universalis/UniversalisMarketBoardUploader.cs b/Dalamud/Game/Network/Internal/MarketBoardUploaders/Universalis/UniversalisMarketBoardUploader.cs index 7ecb9c397..d50676127 100644 --- a/Dalamud/Game/Network/Internal/MarketBoardUploaders/Universalis/UniversalisMarketBoardUploader.cs +++ b/Dalamud/Game/Network/Internal/MarketBoardUploaders/Universalis/UniversalisMarketBoardUploader.cs @@ -64,7 +64,7 @@ internal class UniversalisMarketBoardUploader : IMarketBoardUploader PricePerUnit = marketBoardItemListing.PricePerUnit, Quantity = marketBoardItemListing.ItemQuantity, RetainerCity = marketBoardItemListing.RetainerCityId, - Materia = new List(), + Materia = [], }; #pragma warning restore CS0618 // Type or member is obsolete diff --git a/Dalamud/Game/Text/SeStringHandling/SeString.cs b/Dalamud/Game/Text/SeStringHandling/SeString.cs index 8805c2177..88898b431 100644 --- a/Dalamud/Game/Text/SeStringHandling/SeString.cs +++ b/Dalamud/Game/Text/SeStringHandling/SeString.cs @@ -28,7 +28,7 @@ public class SeString /// public SeString() { - this.Payloads = new List(); + this.Payloads = []; } /// diff --git a/Dalamud/Hooking/Internal/FunctionPointerVariableHook.cs b/Dalamud/Hooking/Internal/FunctionPointerVariableHook.cs index 8a53e664a..e342fe427 100644 --- a/Dalamud/Hooking/Internal/FunctionPointerVariableHook.cs +++ b/Dalamud/Hooking/Internal/FunctionPointerVariableHook.cs @@ -45,7 +45,7 @@ internal unsafe class FunctionPointerVariableHook : Hook if (!HookManager.MultiHookTracker.TryGetValue(this.Address, out var indexList)) { - indexList = HookManager.MultiHookTracker[this.Address] = new List(); + indexList = HookManager.MultiHookTracker[this.Address] = []; } this.detourDelegate = detour; diff --git a/Dalamud/Hooking/Internal/GameInteropProviderPluginScoped.cs b/Dalamud/Hooking/Internal/GameInteropProviderPluginScoped.cs index 52d266335..af963bbde 100644 --- a/Dalamud/Hooking/Internal/GameInteropProviderPluginScoped.cs +++ b/Dalamud/Hooking/Internal/GameInteropProviderPluginScoped.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using System.Linq; using Dalamud.Game; @@ -25,7 +25,7 @@ internal class GameInteropProviderPluginScoped : IGameInteropProvider, IInternal private readonly LocalPlugin plugin; private readonly SigScanner scanner; - private readonly WeakConcurrentCollection trackedHooks = new(); + private readonly WeakConcurrentCollection trackedHooks = []; /// /// Initializes a new instance of the class. diff --git a/Dalamud/Hooking/Internal/MinHookHook.cs b/Dalamud/Hooking/Internal/MinHookHook.cs index d4889ba11..9c7ec0f88 100644 --- a/Dalamud/Hooking/Internal/MinHookHook.cs +++ b/Dalamud/Hooking/Internal/MinHookHook.cs @@ -24,7 +24,7 @@ internal class MinHookHook : Hook where T : Delegate var unhooker = HookManager.RegisterUnhooker(this.Address); if (!HookManager.MultiHookTracker.TryGetValue(this.Address, out var indexList)) - indexList = HookManager.MultiHookTracker[this.Address] = new(); + indexList = HookManager.MultiHookTracker[this.Address] = []; var index = (ulong)indexList.Count; diff --git a/Dalamud/Hooking/WndProcHook/WndProcHookManager.cs b/Dalamud/Hooking/WndProcHook/WndProcHookManager.cs index 7c70a9f0b..c747cc5bb 100644 --- a/Dalamud/Hooking/WndProcHook/WndProcHookManager.cs +++ b/Dalamud/Hooking/WndProcHook/WndProcHookManager.cs @@ -20,7 +20,7 @@ internal sealed class WndProcHookManager : IInternalDisposableService private static readonly ModuleLog Log = new(nameof(WndProcHookManager)); private readonly Hook dispatchMessageWHook; - private readonly Dictionary wndProcOverrides = new(); + private readonly Dictionary wndProcOverrides = []; private HWND mainWindowHwnd; diff --git a/Dalamud/Interface/FontIdentifier/IFontFamilyId.cs b/Dalamud/Interface/FontIdentifier/IFontFamilyId.cs index 991716f74..40780422a 100644 --- a/Dalamud/Interface/FontIdentifier/IFontFamilyId.cs +++ b/Dalamud/Interface/FontIdentifier/IFontFamilyId.cs @@ -36,26 +36,25 @@ public interface IFontFamilyId : IObjectWithLocalizableName /// /// The list of fonts. public static List ListDalamudFonts() => - new() - { + [ new DalamudAssetFontAndFamilyId(DalamudAsset.NotoSansJpMedium), new DalamudAssetFontAndFamilyId(DalamudAsset.InconsolataRegular), new DalamudAssetFontAndFamilyId(DalamudAsset.FontAwesomeFreeSolid), - }; + ]; /// /// Gets the list of Game-provided fonts. /// /// The list of fonts. - public static List ListGameFonts() => new() - { + public static List ListGameFonts() => + [ new GameFontAndFamilyId(GameFontFamily.Axis), new GameFontAndFamilyId(GameFontFamily.Jupiter), new GameFontAndFamilyId(GameFontFamily.JupiterNumeric), new GameFontAndFamilyId(GameFontFamily.Meidinger), new GameFontAndFamilyId(GameFontFamily.MiedingerMid), new GameFontAndFamilyId(GameFontFamily.TrumpGothic), - }; + ]; /// /// Gets the list of System-provided fonts. diff --git a/Dalamud/Interface/GameFonts/FdtReader.cs b/Dalamud/Interface/GameFonts/FdtReader.cs index 0e8f3fb59..0ee22bca1 100644 --- a/Dalamud/Interface/GameFonts/FdtReader.cs +++ b/Dalamud/Interface/GameFonts/FdtReader.cs @@ -43,12 +43,12 @@ public class FdtReader /// /// Gets all the glyphs defined in this file. /// - public List Glyphs { get; init; } = new(); + public List Glyphs { get; init; } = []; /// /// Gets all the kerning entries defined in this file. /// - public List Distances { get; init; } = new(); + public List Distances { get; init; } = []; /// /// Finds the glyph index for the corresponding codepoint. diff --git a/Dalamud/Interface/GameFonts/GameFontLayoutPlan.cs b/Dalamud/Interface/GameFonts/GameFontLayoutPlan.cs index 5b0fe100b..9d7b9b10b 100644 --- a/Dalamud/Interface/GameFonts/GameFontLayoutPlan.cs +++ b/Dalamud/Interface/GameFonts/GameFontLayoutPlan.cs @@ -300,7 +300,7 @@ public class GameFontLayoutPlan elements.Add(new() { Codepoint = c, Glyph = this.fdt.GetGlyph(c), }); var lastBreakIndex = 0; - List lineBreakIndices = new() { 0 }; + List lineBreakIndices = [0]; for (var i = 1; i < elements.Count; i++) { var prev = elements[i - 1]; diff --git a/Dalamud/Interface/ImGuiBackend/Renderers/Dx11Renderer.cs b/Dalamud/Interface/ImGuiBackend/Renderers/Dx11Renderer.cs index e3df30c23..f1cc33248 100644 --- a/Dalamud/Interface/ImGuiBackend/Renderers/Dx11Renderer.cs +++ b/Dalamud/Interface/ImGuiBackend/Renderers/Dx11Renderer.cs @@ -30,7 +30,7 @@ namespace Dalamud.Interface.ImGuiBackend.Renderers; Justification = "Multiple fixed/using scopes")] internal unsafe partial class Dx11Renderer : IImGuiRenderer { - private readonly List fontTextures = new(); + private readonly List fontTextures = []; private readonly D3D_FEATURE_LEVEL featureLevel; private readonly ViewportHandler viewportHandler; private readonly nint renderNamePtr; diff --git a/Dalamud/Interface/ImGuiFileDialog/FileDialog.Filters.cs b/Dalamud/Interface/ImGuiFileDialog/FileDialog.Filters.cs index 85b380bee..3b7e8c1b3 100644 --- a/Dalamud/Interface/ImGuiFileDialog/FileDialog.Filters.cs +++ b/Dalamud/Interface/ImGuiFileDialog/FileDialog.Filters.cs @@ -10,7 +10,7 @@ public partial class FileDialog { private static Regex filterRegex = new(@"[^,{}]+(\{([^{}]*?)\})?", RegexOptions.Compiled); - private List filters = new(); + private List filters = []; private FilterStruct selectedFilter; private void ParseFilters(string filters) @@ -42,7 +42,7 @@ public partial class FileDialog filter = new FilterStruct { Filter = match, - CollectionFilters = new(), + CollectionFilters = [], }; } diff --git a/Dalamud/Interface/ImGuiFileDialog/FileDialog.UI.cs b/Dalamud/Interface/ImGuiFileDialog/FileDialog.UI.cs index 3c02f9559..cf8ef8461 100644 --- a/Dalamud/Interface/ImGuiFileDialog/FileDialog.UI.cs +++ b/Dalamud/Interface/ImGuiFileDialog/FileDialog.UI.cs @@ -122,7 +122,7 @@ public partial class FileDialog { if (iconMap == null) { - iconMap = new(); + iconMap = []; AddToIconMap(new[] { "mp4", "gif", "mov", "avi" }, FontAwesomeIcon.FileVideo, miscTextColor); AddToIconMap(new[] { "pdf" }, FontAwesomeIcon.FilePdf, miscTextColor); AddToIconMap(new[] { "png", "jpg", "jpeg", "tiff" }, FontAwesomeIcon.FileImage, imageTextColor); diff --git a/Dalamud/Interface/ImGuiFileDialog/FileDialog.cs b/Dalamud/Interface/ImGuiFileDialog/FileDialog.cs index 3d8246ffd..e33fc2fc4 100644 --- a/Dalamud/Interface/ImGuiFileDialog/FileDialog.cs +++ b/Dalamud/Interface/ImGuiFileDialog/FileDialog.cs @@ -30,7 +30,7 @@ public partial class FileDialog private string currentPath; private string fileNameBuffer = string.Empty; - private List pathDecomposition = new(); + private List pathDecomposition = []; private bool pathClicked = true; private bool pathInputActivated = false; private string pathInputBuffer = string.Empty; @@ -46,12 +46,12 @@ public partial class FileDialog private string searchBuffer = string.Empty; private string lastSelectedFileName = string.Empty; - private List selectedFileNames = new(); + private List selectedFileNames = []; private float footerHeight = 0; private string selectedSideBar = string.Empty; - private List quickAccess = new(); + private List quickAccess = []; /// /// Initializes a new instance of the class. @@ -130,12 +130,12 @@ public partial class FileDialog { if (!this.flags.HasFlag(ImGuiFileDialogFlags.SelectOnly)) { - return new List { this.GetFilePathName() }; + return [this.GetFilePathName()]; } if (this.IsDirectoryMode() && this.selectedFileNames.Count == 0) { - return new List { this.GetFilePathName() }; // current directory + return [this.GetFilePathName()]; // current directory } var fullPaths = this.selectedFileNames.Where(x => !string.IsNullOrEmpty(x)).Select(x => Path.Combine(this.currentPath, x)); diff --git a/Dalamud/Interface/ImGuiFontChooserDialog/SingleFontChooserDialog.cs b/Dalamud/Interface/ImGuiFontChooserDialog/SingleFontChooserDialog.cs index 6a381f5b2..23cc2e1e6 100644 --- a/Dalamud/Interface/ImGuiFontChooserDialog/SingleFontChooserDialog.cs +++ b/Dalamud/Interface/ImGuiFontChooserDialog/SingleFontChooserDialog.cs @@ -31,7 +31,7 @@ public sealed class SingleFontChooserDialog : IDisposable private const float MaxFontSizePt = 127; - private static readonly List EmptyIFontList = new(); + private static readonly List EmptyIFontList = []; private static readonly (string Name, float Value)[] FontSizeList = { diff --git a/Dalamud/Interface/ImGuiNotification/Internal/NotificationManager.cs b/Dalamud/Interface/ImGuiNotification/Internal/NotificationManager.cs index 340763a55..1b6e7e59b 100644 --- a/Dalamud/Interface/ImGuiNotification/Internal/NotificationManager.cs +++ b/Dalamud/Interface/ImGuiNotification/Internal/NotificationManager.cs @@ -26,8 +26,8 @@ internal class NotificationManager : INotificationManager, IInternalDisposableSe [ServiceManager.ServiceDependency] private readonly DalamudConfiguration configuration = Service.Get(); - private readonly List notifications = new(); - private readonly ConcurrentBag pendingNotifications = new(); + private readonly List notifications = []; + private readonly ConcurrentBag pendingNotifications = []; private NotificationPositionChooser? positionChooser; diff --git a/Dalamud/Interface/Internal/Asserts/AssertHandler.cs b/Dalamud/Interface/Internal/Asserts/AssertHandler.cs index 276dddb57..fadf80406 100644 --- a/Dalamud/Interface/Internal/Asserts/AssertHandler.cs +++ b/Dalamud/Interface/Internal/Asserts/AssertHandler.cs @@ -21,7 +21,7 @@ internal class AssertHandler : IDisposable private const int HidePrintEvery = 500; private readonly HashSet ignoredAsserts = []; - private readonly Dictionary assertCounts = new(); + private readonly Dictionary assertCounts = []; // Store callback to avoid it from being GC'd private readonly AssertCallbackDelegate callback; diff --git a/Dalamud/Interface/Internal/DalamudCommands.cs b/Dalamud/Interface/Internal/DalamudCommands.cs index b1fdb5232..052762971 100644 --- a/Dalamud/Interface/Internal/DalamudCommands.cs +++ b/Dalamud/Interface/Internal/DalamudCommands.cs @@ -208,7 +208,7 @@ internal class DalamudCommands : IServiceType var chatGui = Service.Get(); var configuration = Service.Get(); - configuration.BadWords ??= new List(); + configuration.BadWords ??= []; if (configuration.BadWords.Count == 0) { @@ -227,7 +227,7 @@ internal class DalamudCommands : IServiceType var chatGui = Service.Get(); var configuration = Service.Get(); - configuration.BadWords ??= new List(); + configuration.BadWords ??= []; configuration.BadWords.RemoveAll(x => x == arguments); diff --git a/Dalamud/Interface/Internal/DalamudIme.cs b/Dalamud/Interface/Internal/DalamudIme.cs index cdb976333..e5ff83ff8 100644 --- a/Dalamud/Interface/Internal/DalamudIme.cs +++ b/Dalamud/Interface/Internal/DalamudIme.cs @@ -74,7 +74,7 @@ internal sealed unsafe class DalamudIme : IInternalDisposableService private readonly ImGuiSetPlatformImeDataDelegate setPlatformImeDataDelegate; /// The candidates. - private readonly List<(string String, bool Supported)> candidateStrings = new(); + private readonly List<(string String, bool Supported)> candidateStrings = []; /// The selected imm component. private string compositionString = string.Empty; diff --git a/Dalamud/Interface/Internal/InterfaceManager.cs b/Dalamud/Interface/Internal/InterfaceManager.cs index d68bc8bef..16f765147 100644 --- a/Dalamud/Interface/Internal/InterfaceManager.cs +++ b/Dalamud/Interface/Internal/InterfaceManager.cs @@ -78,8 +78,8 @@ internal partial class InterfaceManager : IInternalDisposableService private static readonly ModuleLog Log = new("INTERFACE"); - private readonly ConcurrentBag deferredDisposeTextures = new(); - private readonly ConcurrentBag deferredDisposeDisposables = new(); + private readonly ConcurrentBag deferredDisposeTextures = []; + private readonly ConcurrentBag deferredDisposeDisposables = []; [ServiceManager.ServiceDependency] private readonly DalamudConfiguration dalamudConfiguration = Service.Get(); @@ -678,8 +678,7 @@ internal partial class InterfaceManager : IInternalDisposableService if (configuration.SavedStyles == null || configuration.SavedStyles.All(x => x.Name != StyleModelV1.DalamudStandard.Name)) { - configuration.SavedStyles = new List - { StyleModelV1.DalamudStandard, StyleModelV1.DalamudClassic }; + configuration.SavedStyles = [StyleModelV1.DalamudStandard, StyleModelV1.DalamudClassic]; configuration.ChosenStyle = StyleModelV1.DalamudStandard.Name; } else if (configuration.SavedStyles.Count == 1) diff --git a/Dalamud/Interface/Internal/PluginCategoryManager.cs b/Dalamud/Interface/Internal/PluginCategoryManager.cs index d3aea7f57..5d25a98da 100644 --- a/Dalamud/Interface/Internal/PluginCategoryManager.cs +++ b/Dalamud/Interface/Internal/PluginCategoryManager.cs @@ -58,8 +58,8 @@ internal class PluginCategoryManager private CategoryKind currentCategoryKind = CategoryKind.All; private bool isContentDirty; - private Dictionary mapPluginCategories = new(); - private List highlightedCategoryKinds = new(); + private Dictionary mapPluginCategories = []; + private List highlightedCategoryKinds = []; /// /// Type of category group. @@ -513,8 +513,7 @@ internal class PluginCategoryManager this.GroupKind = groupKind; this.nameFunc = nameFunc; - this.Categories = new(); - this.Categories.AddRange(categories); + this.Categories = [.. categories]; } /// diff --git a/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs b/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs index b0a910ead..852a6546c 100644 --- a/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs +++ b/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs @@ -85,7 +85,7 @@ internal sealed class ChangelogWindow : Window, IDisposable private AutoUpdateBehavior? chosenAutoUpdateBehavior; - private Dictionary currentFtueLevels = new(); + private Dictionary currentFtueLevels = []; private DateTime? isEligibleSince; private bool openedThroughEligibility; diff --git a/Dalamud/Interface/Internal/Windows/ComponentDemoWindow.cs b/Dalamud/Interface/Internal/Windows/ComponentDemoWindow.cs index 9096d78de..09f968508 100644 --- a/Dalamud/Interface/Internal/Windows/ComponentDemoWindow.cs +++ b/Dalamud/Interface/Internal/Windows/ComponentDemoWindow.cs @@ -42,14 +42,14 @@ internal sealed class ComponentDemoWindow : Window this.RespectCloseHotkey = false; - this.componentDemos = new() - { + this.componentDemos = + [ ("Test", ImGuiComponents.Test), ("HelpMarker", HelpMarkerDemo), ("IconButton", IconButtonDemo), ("TextWithLabel", TextWithLabelDemo), ("ColorPickerWithPalette", this.ColorPickerWithPaletteDemo), - }; + ]; } /// diff --git a/Dalamud/Interface/Internal/Windows/ConsoleWindow.cs b/Dalamud/Interface/Internal/Windows/ConsoleWindow.cs index 74df500db..978a9a841 100644 --- a/Dalamud/Interface/Internal/Windows/ConsoleWindow.cs +++ b/Dalamud/Interface/Internal/Windows/ConsoleWindow.cs @@ -40,7 +40,7 @@ internal class ConsoleWindow : Window, IDisposable private readonly RollingList logText; private readonly RollingList filteredLogEntries; - private readonly List pluginFilters = new(); + private readonly List pluginFilters = []; private readonly DalamudConfiguration configuration; diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/DataShareWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/DataShareWidget.cs index 83db4ac6e..a0d166f44 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/DataShareWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/DataShareWidget.cs @@ -28,7 +28,7 @@ internal class DataShareWidget : IDataWindowWidget { private const ImGuiTabItemFlags NoCloseButton = (ImGuiTabItemFlags)(1 << 20); - private readonly List<(string Name, byte[]? Data)> dataView = new(); + private readonly List<(string Name, byte[]? Data)> dataView = []; private int nextTab = -1; private IReadOnlyDictionary? gates; private List? gatesSorted; diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/IconBrowserWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/IconBrowserWidget.cs index 0395f4c96..68b6e4075 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/IconBrowserWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/IconBrowserWidget.cs @@ -269,7 +269,7 @@ public class IconBrowserWidget : IDataWindowWidget if (this.valueRange is not null) return; - this.valueRange = new(); + this.valueRange = []; foreach (var (id, _) in this.iconIdsTask!.Result) { if (this.startRange <= id && id < this.stopRange) diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/ImGuiWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/ImGuiWidget.cs index d4afce48d..01083a289 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/ImGuiWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/ImGuiWidget.cs @@ -19,7 +19,7 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets; /// internal class ImGuiWidget : IDataWindowWidget { - private readonly HashSet notifications = new(); + private readonly HashSet notifications = []; private NotificationTemplate notificationTemplate; /// diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/ServicesWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/ServicesWidget.cs index 78ea6d233..92f84f6d7 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/ServicesWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/ServicesWidget.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Numerics; using System.Reflection; @@ -16,9 +16,9 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets; /// internal class ServicesWidget : IDataWindowWidget { - private readonly Dictionary nodeRects = new(); - private readonly HashSet selectedNodes = new(); - private readonly HashSet tempRelatedNodes = new(); + private readonly Dictionary nodeRects = []; + private readonly HashSet selectedNodes = []; + private readonly HashSet tempRelatedNodes = []; private bool includeUnloadDependencies; private List>? dependencyNodes; @@ -280,9 +280,9 @@ internal class ServicesWidget : IDataWindowWidget private class ServiceDependencyNode { - private readonly List parents = new(); - private readonly List children = new(); - private readonly List invalidParents = new(); + private readonly List parents = []; + private readonly List children = []; + private readonly List invalidParents = []; private ServiceDependencyNode(Type t) { @@ -370,7 +370,7 @@ internal class ServicesWidget : IDataWindowWidget foreach (var n in CreateTree(includeUnloadDependencies)) { while (res.Count <= n.Level) - res.Add(new()); + res.Add([]); res[n.Level].Add(n); } diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs index 349e724f0..42a4dc698 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs @@ -43,7 +43,7 @@ internal class TexWidget : IDataWindowWidget [DrawBlameTableColumnUserId.NativeAddress] = static x => x.ResourceAddress, }; - private readonly List addedTextures = new(); + private readonly List addedTextures = []; private string allLoadedTexturesTableName = "##table"; private string iconId = "18"; diff --git a/Dalamud/Interface/Internal/Windows/PluginImageCache.cs b/Dalamud/Interface/Internal/Windows/PluginImageCache.cs index 1d2512a96..9fde4c74c 100644 --- a/Dalamud/Interface/Internal/Windows/PluginImageCache.cs +++ b/Dalamud/Interface/Internal/Windows/PluginImageCache.cs @@ -51,8 +51,8 @@ internal class PluginImageCache : IInternalDisposableService [ServiceManager.ServiceDependency] private readonly HappyHttpClient happyHttpClient = Service.Get(); - private readonly BlockingCollection>> downloadQueue = new(); - private readonly BlockingCollection> loadQueue = new(); + private readonly BlockingCollection>> downloadQueue = []; + private readonly BlockingCollection> loadQueue = []; private readonly CancellationTokenSource cancelToken = new(); private readonly Task downloadTask; private readonly Task loadTask; diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs index b203b3894..475316c17 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs @@ -49,7 +49,7 @@ internal class PluginInstallerWindow : Window, IDisposable private readonly PluginImageCache imageCache; private readonly PluginCategoryManager categoryManager = new(); - private readonly List openPluginCollapsibles = new(); + private readonly List openPluginCollapsibles = []; private readonly DateTime timeLoaded; @@ -113,9 +113,9 @@ internal class PluginInstallerWindow : Window, IDisposable private List? updatedPlugins; [SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1201:Elements should appear in the correct order", Justification = "Makes sense like this")] - private List pluginListAvailable = new(); - private List pluginListInstalled = new(); - private List pluginListUpdatable = new(); + private List pluginListAvailable = []; + private List pluginListInstalled = []; + private List pluginListUpdatable = []; private bool hasDevPlugins = false; private bool hasHiddenPlugins = false; diff --git a/Dalamud/Interface/Internal/Windows/ProfilerWindow.cs b/Dalamud/Interface/Internal/Windows/ProfilerWindow.cs index abe8d1584..7b05f643e 100644 --- a/Dalamud/Interface/Internal/Windows/ProfilerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/ProfilerWindow.cs @@ -19,7 +19,7 @@ public class ProfilerWindow : Window { private double min; private double max; - private List>> occupied = new(); + private List>> occupied = []; /// /// Initializes a new instance of the class. @@ -109,7 +109,7 @@ public class ProfilerWindow : Window } if (depth == this.occupied.Count) - this.occupied.Add(new()); + this.occupied.Add([]); this.occupied[depth].Add(Tuple.Create(timingHandle.StartTime, timingHandle.EndTime)); parentDepthDict[timingHandle.Id] = depth; diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/SelfTestWindow.cs b/Dalamud/Interface/Internal/Windows/SelfTest/SelfTestWindow.cs index ea8cd0070..0a4f29e19 100644 --- a/Dalamud/Interface/Internal/Windows/SelfTest/SelfTestWindow.cs +++ b/Dalamud/Interface/Internal/Windows/SelfTest/SelfTestWindow.cs @@ -25,7 +25,7 @@ internal class SelfTestWindow : Window private readonly SelfTestRegistry selfTestRegistry; - private List visibleSteps = new(); + private List visibleSteps = []; private bool selfTestRunning = false; private SelfTestGroup? currentTestGroup = null; @@ -138,7 +138,7 @@ internal class SelfTestWindow : Window ImGui.SameLine(); var stepNumber = this.currentStep != null ? this.visibleSteps.IndexOf(this.currentStep) : 0; - ImGui.Text($"Step: {stepNumber} / {this.visibleSteps.Count}"); + ImGui.Text($"Step: {stepNumber} / {this.visibleSteps.Count}"); ImGui.Spacing(); diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/AddonLifecycleSelfTestStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/AddonLifecycleSelfTestStep.cs index d9c9facc7..e2c1a40df 100644 --- a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/AddonLifecycleSelfTestStep.cs +++ b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/AddonLifecycleSelfTestStep.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Dalamud.Bindings.ImGui; using Dalamud.Game.Addon.Lifecycle; @@ -23,15 +23,15 @@ internal class AddonLifecycleSelfTestStep : ISelfTestStep /// public AddonLifecycleSelfTestStep() { - this.listeners = new List - { + this.listeners = + [ new(AddonEvent.PostSetup, "Character", this.PostSetup), new(AddonEvent.PostUpdate, "Character", this.PostUpdate), new(AddonEvent.PostDraw, "Character", this.PostDraw), new(AddonEvent.PostRefresh, "Character", this.PostRefresh), new(AddonEvent.PostRequestedUpdate, "Character", this.PostRequestedUpdate), new(AddonEvent.PreFinalize, "Character", this.PreFinalize), - }; + ]; } private enum TestStep diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/NamePlateSelfTestStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/NamePlateSelfTestStep.cs index 9cc6045a6..7136c8801 100644 --- a/Dalamud/Interface/Internal/Windows/SelfTest/Steps/NamePlateSelfTestStep.cs +++ b/Dalamud/Interface/Internal/Windows/SelfTest/Steps/NamePlateSelfTestStep.cs @@ -36,7 +36,7 @@ internal class NamePlateSelfTestStep : ISelfTestStep namePlateGui.OnNamePlateUpdate += this.OnNamePlateUpdate; namePlateGui.OnDataUpdate += this.OnDataUpdate; namePlateGui.RequestRedraw(); - this.updateCount = new Dictionary(); + this.updateCount = []; this.currentSubStep++; break; diff --git a/Dalamud/Interface/Internal/Windows/StyleEditor/StyleEditorWindow.cs b/Dalamud/Interface/Internal/Windows/StyleEditor/StyleEditorWindow.cs index f9e8022a1..2414c3349 100644 --- a/Dalamud/Interface/Internal/Windows/StyleEditor/StyleEditorWindow.cs +++ b/Dalamud/Interface/Internal/Windows/StyleEditor/StyleEditorWindow.cs @@ -50,7 +50,7 @@ public class StyleEditorWindow : Window this.didSave = false; var config = Service.Get(); - config.SavedStyles ??= new List(); + config.SavedStyles ??= []; this.currentSel = config.SavedStyles.FindIndex(x => x.Name == config.ChosenStyle); this.initialStyle = config.ChosenStyle; diff --git a/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs b/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs index e3eb22a04..6f2765d71 100644 --- a/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs +++ b/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs @@ -49,9 +49,9 @@ internal class TitleScreenMenuWindow : Window, IDisposable private readonly Lazy shadeTexture; private readonly AddonLifecycleEventListener versionStringListener; - private readonly Dictionary shadeEasings = new(); - private readonly Dictionary moveEasings = new(); - private readonly Dictionary logoEasings = new(); + private readonly Dictionary shadeEasings = []; + private readonly Dictionary moveEasings = []; + private readonly Dictionary logoEasings = []; private readonly IConsoleVariable showTsm; diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/DelegateFontHandle.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/DelegateFontHandle.cs index 7ebe509d0..0e2f503b4 100644 --- a/Dalamud/Interface/ManagedFontAtlas/Internals/DelegateFontHandle.cs +++ b/Dalamud/Interface/ManagedFontAtlas/Internals/DelegateFontHandle.cs @@ -35,7 +35,7 @@ internal sealed class DelegateFontHandle : FontHandle /// internal sealed class HandleManager : IFontHandleManager { - private readonly HashSet handles = new(); + private readonly HashSet handles = []; private readonly Lock syncRoot = new(); /// @@ -96,8 +96,8 @@ internal sealed class DelegateFontHandle : FontHandle private static readonly ModuleLog Log = new($"{nameof(DelegateFontHandle)}.{nameof(HandleSubstance)}"); // Owned by this class, but ImFontPtr values still do not belong to this. - private readonly Dictionary fonts = new(); - private readonly Dictionary buildExceptions = new(); + private readonly Dictionary fonts = []; + private readonly Dictionary buildExceptions = []; /// /// Initializes a new instance of the class. diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.BuildToolkit.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.BuildToolkit.cs index 2a93cf093..e47653ac5 100644 --- a/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.BuildToolkit.cs +++ b/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.BuildToolkit.cs @@ -25,8 +25,7 @@ namespace Dalamud.Interface.ManagedFontAtlas.Internals; /// internal sealed partial class FontAtlasFactory { - private static readonly Dictionary> PairAdjustmentsCache = - new(); + private static readonly Dictionary> PairAdjustmentsCache = []; /// /// Implementations for and @@ -44,7 +43,7 @@ internal sealed partial class FontAtlasFactory private readonly GamePrebakedFontHandle.HandleSubstance gameFontHandleSubstance; private readonly FontAtlasFactory factory; private readonly FontAtlasBuiltData data; - private readonly List registeredPostBuildActions = new(); + private readonly List registeredPostBuildActions = []; /// /// Initializes a new instance of the class. @@ -86,7 +85,7 @@ internal sealed partial class FontAtlasFactory /// /// Gets the font scale modes. /// - private Dictionary FontScaleModes { get; } = new(); + private Dictionary FontScaleModes { get; } = []; /// public void Dispose() => this.disposeAfterBuild.Dispose(); @@ -189,7 +188,7 @@ internal sealed partial class FontAtlasFactory { if (!PairAdjustmentsCache.TryGetValue(hashIdent, out pairAdjustments)) { - PairAdjustmentsCache.Add(hashIdent, pairAdjustments = new()); + PairAdjustmentsCache.Add(hashIdent, pairAdjustments = []); try { pairAdjustments.AddRange(TrueTypeUtils.ExtractHorizontalPairAdjustments(raw).ToArray()); diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.Implementation.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.Implementation.cs index 6e05dea70..c87b639e6 100644 --- a/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.Implementation.cs +++ b/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.Implementation.cs @@ -66,10 +66,10 @@ internal sealed partial class FontAtlasFactory try { - var substancesList = this.substances = new(); + var substancesList = this.substances = []; this.Garbage.Add(() => substancesList.Clear()); - var wrapsCopy = this.wraps = new(); + var wrapsCopy = this.wraps = []; this.Garbage.Add(() => wrapsCopy.Clear()); var atlasPtr = ImGui.ImFontAtlas(); diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/FontHandle.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/FontHandle.cs index 1fdaf4596..5a1e050f4 100644 --- a/Dalamud/Interface/ManagedFontAtlas/Internals/FontHandle.cs +++ b/Dalamud/Interface/ManagedFontAtlas/Internals/FontHandle.cs @@ -20,7 +20,7 @@ namespace Dalamud.Interface.ManagedFontAtlas.Internals; internal abstract class FontHandle : IFontHandle { private const int NonMainThreadFontAccessWarningCheckInterval = 10000; - private static readonly ConditionalWeakTable NonMainThreadFontAccessWarning = new(); + private static readonly ConditionalWeakTable NonMainThreadFontAccessWarning = []; private static long nextNonMainThreadFontAccessWarningCheck; private readonly List pushedFonts = new(8); diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/GamePrebakedFontHandle.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/GamePrebakedFontHandle.cs index 96edf6759..3ca17cb76 100644 --- a/Dalamud/Interface/ManagedFontAtlas/Internals/GamePrebakedFontHandle.cs +++ b/Dalamud/Interface/ManagedFontAtlas/Internals/GamePrebakedFontHandle.cs @@ -103,8 +103,8 @@ internal class GamePrebakedFontHandle : FontHandle /// internal sealed class HandleManager : IFontHandleManager { - private readonly Dictionary gameFontsRc = new(); - private readonly HashSet handles = new(); + private readonly Dictionary gameFontsRc = []; + private readonly HashSet handles = []; private readonly Lock syncRoot = new(); /// @@ -190,11 +190,11 @@ internal class GamePrebakedFontHandle : FontHandle private readonly HashSet gameFontStyles; // Owned by this class, but ImFontPtr values still do not belong to this. - private readonly Dictionary fonts = new(); - private readonly Dictionary buildExceptions = new(); - private readonly List<(ImFontPtr Font, GameFontStyle Style, ushort[]? Ranges)> attachments = new(); + private readonly Dictionary fonts = []; + private readonly Dictionary buildExceptions = []; + private readonly List<(ImFontPtr Font, GameFontStyle Style, ushort[]? Ranges)> attachments = []; - private readonly HashSet templatedFonts = new(); + private readonly HashSet templatedFonts = []; /// /// Initializes a new instance of the class. @@ -451,8 +451,8 @@ internal class GamePrebakedFontHandle : FontHandle public readonly GameFontStyle BaseStyle; public readonly GameFontFamilyAndSizeAttribute BaseAttr; public readonly int TexCount; - public readonly Dictionary Ranges = new(); - public readonly List<(int RectId, int FdtGlyphIndex)> Rects = new(); + public readonly Dictionary Ranges = []; + public readonly List<(int RectId, int FdtGlyphIndex)> Rects = []; public readonly ushort[] RectLookup = new ushort[0x10000]; public readonly FdtFileView Fdt; public readonly ImFontPtr FullRangeFont; diff --git a/Dalamud/Interface/Style/StyleModel.cs b/Dalamud/Interface/Style/StyleModel.cs index bfce480f2..926317c51 100644 --- a/Dalamud/Interface/Style/StyleModel.cs +++ b/Dalamud/Interface/Style/StyleModel.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Numerics; @@ -86,8 +86,7 @@ public abstract class StyleModel if (configuration.SavedStylesOld == null) return; - configuration.SavedStyles = new List(); - configuration.SavedStyles.AddRange(configuration.SavedStylesOld); + configuration.SavedStyles = [.. configuration.SavedStylesOld]; Log.Information("Transferred {NumStyles} styles", configuration.SavedStyles.Count); diff --git a/Dalamud/Interface/Style/StyleModelV1.cs b/Dalamud/Interface/Style/StyleModelV1.cs index 8c1de86f3..87df45bb9 100644 --- a/Dalamud/Interface/Style/StyleModelV1.cs +++ b/Dalamud/Interface/Style/StyleModelV1.cs @@ -17,7 +17,7 @@ public class StyleModelV1 : StyleModel /// private StyleModelV1() { - this.Colors = new Dictionary(); + this.Colors = []; this.Name = "Unknown"; } @@ -396,7 +396,7 @@ public class StyleModelV1 : StyleModel model.SelectableTextAlign = style.SelectableTextAlign; model.DisplaySafeAreaPadding = style.DisplaySafeAreaPadding; - model.Colors = new Dictionary(); + model.Colors = []; foreach (var imGuiCol in Enum.GetValues()) { diff --git a/Dalamud/Interface/Textures/Internal/SharedImmediateTextures/SharedImmediateTexture.cs b/Dalamud/Interface/Textures/Internal/SharedImmediateTextures/SharedImmediateTexture.cs index 9264661bd..931a1a73b 100644 --- a/Dalamud/Interface/Textures/Internal/SharedImmediateTextures/SharedImmediateTexture.cs +++ b/Dalamud/Interface/Textures/Internal/SharedImmediateTextures/SharedImmediateTexture.cs @@ -24,7 +24,7 @@ internal abstract class SharedImmediateTexture private static long instanceCounter; private readonly Lock reviveLock = new(); - private readonly List ownerPlugins = new(); + private readonly List ownerPlugins = []; private bool resourceReleased; private int refCount; diff --git a/Dalamud/Interface/Textures/Internal/TextureManager.BlameTracker.cs b/Dalamud/Interface/Textures/Internal/TextureManager.BlameTracker.cs index 837b41271..dd6f15288 100644 --- a/Dalamud/Interface/Textures/Internal/TextureManager.BlameTracker.cs +++ b/Dalamud/Interface/Textures/Internal/TextureManager.BlameTracker.cs @@ -44,7 +44,7 @@ internal sealed partial class TextureManager /// Gets the list containing all the loaded textures from plugins. /// Returned value must be used inside a lock. - public List BlameTracker { get; } = new(); + public List BlameTracker { get; } = []; /// Gets the blame for a texture wrap. /// The texture wrap. @@ -234,7 +234,7 @@ internal sealed partial class TextureManager public static Guid* NativeGuid => (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in MyGuid)); /// - public List OwnerPlugins { get; } = new(); + public List OwnerPlugins { get; } = []; /// public nint ResourceAddress => (nint)this.tex2D; diff --git a/Dalamud/Interface/Textures/Internal/TextureManager.SharedTextures.cs b/Dalamud/Interface/Textures/Internal/TextureManager.SharedTextures.cs index d7e185b68..03c7f5955 100644 --- a/Dalamud/Interface/Textures/Internal/TextureManager.SharedTextures.cs +++ b/Dalamud/Interface/Textures/Internal/TextureManager.SharedTextures.cs @@ -65,7 +65,7 @@ internal sealed partial class TextureManager private readonly ConcurrentDictionary gameDict = new(); private readonly ConcurrentDictionary fileDict = new(); private readonly ConcurrentDictionary<(Assembly, string), SharedImmediateTexture> manifestResourceDict = new(); - private readonly HashSet invalidatedTextures = new(); + private readonly HashSet invalidatedTextures = []; private readonly Thread sharedTextureReleaseThread; diff --git a/Dalamud/Interface/TitleScreenMenu/TitleScreenMenu.cs b/Dalamud/Interface/TitleScreenMenu/TitleScreenMenu.cs index f889f59a0..cf849a1ef 100644 --- a/Dalamud/Interface/TitleScreenMenu/TitleScreenMenu.cs +++ b/Dalamud/Interface/TitleScreenMenu/TitleScreenMenu.cs @@ -22,7 +22,7 @@ internal class TitleScreenMenu : IServiceType, ITitleScreenMenu /// internal const uint TextureSize = 64; - private readonly List entries = new(); + private readonly List entries = []; private TitleScreenMenuEntry[]? entriesView; [ServiceManager.ServiceConstructor] @@ -220,7 +220,7 @@ internal class TitleScreenMenuPluginScoped : IInternalDisposableService, ITitleS [ServiceManager.ServiceDependency] private readonly TitleScreenMenu titleScreenMenuService = Service.Get(); - private readonly List pluginEntries = new(); + private readonly List pluginEntries = []; /// public IReadOnlyList? Entries => this.titleScreenMenuService.Entries; diff --git a/Dalamud/Interface/UiBuilder.cs b/Dalamud/Interface/UiBuilder.cs index e38537018..f97c4d82e 100644 --- a/Dalamud/Interface/UiBuilder.cs +++ b/Dalamud/Interface/UiBuilder.cs @@ -607,7 +607,7 @@ public sealed class UiBuilder : IDisposable, IUiBuilder /// /// Gets or sets a history of the last draw times, used to calculate an average. /// - internal List DrawTimeHistory { get; set; } = new List(); + internal List DrawTimeHistory { get; set; } = []; private InterfaceManager? InterfaceManagerWithScene => Service.GetNullable()?.Manager; diff --git a/Dalamud/Interface/UldWrapper.cs b/Dalamud/Interface/UldWrapper.cs index 85a2d8344..4c19f3543 100644 --- a/Dalamud/Interface/UldWrapper.cs +++ b/Dalamud/Interface/UldWrapper.cs @@ -17,7 +17,7 @@ public class UldWrapper : IDisposable { private readonly DataManager data; private readonly TextureManager textureManager; - private readonly Dictionary textures = new(); + private readonly Dictionary textures = []; /// Initializes a new instance of the class, wrapping an ULD file. /// The UiBuilder used to load textures. diff --git a/Dalamud/Interface/Utility/Raii/Color.cs b/Dalamud/Interface/Utility/Raii/Color.cs index 7bf2efc38..b51a36ebe 100644 --- a/Dalamud/Interface/Utility/Raii/Color.cs +++ b/Dalamud/Interface/Utility/Raii/Color.cs @@ -29,7 +29,7 @@ public static partial class ImRaii public sealed class Color : IDisposable { - internal static readonly List<(ImGuiCol, uint)> Stack = new(); + internal static readonly List<(ImGuiCol, uint)> Stack = []; private int count; public Color Push(ImGuiCol idx, uint color, bool condition = true) diff --git a/Dalamud/Interface/Utility/Raii/Plot.cs b/Dalamud/Interface/Utility/Raii/Plot.cs index d2ff38299..e88919e48 100644 --- a/Dalamud/Interface/Utility/Raii/Plot.cs +++ b/Dalamud/Interface/Utility/Raii/Plot.cs @@ -96,7 +96,7 @@ public static partial class ImRaii public sealed class PlotStyle : IDisposable { - internal static readonly List<(ImPlotStyleVar, Vector2)> Stack = new(); + internal static readonly List<(ImPlotStyleVar, Vector2)> Stack = []; private int count; @@ -249,7 +249,7 @@ public static partial class ImRaii public sealed class PlotColor : IDisposable { - internal static readonly List<(ImPlotCol, uint)> Stack = new(); + internal static readonly List<(ImPlotCol, uint)> Stack = []; private int count; // Reimplementation of https://github.com/ocornut/imgui/blob/868facff9ded2d61425c67deeba354eb24275bd1/imgui.cpp#L3035 diff --git a/Dalamud/Interface/Utility/Raii/Style.cs b/Dalamud/Interface/Utility/Raii/Style.cs index bfd04ea3c..e178b68d3 100644 --- a/Dalamud/Interface/Utility/Raii/Style.cs +++ b/Dalamud/Interface/Utility/Raii/Style.cs @@ -35,7 +35,7 @@ public static partial class ImRaii public sealed class Style : IDisposable { - internal static readonly List<(ImGuiStyleVar, Vector2)> Stack = new(); + internal static readonly List<(ImGuiStyleVar, Vector2)> Stack = []; private int count; diff --git a/Dalamud/Interface/Windowing/Persistence/PresetModel.cs b/Dalamud/Interface/Windowing/Persistence/PresetModel.cs index f7910e0b2..f132b6eea 100644 --- a/Dalamud/Interface/Windowing/Persistence/PresetModel.cs +++ b/Dalamud/Interface/Windowing/Persistence/PresetModel.cs @@ -25,7 +25,7 @@ internal class PresetModel /// Gets or sets a dictionary containing the windows in the preset, mapping their ID to the preset. /// [JsonProperty("w")] - public Dictionary Windows { get; set; } = new(); + public Dictionary Windows { get; set; } = []; /// /// Class representing a window in a preset. diff --git a/Dalamud/Interface/Windowing/Window.cs b/Dalamud/Interface/Windowing/Window.cs index d4f0070db..dc86b5225 100644 --- a/Dalamud/Interface/Windowing/Window.cs +++ b/Dalamud/Interface/Windowing/Window.cs @@ -230,7 +230,7 @@ public abstract class Window /// disabled globally by the user, an internal title bar button to manage these is added when drawing, but it will /// not appear in this collection. If you wish to remove this button, set both of these values to false. /// - public List TitleBarButtons { get; set; } = new(); + public List TitleBarButtons { get; set; } = []; /// /// Gets or sets a value indicating whether this window will stay open. diff --git a/Dalamud/Interface/Windowing/WindowSystem.cs b/Dalamud/Interface/Windowing/WindowSystem.cs index 87bd199a1..d77caa3d5 100644 --- a/Dalamud/Interface/Windowing/WindowSystem.cs +++ b/Dalamud/Interface/Windowing/WindowSystem.cs @@ -15,7 +15,7 @@ public class WindowSystem { private static DateTimeOffset lastAnyFocus; - private readonly List windows = new(); + private readonly List windows = []; private string lastFocusedWindowName = string.Empty; diff --git a/Dalamud/IoC/Internal/ServiceContainer.cs b/Dalamud/IoC/Internal/ServiceContainer.cs index 6383b6b11..68f3a991c 100644 --- a/Dalamud/IoC/Internal/ServiceContainer.cs +++ b/Dalamud/IoC/Internal/ServiceContainer.cs @@ -22,8 +22,8 @@ internal class ServiceContainer : IServiceType { private static readonly ModuleLog Log = new("SERVICECONTAINER"); - private readonly Dictionary instances = new(); - private readonly Dictionary interfaceToTypeMap = new(); + private readonly Dictionary instances = []; + private readonly Dictionary interfaceToTypeMap = []; /// /// Initializes a new instance of the class. diff --git a/Dalamud/Logging/Internal/TaskTracker.cs b/Dalamud/Logging/Internal/TaskTracker.cs index cb9a0db6d..e8a3ff409 100644 --- a/Dalamud/Logging/Internal/TaskTracker.cs +++ b/Dalamud/Logging/Internal/TaskTracker.cs @@ -16,7 +16,7 @@ namespace Dalamud.Logging.Internal; internal class TaskTracker : IInternalDisposableService { private static readonly ModuleLog Log = new("TT"); - private static readonly List TrackedTasksInternal = new(); + private static readonly List TrackedTasksInternal = []; private static readonly ConcurrentQueue NewlyCreatedTasks = new(); private static bool clearRequested = false; diff --git a/Dalamud/Plugin/Internal/Loader/AssemblyLoadContextBuilder.cs b/Dalamud/Plugin/Internal/Loader/AssemblyLoadContextBuilder.cs index 1c6e6feed..5aa276b61 100644 --- a/Dalamud/Plugin/Internal/Loader/AssemblyLoadContextBuilder.cs +++ b/Dalamud/Plugin/Internal/Loader/AssemblyLoadContextBuilder.cs @@ -15,9 +15,9 @@ namespace Dalamud.Plugin.Internal.Loader; /// internal class AssemblyLoadContextBuilder { - private readonly List additionalProbingPaths = new(); - private readonly List resourceProbingPaths = new(); - private readonly List resourceProbingSubpaths = new(); + private readonly List additionalProbingPaths = []; + private readonly List resourceProbingPaths = []; + private readonly List resourceProbingSubpaths = []; private readonly Dictionary managedLibraries = new(StringComparer.Ordinal); private readonly Dictionary nativeLibraries = new(StringComparer.Ordinal); private readonly HashSet privateAssemblies = new(StringComparer.Ordinal); diff --git a/Dalamud/Plugin/Internal/Loader/LoaderConfig.cs b/Dalamud/Plugin/Internal/Loader/LoaderConfig.cs index b863b8ee1..e26338820 100644 --- a/Dalamud/Plugin/Internal/Loader/LoaderConfig.cs +++ b/Dalamud/Plugin/Internal/Loader/LoaderConfig.cs @@ -39,13 +39,13 @@ internal class LoaderConfig /// /// Gets a list of assemblies which should be treated as private. /// - public ICollection PrivateAssemblies { get; } = new List(); + public ICollection PrivateAssemblies { get; } = []; /// /// Gets a list of assemblies which should be unified between the host and the plugin. /// /// what-are-shared-types - public ICollection<(AssemblyName Name, bool Recursive)> SharedAssemblies { get; } = new List<(AssemblyName Name, bool Recursive)>(); + public ICollection<(AssemblyName Name, bool Recursive)> SharedAssemblies { get; } = []; /// /// Gets or sets a value indicating whether attempt to unify all types from a plugin with the host. diff --git a/Dalamud/Plugin/Internal/PluginErrorHandler.cs b/Dalamud/Plugin/Internal/PluginErrorHandler.cs index 0094c3751..b39a9ca1a 100644 --- a/Dalamud/Plugin/Internal/PluginErrorHandler.cs +++ b/Dalamud/Plugin/Internal/PluginErrorHandler.cs @@ -22,7 +22,7 @@ internal class PluginErrorHandler : IServiceType private readonly NotificationManager notificationManager; private readonly DalamudInterface di; - private readonly Dictionary invokerCache = new(); + private readonly Dictionary invokerCache = []; private DateTime lastErrorTime = DateTime.MinValue; private IActiveNotification? activeNotification; diff --git a/Dalamud/Plugin/Internal/PluginManager.cs b/Dalamud/Plugin/Internal/PluginManager.cs index fd5c048c7..640ec7e9c 100644 --- a/Dalamud/Plugin/Internal/PluginManager.cs +++ b/Dalamud/Plugin/Internal/PluginManager.cs @@ -56,9 +56,9 @@ internal class PluginManager : IInternalDisposableService private readonly DirectoryInfo pluginDirectory; private readonly BannedPlugin[]? bannedPlugins; - private readonly List installedPluginsList = new(); - private readonly List availablePluginsList = new(); - private readonly List updatablePluginsList = new(); + private readonly List installedPluginsList = []; + private readonly List availablePluginsList = []; + private readonly List updatablePluginsList = []; private readonly Task openInstallerWindowPluginChangelogsLink; @@ -131,7 +131,7 @@ internal class PluginManager : IInternalDisposableService PluginInstallerOpenKind.Changelogs); })); - this.configuration.PluginTestingOptIns ??= new(); + this.configuration.PluginTestingOptIns ??= []; this.MainRepo = PluginRepository.CreateMainRepo(this.happyHttpClient); registerStartupBlocker( @@ -230,7 +230,7 @@ internal class PluginManager : IInternalDisposableService /// /// Gets a list of all plugin repositories. The main repo should always be first. /// - public List Repos { get; private set; } = new(); + public List Repos { get; private set; } = []; /// /// Gets a value indicating whether plugins are not still loading from boot. @@ -1894,9 +1894,9 @@ internal class PluginManager : IInternalDisposableService /// public class StartupLoadTracker { - private readonly Dictionary internalToPublic = new(); - private readonly ConcurrentBag allInternalNames = new(); - private readonly ConcurrentBag finishedInternalNames = new(); + private readonly Dictionary internalToPublic = []; + private readonly ConcurrentBag allInternalNames = []; + private readonly ConcurrentBag finishedInternalNames = []; /// /// Gets a value indicating the total load progress. diff --git a/Dalamud/Plugin/Internal/Profiles/PluginManagementCommandHandler.cs b/Dalamud/Plugin/Internal/Profiles/PluginManagementCommandHandler.cs index 09cceebcb..bba4918ce 100644 --- a/Dalamud/Plugin/Internal/Profiles/PluginManagementCommandHandler.cs +++ b/Dalamud/Plugin/Internal/Profiles/PluginManagementCommandHandler.cs @@ -39,7 +39,7 @@ internal class PluginManagementCommandHandler : IInternalDisposableService private readonly ChatGui chat; private readonly Framework framework; - private List<(Target Target, PluginCommandOperation Operation)> commandQueue = new(); + private List<(Target Target, PluginCommandOperation Operation)> commandQueue = []; /// /// Initializes a new instance of the class. diff --git a/Dalamud/Plugin/Internal/Profiles/ProfileManager.cs b/Dalamud/Plugin/Internal/Profiles/ProfileManager.cs index 775ff7a72..1df475f55 100644 --- a/Dalamud/Plugin/Internal/Profiles/ProfileManager.cs +++ b/Dalamud/Plugin/Internal/Profiles/ProfileManager.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text.RegularExpressions; @@ -20,7 +20,7 @@ internal class ProfileManager : IServiceType private static readonly ModuleLog Log = new("PROFMAN"); private readonly DalamudConfiguration config; - private readonly List profiles = new(); + private readonly List profiles = []; private volatile bool isBusy = false; @@ -359,7 +359,7 @@ internal class ProfileManager : IServiceType this.config.DefaultProfile ??= new ProfileModelV1(); this.profiles.Add(new Profile(this, this.config.DefaultProfile, true, true)); - this.config.SavedProfiles ??= new List(); + this.config.SavedProfiles ??= []; foreach (var profileModel in this.config.SavedProfiles) { this.profiles.Add(new Profile(this, profileModel, false, true)); diff --git a/Dalamud/Plugin/Internal/Profiles/ProfileModelV1.cs b/Dalamud/Plugin/Internal/Profiles/ProfileModelV1.cs index a1a327c1d..deee9c04f 100644 --- a/Dalamud/Plugin/Internal/Profiles/ProfileModelV1.cs +++ b/Dalamud/Plugin/Internal/Profiles/ProfileModelV1.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Newtonsoft.Json; @@ -63,7 +63,7 @@ public class ProfileModelV1 : ProfileModel /// /// Gets or sets the list of plugins in this profile. /// - public List Plugins { get; set; } = new(); + public List Plugins { get; set; } = []; /// /// Class representing a single plugin in a profile. diff --git a/Dalamud/Plugin/Ipc/Internal/CallGate.cs b/Dalamud/Plugin/Ipc/Internal/CallGate.cs index fef4b97d0..3f299da9d 100644 --- a/Dalamud/Plugin/Ipc/Internal/CallGate.cs +++ b/Dalamud/Plugin/Ipc/Internal/CallGate.cs @@ -9,7 +9,7 @@ namespace Dalamud.Plugin.Ipc.Internal; [ServiceManager.EarlyLoadedService] internal class CallGate : IServiceType { - private readonly Dictionary gates = new(); + private readonly Dictionary gates = []; private ImmutableDictionary? gatesCopy; diff --git a/Dalamud/Plugin/Ipc/Internal/CallGateChannel.cs b/Dalamud/Plugin/Ipc/Internal/CallGateChannel.cs index ea94103f7..a74d7959a 100644 --- a/Dalamud/Plugin/Ipc/Internal/CallGateChannel.cs +++ b/Dalamud/Plugin/Ipc/Internal/CallGateChannel.cs @@ -19,7 +19,7 @@ internal class CallGateChannel /// /// The actual storage. /// - private readonly HashSet subscriptions = new(); + private readonly HashSet subscriptions = []; /// /// A copy of the actual storage, that will be cleared and populated depending on changes made to diff --git a/Dalamud/Plugin/Ipc/Internal/DataCache.cs b/Dalamud/Plugin/Ipc/Internal/DataCache.cs index 38cea4866..d565c8b35 100644 --- a/Dalamud/Plugin/Ipc/Internal/DataCache.cs +++ b/Dalamud/Plugin/Ipc/Internal/DataCache.cs @@ -40,7 +40,7 @@ internal readonly struct DataCache { this.Tag = tag; this.CreatorAssemblyName = creatorAssemblyName; - this.UserAssemblyNames = new(); + this.UserAssemblyNames = []; this.Data = data; this.Type = type; } diff --git a/Dalamud/Plugin/Ipc/Internal/DataShare.cs b/Dalamud/Plugin/Ipc/Internal/DataShare.cs index 8ce5ddb95..becbe1211 100644 --- a/Dalamud/Plugin/Ipc/Internal/DataShare.cs +++ b/Dalamud/Plugin/Ipc/Internal/DataShare.cs @@ -19,7 +19,7 @@ internal class DataShare : IServiceType /// Dictionary of cached values. Note that is being used, as it does its own locking, /// effectively preventing calling the data generator multiple times concurrently. /// - private readonly Dictionary> caches = new(); + private readonly Dictionary> caches = []; [ServiceManager.ServiceConstructor] private DataShare() diff --git a/Dalamud/Service/ServiceManager.cs b/Dalamud/Service/ServiceManager.cs index a176179f1..ce519b834 100644 --- a/Dalamud/Service/ServiceManager.cs +++ b/Dalamud/Service/ServiceManager.cs @@ -44,7 +44,7 @@ internal static class ServiceManager internal static readonly ThreadLocal CurrentConstructorServiceType = new(); [SuppressMessage("ReSharper", "CollectionNeverQueried.Local", Justification = "Debugging purposes")] - private static readonly List LoadedServices = new(); + private static readonly List LoadedServices = []; #endif private static readonly TaskCompletionSource BlockingServicesLoadedTaskCompletionSource = diff --git a/Dalamud/Service/Service{T}.cs b/Dalamud/Service/Service{T}.cs index 32c29a2bc..b70a66331 100644 --- a/Dalamud/Service/Service{T}.cs +++ b/Dalamud/Service/Service{T}.cs @@ -286,13 +286,13 @@ internal static class Service where T : IServiceType { if (method.Invoke(instance, args) is Task task) { - tasks ??= new(); + tasks ??= []; tasks.Add(task); } } catch (Exception e) { - tasks ??= new(); + tasks ??= []; tasks.Add(Task.FromException(e)); } } diff --git a/Dalamud/Support/Troubleshooting.cs b/Dalamud/Support/Troubleshooting.cs index 4af8d5ffc..ff6fe6a3e 100644 --- a/Dalamud/Support/Troubleshooting.cs +++ b/Dalamud/Support/Troubleshooting.cs @@ -127,7 +127,7 @@ public static class Troubleshooting public bool ForcedMinHook { get; set; } - public List ThirdRepo => new(); + public List ThirdRepo => []; public bool HasThirdRepo { get; set; } } diff --git a/Dalamud/Utility/DateTimeSpanExtensions.cs b/Dalamud/Utility/DateTimeSpanExtensions.cs index 3cf8975af..d60b17924 100644 --- a/Dalamud/Utility/DateTimeSpanExtensions.cs +++ b/Dalamud/Utility/DateTimeSpanExtensions.cs @@ -100,7 +100,7 @@ public static class DateTimeSpanExtensions private sealed class ParsedRelativeFormatStrings { - private readonly List<(float MinSeconds, string FormatString)> formatStrings = new(); + private readonly List<(float MinSeconds, string FormatString)> formatStrings = []; public ParsedRelativeFormatStrings(string value) { diff --git a/Dalamud/Utility/DisposeSafety.cs b/Dalamud/Utility/DisposeSafety.cs index 64d31048f..e56f3458a 100644 --- a/Dalamud/Utility/DisposeSafety.cs +++ b/Dalamud/Utility/DisposeSafety.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Reactive.Disposables; @@ -125,7 +125,7 @@ public static class DisposeSafety } catch (Exception de) { - exceptions ??= new(); + exceptions ??= []; exceptions.Add(de); } } @@ -140,7 +140,7 @@ public static class DisposeSafety /// public class ScopedFinalizer : IDisposeCallback, IAsyncDisposable { - private readonly List objects = new(); + private readonly List objects = []; /// public event Action? BeforeDispose; @@ -338,7 +338,7 @@ public static class DisposeSafety } catch (Exception ex) { - exceptions ??= new(); + exceptions ??= []; exceptions.Add(ex); } } @@ -402,7 +402,7 @@ public static class DisposeSafety } catch (Exception ex) { - exceptions ??= new(); + exceptions ??= []; exceptions.Add(ex); } } diff --git a/Dalamud/Utility/DynamicPriorityQueueLoader.cs b/Dalamud/Utility/DynamicPriorityQueueLoader.cs index 83fd366bb..c32858bb4 100644 --- a/Dalamud/Utility/DynamicPriorityQueueLoader.cs +++ b/Dalamud/Utility/DynamicPriorityQueueLoader.cs @@ -15,7 +15,7 @@ internal class DynamicPriorityQueueLoader : IDisposable private readonly Channel newItemChannel; private readonly Channel workTokenChannel; - private readonly List workItemPending = new(); + private readonly List workItemPending = []; private bool disposing; diff --git a/Dalamud/Utility/RollingList.cs b/Dalamud/Utility/RollingList.cs index 0f1553bf9..896b74fbf 100644 --- a/Dalamud/Utility/RollingList.cs +++ b/Dalamud/Utility/RollingList.cs @@ -40,7 +40,7 @@ namespace Dalamud.Utility { ThrowHelper.ThrowArgumentOutOfRangeExceptionIfLessThan(nameof(size), size, 0); this.size = size; - this.items = new(); + this.items = []; } /// Initializes a new instance of the class. diff --git a/Dalamud/Utility/Timing/Timings.cs b/Dalamud/Utility/Timing/Timings.cs index e2c00461c..a59a3557f 100644 --- a/Dalamud/Utility/Timing/Timings.cs +++ b/Dalamud/Utility/Timing/Timings.cs @@ -19,12 +19,12 @@ public static class Timings /// /// All concluded timings. /// - internal static readonly SortedList AllTimings = new(); + internal static readonly SortedList AllTimings = []; /// /// List of all timing events. /// - internal static readonly List Events = new(); + internal static readonly List Events = []; private static readonly AsyncLocal>> TaskTimingHandleStorage = new(); @@ -36,7 +36,7 @@ public static class Timings get { if (TaskTimingHandleStorage.Value == null || TaskTimingHandleStorage.Value.Item1 != Task.CurrentId) - TaskTimingHandleStorage.Value = Tuple.Create>(Task.CurrentId, new()); + TaskTimingHandleStorage.Value = Tuple.Create>(Task.CurrentId, []); return TaskTimingHandleStorage.Value!.Item2!; } set => TaskTimingHandleStorage.Value = Tuple.Create(Task.CurrentId, value); diff --git a/Dalamud/Utility/WeakConcurrentCollection.cs b/Dalamud/Utility/WeakConcurrentCollection.cs index a3bc04651..c23ebac9a 100644 --- a/Dalamud/Utility/WeakConcurrentCollection.cs +++ b/Dalamud/Utility/WeakConcurrentCollection.cs @@ -1,4 +1,4 @@ -using System.Collections; +using System.Collections; using System.Collections.Generic; using System.Linq; using System.Runtime.CompilerServices; @@ -11,7 +11,7 @@ namespace Dalamud.Utility; /// The type of object that we're tracking. public class WeakConcurrentCollection : ICollection where T : class { - private readonly ConditionalWeakTable cwt = new(); + private readonly ConditionalWeakTable cwt = []; /// public int Count => this.cwt.Count();