Merge branch 'master' into ImRaii-Widgets

This commit is contained in:
goat 2026-01-09 21:42:43 +01:00 committed by GitHub
commit 156abbdcbe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
300 changed files with 1060 additions and 1068 deletions

View file

@ -10,7 +10,6 @@ using System.Threading.Tasks;
using Dalamud.Game.Text; using Dalamud.Game.Text;
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.FontIdentifier; using Dalamud.Interface.FontIdentifier;
using Dalamud.Interface.ImGuiNotification.Internal;
using Dalamud.Interface.Internal; using Dalamud.Interface.Internal;
using Dalamud.Interface.Internal.ReShadeHandling; using Dalamud.Interface.Internal.ReShadeHandling;
using Dalamud.Interface.Style; using Dalamud.Interface.Style;
@ -20,9 +19,12 @@ using Dalamud.Plugin.Internal.AutoUpdate;
using Dalamud.Plugin.Internal.Profiles; using Dalamud.Plugin.Internal.Profiles;
using Dalamud.Storage; using Dalamud.Storage;
using Dalamud.Utility; using Dalamud.Utility;
using Newtonsoft.Json; using Newtonsoft.Json;
using Serilog; using Serilog;
using Serilog.Events; using Serilog.Events;
using Windows.Win32.UI.WindowsAndMessaging; using Windows.Win32.UI.WindowsAndMessaging;
namespace Dalamud.Configuration.Internal; namespace Dalamud.Configuration.Internal;
@ -91,7 +93,7 @@ internal sealed class DalamudConfiguration : IInternalDisposableService
/// <summary> /// <summary>
/// Gets or sets a dictionary of seen FTUE levels. /// Gets or sets a dictionary of seen FTUE levels.
/// </summary> /// </summary>
public Dictionary<string, int> SeenFtueLevels { get; set; } = new(); public Dictionary<string, int> SeenFtueLevels { get; set; } = [];
/// <summary> /// <summary>
/// Gets or sets the last loaded Dalamud version. /// Gets or sets the last loaded Dalamud version.
@ -111,7 +113,7 @@ internal sealed class DalamudConfiguration : IInternalDisposableService
/// <summary> /// <summary>
/// Gets or sets a list of custom repos. /// Gets or sets a list of custom repos.
/// </summary> /// </summary>
public List<ThirdPartyRepoSettings> ThirdRepoList { get; set; } = new(); public List<ThirdPartyRepoSettings> ThirdRepoList { get; set; } = [];
/// <summary> /// <summary>
/// Gets or sets a value indicating whether a disclaimer regarding third-party repos has been dismissed. /// Gets or sets a value indicating whether a disclaimer regarding third-party repos has been dismissed.
@ -121,12 +123,12 @@ internal sealed class DalamudConfiguration : IInternalDisposableService
/// <summary> /// <summary>
/// Gets or sets a list of hidden plugins. /// Gets or sets a list of hidden plugins.
/// </summary> /// </summary>
public List<string> HiddenPluginInternalName { get; set; } = new(); public List<string> HiddenPluginInternalName { get; set; } = [];
/// <summary> /// <summary>
/// Gets or sets a list of seen plugins. /// Gets or sets a list of seen plugins.
/// </summary> /// </summary>
public List<string> SeenPluginInternalName { get; set; } = new(); public List<string> SeenPluginInternalName { get; set; } = [];
/// <summary> /// <summary>
/// Gets or sets a list of additional settings for devPlugins. The key is the absolute path /// Gets or sets a list of additional settings for devPlugins. The key is the absolute path
@ -134,14 +136,14 @@ internal sealed class DalamudConfiguration : IInternalDisposableService
/// However by specifiying this value manually, you can add arbitrary files outside the normal /// However by specifiying this value manually, you can add arbitrary files outside the normal
/// file paths. /// file paths.
/// </summary> /// </summary>
public Dictionary<string, DevPluginSettings> DevPluginSettings { get; set; } = new(); public Dictionary<string, DevPluginSettings> DevPluginSettings { get; set; } = [];
/// <summary> /// <summary>
/// Gets or sets a list of additional locations that dev plugins should be loaded from. This can /// 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 /// be either a DLL or folder, but should be the absolute path, or a path relative to the currently
/// injected Dalamud instance. /// injected Dalamud instance.
/// </summary> /// </summary>
public List<DevPluginLocationSettings> DevPluginLoadLocations { get; set; } = new(); public List<DevPluginLocationSettings> DevPluginLoadLocations { get; set; } = [];
/// <summary> /// <summary>
/// Gets or sets the global UI scale. /// Gets or sets the global UI scale.
@ -223,7 +225,7 @@ internal sealed class DalamudConfiguration : IInternalDisposableService
/// <summary> /// <summary>
/// Gets or sets a list representing the command history for the Dalamud Console. /// Gets or sets a list representing the command history for the Dalamud Console.
/// </summary> /// </summary>
public List<string> LogCommandHistory { get; set; } = new(); public List<string> LogCommandHistory { get; set; } = [];
/// <summary> /// <summary>
/// Gets or sets a value indicating whether the dev bar should open at startup. /// Gets or sets a value indicating whether the dev bar should open at startup.
@ -599,7 +601,7 @@ internal sealed class DalamudConfiguration : IInternalDisposableService
{ {
// https://source.chromium.org/chromium/chromium/src/+/main:ui/gfx/animation/animation_win.cc;l=29?q=ReducedMotion&ss=chromium // https://source.chromium.org/chromium/chromium/src/+/main:ui/gfx/animation/animation_win.cc;l=29?q=ReducedMotion&ss=chromium
var winAnimEnabled = 0; var winAnimEnabled = 0;
var success = false; bool success;
unsafe unsafe
{ {
success = Windows.Win32.PInvoke.SystemParametersInfo( success = Windows.Win32.PInvoke.SystemParametersInfo(

View file

@ -31,5 +31,5 @@ internal sealed class DevPluginSettings
/// <summary> /// <summary>
/// Gets or sets a list of validation problems that have been dismissed by the user. /// Gets or sets a list of validation problems that have been dismissed by the user.
/// </summary> /// </summary>
public List<string> DismissedValidationProblems { get; set; } = new(); public List<string> DismissedValidationProblems { get; set; } = [];
} }

View file

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@ -17,9 +17,9 @@ namespace Dalamud.Console;
[ServiceManager.BlockingEarlyLoadedService("Console is needed by other blocking early loaded services.")] [ServiceManager.BlockingEarlyLoadedService("Console is needed by other blocking early loaded services.")]
internal partial class ConsoleManager : IServiceType internal partial class ConsoleManager : IServiceType
{ {
private static readonly ModuleLog Log = new("CON"); private static readonly ModuleLog Log = ModuleLog.Create<ConsoleManager>();
private Dictionary<string, IConsoleEntry> entries = new(); private Dictionary<string, IConsoleEntry> entries = [];
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="ConsoleManager"/> class. /// Initializes a new instance of the <see cref="ConsoleManager"/> class.
@ -99,10 +99,7 @@ internal partial class ConsoleManager : IServiceType
ArgumentNullException.ThrowIfNull(name); ArgumentNullException.ThrowIfNull(name);
ArgumentNullException.ThrowIfNull(alias); ArgumentNullException.ThrowIfNull(alias);
var target = this.FindEntry(name); var target = this.FindEntry(name) ?? throw new EntryNotFoundException(name);
if (target == null)
throw new EntryNotFoundException(name);
if (this.FindEntry(alias) != null) if (this.FindEntry(alias) != null)
throw new InvalidOperationException($"Entry '{alias}' already exists."); throw new InvalidOperationException($"Entry '{alias}' already exists.");
@ -346,7 +343,7 @@ internal partial class ConsoleManager : IServiceType
private static class Traits private static class Traits
{ {
public static void ThrowIfTIsNullableAndNull<T>(T? argument, [CallerArgumentExpression("argument")] string? paramName = null) public static void ThrowIfTIsNullableAndNull<T>(T? argument, [CallerArgumentExpression(nameof(argument))] string? paramName = null)
{ {
if (argument == null && !typeof(T).IsValueType) if (argument == null && !typeof(T).IsValueType)
throw new ArgumentNullException(paramName); throw new ArgumentNullException(paramName);

View file

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@ -65,7 +65,7 @@ internal class ConsoleManagerPluginScoped : IConsole, IInternalDisposableService
[ServiceManager.ServiceDependency] [ServiceManager.ServiceDependency]
private readonly ConsoleManager console = Service<ConsoleManager>.Get(); private readonly ConsoleManager console = Service<ConsoleManager>.Get();
private readonly List<IConsoleEntry> trackedEntries = new(); private readonly List<IConsoleEntry> trackedEntries = [];
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="ConsoleManagerPluginScoped"/> class. /// Initializes a new instance of the <see cref="ConsoleManagerPluginScoped"/> class.

View file

@ -14,7 +14,9 @@ using Dalamud.Plugin.Internal;
using Dalamud.Storage; using Dalamud.Storage;
using Dalamud.Utility; using Dalamud.Utility;
using Dalamud.Utility.Timing; using Dalamud.Utility.Timing;
using Serilog; using Serilog;
using Windows.Win32.Foundation; using Windows.Win32.Foundation;
using Windows.Win32.Security; using Windows.Win32.Security;

View file

@ -8,11 +8,13 @@ using Dalamud.IoC.Internal;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Dalamud.Utility; using Dalamud.Utility;
using Dalamud.Utility.Timing; using Dalamud.Utility.Timing;
using Lumina; using Lumina;
using Lumina.Data; using Lumina.Data;
using Lumina.Excel; using Lumina.Excel;
using Newtonsoft.Json; using Newtonsoft.Json;
using Serilog; using Serilog;
namespace Dalamud.Data; namespace Dalamud.Data;

View file

@ -3,7 +3,9 @@ using System.Collections.Generic;
using Dalamud.Hooking; using Dalamud.Hooking;
using Dalamud.Logging.Internal; using Dalamud.Logging.Internal;
using Dalamud.Memory; using Dalamud.Memory;
using FFXIVClientStructs.FFXIV.Client.LayoutEngine; using FFXIVClientStructs.FFXIV.Client.LayoutEngine;
using Lumina.Text.ReadOnly; using Lumina.Text.ReadOnly;
namespace Dalamud.Data; namespace Dalamud.Data;
@ -13,7 +15,7 @@ namespace Dalamud.Data;
/// </summary> /// </summary>
internal sealed unsafe class RsvResolver : IDisposable internal sealed unsafe class RsvResolver : IDisposable
{ {
private static readonly ModuleLog Log = new("RsvProvider"); private static readonly ModuleLog Log = ModuleLog.Create<RsvResolver>();
private readonly Hook<LayoutWorld.Delegates.AddRsvString> addRsvStringHook; private readonly Hook<LayoutWorld.Delegates.AddRsvString> addRsvStringHook;

View file

@ -1,8 +1,6 @@
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Net;
using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -16,10 +14,13 @@ using Dalamud.Plugin.Internal;
using Dalamud.Storage; using Dalamud.Storage;
using Dalamud.Support; using Dalamud.Support;
using Dalamud.Utility; using Dalamud.Utility;
using Newtonsoft.Json; using Newtonsoft.Json;
using Serilog; using Serilog;
using Serilog.Core; using Serilog.Core;
using Serilog.Events; using Serilog.Events;
using Windows.Win32.Foundation; using Windows.Win32.Foundation;
using Windows.Win32.UI.WindowsAndMessaging; using Windows.Win32.UI.WindowsAndMessaging;

View file

@ -1,5 +1,4 @@
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;

View file

@ -24,7 +24,7 @@ internal unsafe class AddonEventManager : IInternalDisposableService
/// </summary> /// </summary>
public static readonly Guid DalamudInternalKey = Guid.NewGuid(); public static readonly Guid DalamudInternalKey = Guid.NewGuid();
private static readonly ModuleLog Log = new("AddonEventManager"); private static readonly ModuleLog Log = ModuleLog.Create<AddonEventManager>();
[ServiceManager.ServiceDependency] [ServiceManager.ServiceDependency]
private readonly AddonLifecycle addonLifecycle = Service<AddonLifecycle>.Get(); private readonly AddonLifecycle addonLifecycle = Service<AddonLifecycle>.Get();

View file

@ -61,6 +61,11 @@ public enum AddonEventType : byte
/// </summary> /// </summary>
InputBaseInputReceived = 15, InputBaseInputReceived = 15,
/// <summary>
/// Fired at the very beginning of AtkInputManager.HandleInput on AtkStage.ViewportEventManager. Used in LovmMiniMap.
/// </summary>
RawInputData = 16,
/// <summary> /// <summary>
/// Focus Start. /// Focus Start.
/// </summary> /// </summary>
@ -107,7 +112,12 @@ public enum AddonEventType : byte
SliderReleased = 30, SliderReleased = 30,
/// <summary> /// <summary>
/// AtkComponentList RollOver. /// AtkComponentList Button Press.
/// </summary>
ListButtonPress = 31,
/// <summary>
/// AtkComponentList Roll Over.
/// </summary> /// </summary>
ListItemRollOver = 33, ListItemRollOver = 33,
@ -126,11 +136,31 @@ public enum AddonEventType : byte
/// </summary> /// </summary>
ListItemDoubleClick = 36, ListItemDoubleClick = 36,
/// <summary>
/// AtkComponentList Highlight.
/// </summary>
ListItemHighlight = 37,
/// <summary> /// <summary>
/// AtkComponentList Select. /// AtkComponentList Select.
/// </summary> /// </summary>
ListItemSelect = 38, ListItemSelect = 38,
/// <summary>
/// AtkComponentList Pad Drag Drop Begin.
/// </summary>
ListItemPadDragDropBegin = 40,
/// <summary>
/// AtkComponentList Pad Drag Drop End.
/// </summary>
ListItemPadDragDropEnd = 41,
/// <summary>
/// AtkComponentList Pad Drag Drop Insert.
/// </summary>
ListItemPadDragDropInsert = 42,
/// <summary> /// <summary>
/// AtkComponentDragDrop Begin. /// AtkComponentDragDrop Begin.
/// Sent on MouseDown over a draggable icon (will NOT send for a locked icon). /// Sent on MouseDown over a draggable icon (will NOT send for a locked icon).
@ -142,12 +172,22 @@ public enum AddonEventType : byte
/// </summary> /// </summary>
DragDropEnd = 51, DragDropEnd = 51,
/// <summary>
/// AtkComponentDragDrop Insert Attempt.
/// </summary>
DragDropInsertAttempt = 52,
/// <summary> /// <summary>
/// AtkComponentDragDrop Insert. /// AtkComponentDragDrop Insert.
/// Sent when dropping an icon into a hotbar/inventory slot or similar. /// Sent when dropping an icon into a hotbar/inventory slot or similar.
/// </summary> /// </summary>
DragDropInsert = 53, DragDropInsert = 53,
/// <summary>
/// AtkComponentDragDrop Can Accept Check.
/// </summary>
DragDropCanAcceptCheck = 54,
/// <summary> /// <summary>
/// AtkComponentDragDrop Roll Over. /// AtkComponentDragDrop Roll Over.
/// </summary> /// </summary>
@ -165,23 +205,18 @@ public enum AddonEventType : byte
DragDropDiscard = 57, DragDropDiscard = 57,
/// <summary> /// <summary>
/// Drag Drop Unknown. /// AtkComponentDragDrop Click.
/// Sent on MouseUp if the cursor has not moved since DragDropBegin, OR on MouseDown over a locked icon.
/// </summary> /// </summary>
[Obsolete("Use DragDropDiscard", true)] DragDropClick = 58,
DragDropUnk54 = 54,
/// <summary> /// <summary>
/// AtkComponentDragDrop Cancel. /// AtkComponentDragDrop Cancel.
/// Sent on MouseUp if the cursor has not moved since DragDropBegin, OR on MouseDown over a locked icon. /// Sent on MouseUp if the cursor has not moved since DragDropBegin, OR on MouseDown over a locked icon.
/// </summary> /// </summary>
[Obsolete("Renamed to DragDropClick")]
DragDropCancel = 58, DragDropCancel = 58,
/// <summary>
/// Drag Drop Unknown.
/// </summary>
[Obsolete("Use DragDropCancel", true)]
DragDropUnk55 = 55,
/// <summary> /// <summary>
/// AtkComponentIconText Roll Over. /// AtkComponentIconText Roll Over.
/// </summary> /// </summary>
@ -217,6 +252,11 @@ public enum AddonEventType : byte
/// </summary> /// </summary>
TimerEnd = 65, TimerEnd = 65,
/// <summary>
/// AtkTimer Start.
/// </summary>
TimerStart = 66,
/// <summary> /// <summary>
/// AtkSimpleTween Progress. /// AtkSimpleTween Progress.
/// </summary> /// </summary>
@ -247,6 +287,11 @@ public enum AddonEventType : byte
/// </summary> /// </summary>
WindowChangeScale = 72, WindowChangeScale = 72,
/// <summary>
/// AtkTimeline Active Label Changed.
/// </summary>
TimelineActiveLabelChanged = 75,
/// <summary> /// <summary>
/// AtkTextNode Link Mouse Click. /// AtkTextNode Link Mouse Click.
/// </summary> /// </summary>

View file

@ -5,7 +5,6 @@ using Dalamud.Game.Addon.Events.EventDataTypes;
using Dalamud.Game.Gui; using Dalamud.Game.Gui;
using Dalamud.Logging.Internal; using Dalamud.Logging.Internal;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
@ -16,7 +15,7 @@ namespace Dalamud.Game.Addon.Events;
/// </summary> /// </summary>
internal unsafe class PluginEventController : IDisposable internal unsafe class PluginEventController : IDisposable
{ {
private static readonly ModuleLog Log = new("AddonEventManager"); private static readonly ModuleLog Log = ModuleLog.Create<AddonEventManager>();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="PluginEventController"/> class. /// Initializes a new instance of the <see cref="PluginEventController"/> class.
@ -28,7 +27,7 @@ internal unsafe class PluginEventController : IDisposable
private AddonEventListener EventListener { get; init; } private AddonEventListener EventListener { get; init; }
private List<AddonEventEntry> Events { get; } = new(); private List<AddonEventEntry> Events { get; } = [];
/// <summary> /// <summary>
/// Adds a tracked event. /// Adds a tracked event.

View file

@ -25,7 +25,7 @@ internal unsafe class AddonLifecycle : IInternalDisposableService
/// </summary> /// </summary>
public static readonly List<AddonVirtualTable> AllocatedTables = []; public static readonly List<AddonVirtualTable> AllocatedTables = [];
private static readonly ModuleLog Log = new("AddonLifecycle"); private static readonly ModuleLog Log = ModuleLog.Create<AddonLifecycle>();
private Hook<AtkUnitBase.Delegates.Initialize>? onInitializeAddonHook; private Hook<AtkUnitBase.Delegates.Initialize>? onInitializeAddonHook;

View file

@ -14,7 +14,7 @@ public abstract class BaseAddressResolver
/// <summary> /// <summary>
/// Gets a list of memory addresses that were found, to list in /xldata. /// Gets a list of memory addresses that were found, to list in /xldata.
/// </summary> /// </summary>
public static Dictionary<string, List<(string ClassName, IntPtr Address)>> DebugScannedValues { get; } = new(); public static Dictionary<string, List<(string ClassName, IntPtr Address)>> DebugScannedValues { get; } = [];
/// <summary> /// <summary>
/// Gets or sets a value indicating whether the resolver has successfully run <see cref="Setup32Bit(ISigScanner)"/> or <see cref="Setup64Bit(ISigScanner)"/>. /// Gets or sets a value indicating whether the resolver has successfully run <see cref="Setup32Bit(ISigScanner)"/> or <see cref="Setup64Bit(ISigScanner)"/>.

View file

@ -1,5 +1,4 @@
using System.Linq; using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using CheapLoc; using CheapLoc;
@ -23,7 +22,7 @@ namespace Dalamud.Game;
[ServiceManager.EarlyLoadedService] [ServiceManager.EarlyLoadedService]
internal partial class ChatHandlers : IServiceType internal partial class ChatHandlers : IServiceType
{ {
private static readonly ModuleLog Log = new("ChatHandlers"); private static readonly ModuleLog Log = ModuleLog.Create<ChatHandlers>();
[ServiceManager.ServiceDependency] [ServiceManager.ServiceDependency]
private readonly DalamudConfiguration configuration = Service<DalamudConfiguration>.Get(); private readonly DalamudConfiguration configuration = Service<DalamudConfiguration>.Get();

View file

@ -8,6 +8,7 @@ using Dalamud.Plugin.Services;
using Dalamud.Utility; using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Client.Game.UI; using FFXIVClientStructs.FFXIV.Client.Game.UI;
using Serilog; using Serilog;
namespace Dalamud.Game.ClientState.Aetherytes; namespace Dalamud.Game.ClientState.Aetherytes;

View file

@ -33,7 +33,7 @@ namespace Dalamud.Game.ClientState;
[ServiceManager.EarlyLoadedService] [ServiceManager.EarlyLoadedService]
internal sealed class ClientState : IInternalDisposableService, IClientState internal sealed class ClientState : IInternalDisposableService, IClientState
{ {
private static readonly ModuleLog Log = new("ClientState"); private static readonly ModuleLog Log = ModuleLog.Create<ClientState>();
private readonly GameLifecycle lifecycle; private readonly GameLifecycle lifecycle;
private readonly ClientStateAddressResolver address; private readonly ClientStateAddressResolver address;

View file

@ -5,7 +5,9 @@ using Dalamud.Hooking;
using Dalamud.IoC; using Dalamud.IoC;
using Dalamud.IoC.Internal; using Dalamud.IoC.Internal;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Client.System.Input; using FFXIVClientStructs.FFXIV.Client.System.Input;
using Serilog; using Serilog;
namespace Dalamud.Game.ClientState.GamePad; namespace Dalamud.Game.ClientState.GamePad;

View file

@ -37,7 +37,7 @@ internal class JobGauges : IServiceType, IJobGauges
// Since the gauge itself reads from live memory, there isn't much downside to doing this. // Since the gauge itself reads from live memory, there isn't much downside to doing this.
if (!this.cache.TryGetValue(typeof(T), out var gauge)) if (!this.cache.TryGetValue(typeof(T), out var gauge))
{ {
gauge = this.cache[typeof(T)] = (T)Activator.CreateInstance(typeof(T), BindingFlags.NonPublic | BindingFlags.Instance, null, new object[] { this.Address }, null); gauge = this.cache[typeof(T)] = (T)Activator.CreateInstance(typeof(T), BindingFlags.NonPublic | BindingFlags.Instance, null, [this.Address], null);
} }
return (T)gauge; return (T)gauge;

View file

@ -1,4 +1,5 @@
using Dalamud.Game.ClientState.JobGauge.Enums; using Dalamud.Game.ClientState.JobGauge.Enums;
using FFXIVClientStructs.FFXIV.Client.Game.Gauge; using FFXIVClientStructs.FFXIV.Client.Game.Gauge;
namespace Dalamud.Game.ClientState.JobGauge.Types; namespace Dalamud.Game.ClientState.JobGauge.Types;
@ -82,12 +83,12 @@ public unsafe class BRDGauge : JobGaugeBase<FFXIVClientStructs.FFXIV.Client.Game
{ {
get get
{ {
return new[] return
{ [
this.Struct->SongFlags.HasFlag(SongFlags.MagesBalladCoda) ? Song.Mage : Song.None, this.Struct->SongFlags.HasFlag(SongFlags.MagesBalladCoda) ? Song.Mage : Song.None,
this.Struct->SongFlags.HasFlag(SongFlags.ArmysPaeonCoda) ? Song.Army : Song.None, this.Struct->SongFlags.HasFlag(SongFlags.ArmysPaeonCoda) ? Song.Army : Song.None,
this.Struct->SongFlags.HasFlag(SongFlags.WanderersMinuetCoda) ? Song.Wanderer : Song.None, this.Struct->SongFlags.HasFlag(SongFlags.WanderersMinuetCoda) ? Song.Wanderer : Song.None,
}; ];
} }
} }
} }

View file

@ -1,4 +1,5 @@
using Dalamud.Game.ClientState.JobGauge.Enums; using Dalamud.Game.ClientState.JobGauge.Enums;
using FFXIVClientStructs.FFXIV.Client.Game.Gauge; using FFXIVClientStructs.FFXIV.Client.Game.Gauge;
namespace Dalamud.Game.ClientState.JobGauge.Types; namespace Dalamud.Game.ClientState.JobGauge.Types;

View file

@ -1,4 +1,4 @@
using FFXIVClientStructs.FFXIV.Client.Game.Gauge; using FFXIVClientStructs.FFXIV.Client.Game.Gauge;
using CanvasFlags = Dalamud.Game.ClientState.JobGauge.Enums.CanvasFlags; using CanvasFlags = Dalamud.Game.ClientState.JobGauge.Enums.CanvasFlags;
using CreatureFlags = Dalamud.Game.ClientState.JobGauge.Enums.CreatureFlags; using CreatureFlags = Dalamud.Game.ClientState.JobGauge.Enums.CreatureFlags;
@ -22,45 +22,45 @@ public unsafe class PCTGauge : JobGaugeBase<PictomancerGauge>
/// <summary> /// <summary>
/// Gets the use of subjective pallete. /// Gets the use of subjective pallete.
/// </summary> /// </summary>
public byte PalleteGauge => Struct->PalleteGauge; public byte PalleteGauge => this.Struct->PalleteGauge;
/// <summary> /// <summary>
/// Gets the amount of paint the player has. /// Gets the amount of paint the player has.
/// </summary> /// </summary>
public byte Paint => Struct->Paint; public byte Paint => this.Struct->Paint;
/// <summary> /// <summary>
/// Gets a value indicating whether a creature motif is drawn. /// Gets a value indicating whether a creature motif is drawn.
/// </summary> /// </summary>
public bool CreatureMotifDrawn => Struct->CreatureMotifDrawn; public bool CreatureMotifDrawn => this.Struct->CreatureMotifDrawn;
/// <summary> /// <summary>
/// Gets a value indicating whether a weapon motif is drawn. /// Gets a value indicating whether a weapon motif is drawn.
/// </summary> /// </summary>
public bool WeaponMotifDrawn => Struct->WeaponMotifDrawn; public bool WeaponMotifDrawn => this.Struct->WeaponMotifDrawn;
/// <summary> /// <summary>
/// Gets a value indicating whether a landscape motif is drawn. /// Gets a value indicating whether a landscape motif is drawn.
/// </summary> /// </summary>
public bool LandscapeMotifDrawn => Struct->LandscapeMotifDrawn; public bool LandscapeMotifDrawn => this.Struct->LandscapeMotifDrawn;
/// <summary> /// <summary>
/// Gets a value indicating whether a moogle portrait is ready. /// Gets a value indicating whether a moogle portrait is ready.
/// </summary> /// </summary>
public bool MooglePortraitReady => Struct->MooglePortraitReady; public bool MooglePortraitReady => this.Struct->MooglePortraitReady;
/// <summary> /// <summary>
/// Gets a value indicating whether a madeen portrait is ready. /// Gets a value indicating whether a madeen portrait is ready.
/// </summary> /// </summary>
public bool MadeenPortraitReady => Struct->MadeenPortraitReady; public bool MadeenPortraitReady => this.Struct->MadeenPortraitReady;
/// <summary> /// <summary>
/// Gets which creature flags are present. /// Gets which creature flags are present.
/// </summary> /// </summary>
public CreatureFlags CreatureFlags => (CreatureFlags)Struct->CreatureFlags; public CreatureFlags CreatureFlags => (CreatureFlags)this.Struct->CreatureFlags;
/// <summary> /// <summary>
/// Gets which canvas flags are present. /// Gets which canvas flags are present.
/// </summary> /// </summary>
public CanvasFlags CanvasFlags => (CanvasFlags)Struct->CanvasFlags; public CanvasFlags CanvasFlags => (CanvasFlags)this.Struct->CanvasFlags;
} }

View file

@ -1,4 +1,5 @@
using Dalamud.Game.ClientState.JobGauge.Enums; using Dalamud.Game.ClientState.JobGauge.Enums;
using FFXIVClientStructs.FFXIV.Client.Game.Gauge; using FFXIVClientStructs.FFXIV.Client.Game.Gauge;
namespace Dalamud.Game.ClientState.JobGauge.Types; namespace Dalamud.Game.ClientState.JobGauge.Types;

View file

@ -1,7 +1,5 @@
using FFXIVClientStructs.FFXIV.Client.Game.Gauge; using FFXIVClientStructs.FFXIV.Client.Game.Gauge;
using Reloaded.Memory;
using DreadCombo = Dalamud.Game.ClientState.JobGauge.Enums.DreadCombo; using DreadCombo = Dalamud.Game.ClientState.JobGauge.Enums.DreadCombo;
using SerpentCombo = Dalamud.Game.ClientState.JobGauge.Enums.SerpentCombo; using SerpentCombo = Dalamud.Game.ClientState.JobGauge.Enums.SerpentCombo;
@ -24,25 +22,25 @@ public unsafe class VPRGauge : JobGaugeBase<ViperGauge>
/// <summary> /// <summary>
/// Gets how many uses of uncoiled fury the player has. /// Gets how many uses of uncoiled fury the player has.
/// </summary> /// </summary>
public byte RattlingCoilStacks => Struct->RattlingCoilStacks; public byte RattlingCoilStacks => this.Struct->RattlingCoilStacks;
/// <summary> /// <summary>
/// Gets Serpent Offering stacks and gauge. /// Gets Serpent Offering stacks and gauge.
/// </summary> /// </summary>
public byte SerpentOffering => Struct->SerpentOffering; public byte SerpentOffering => this.Struct->SerpentOffering;
/// <summary> /// <summary>
/// Gets value indicating the use of 1st, 2nd, 3rd, 4th generation and Ouroboros. /// Gets value indicating the use of 1st, 2nd, 3rd, 4th generation and Ouroboros.
/// </summary> /// </summary>
public byte AnguineTribute => Struct->AnguineTribute; public byte AnguineTribute => this.Struct->AnguineTribute;
/// <summary> /// <summary>
/// Gets the last Weaponskill used in DreadWinder/Pit of Dread combo. /// Gets the last Weaponskill used in DreadWinder/Pit of Dread combo.
/// </summary> /// </summary>
public DreadCombo DreadCombo => (DreadCombo)Struct->DreadCombo; public DreadCombo DreadCombo => (DreadCombo)this.Struct->DreadCombo;
/// <summary> /// <summary>
/// Gets current ability for Serpent's Tail. /// Gets current ability for Serpent's Tail.
/// </summary> /// </summary>
public SerpentCombo SerpentCombo => (SerpentCombo)Struct->SerpentCombo; public SerpentCombo SerpentCombo => (SerpentCombo)this.Struct->SerpentCombo;
} }

View file

@ -30,50 +30,50 @@ internal sealed unsafe class TargetManager : IServiceType, ITargetManager
/// <inheritdoc/> /// <inheritdoc/>
public IGameObject? Target public IGameObject? Target
{ {
get => this.objectTable.CreateObjectReference((IntPtr)Struct->GetHardTarget()); get => this.objectTable.CreateObjectReference((IntPtr)this.Struct->GetHardTarget());
set => Struct->SetHardTarget((FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)value?.Address); set => this.Struct->SetHardTarget((FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)value?.Address);
} }
/// <inheritdoc/> /// <inheritdoc/>
public IGameObject? MouseOverTarget public IGameObject? MouseOverTarget
{ {
get => this.objectTable.CreateObjectReference((IntPtr)Struct->MouseOverTarget); get => this.objectTable.CreateObjectReference((IntPtr)this.Struct->MouseOverTarget);
set => Struct->MouseOverTarget = (FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)value?.Address; set => this.Struct->MouseOverTarget = (FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)value?.Address;
} }
/// <inheritdoc/> /// <inheritdoc/>
public IGameObject? FocusTarget public IGameObject? FocusTarget
{ {
get => this.objectTable.CreateObjectReference((IntPtr)Struct->FocusTarget); get => this.objectTable.CreateObjectReference((IntPtr)this.Struct->FocusTarget);
set => Struct->FocusTarget = (FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)value?.Address; set => this.Struct->FocusTarget = (FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)value?.Address;
} }
/// <inheritdoc/> /// <inheritdoc/>
public IGameObject? PreviousTarget public IGameObject? PreviousTarget
{ {
get => this.objectTable.CreateObjectReference((IntPtr)Struct->PreviousTarget); get => this.objectTable.CreateObjectReference((IntPtr)this.Struct->PreviousTarget);
set => Struct->PreviousTarget = (FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)value?.Address; set => this.Struct->PreviousTarget = (FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)value?.Address;
} }
/// <inheritdoc/> /// <inheritdoc/>
public IGameObject? SoftTarget public IGameObject? SoftTarget
{ {
get => this.objectTable.CreateObjectReference((IntPtr)Struct->GetSoftTarget()); get => this.objectTable.CreateObjectReference((IntPtr)this.Struct->GetSoftTarget());
set => Struct->SetSoftTarget((FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)value?.Address); set => this.Struct->SetSoftTarget((FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)value?.Address);
} }
/// <inheritdoc/> /// <inheritdoc/>
public IGameObject? GPoseTarget public IGameObject? GPoseTarget
{ {
get => this.objectTable.CreateObjectReference((IntPtr)Struct->GPoseTarget); get => this.objectTable.CreateObjectReference((IntPtr)this.Struct->GPoseTarget);
set => Struct->GPoseTarget = (FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)value?.Address; set => this.Struct->GPoseTarget = (FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)value?.Address;
} }
/// <inheritdoc/> /// <inheritdoc/>
public IGameObject? MouseOverNameplateTarget public IGameObject? MouseOverNameplateTarget
{ {
get => this.objectTable.CreateObjectReference((IntPtr)Struct->MouseOverNameplateTarget); get => this.objectTable.CreateObjectReference((IntPtr)this.Struct->MouseOverNameplateTarget);
set => Struct->MouseOverNameplateTarget = (FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)value?.Address; set => this.Struct->MouseOverNameplateTarget = (FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)value?.Address;
} }
private TargetSystem* Struct => TargetSystem.Instance(); private TargetSystem* Struct => TargetSystem.Instance();

View file

@ -1,5 +1,4 @@
using Dalamud.Game.ClientState.Statuses; using Dalamud.Game.ClientState.Statuses;
using Dalamud.Utility;
namespace Dalamud.Game.ClientState.Objects.Types; namespace Dalamud.Game.ClientState.Objects.Types;

View file

@ -1,9 +1,6 @@
using System.Runtime.CompilerServices;
using Dalamud.Data; using Dalamud.Data;
using Dalamud.Game.ClientState.Objects.Enums; using Dalamud.Game.ClientState.Objects.Enums;
using Dalamud.Game.Text.SeStringHandling; using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Memory;
using Lumina.Excel; using Lumina.Excel;
using Lumina.Excel.Sheets; using Lumina.Excel.Sheets;

View file

@ -47,7 +47,7 @@ internal sealed unsafe partial class PartyList : IServiceType, IPartyList
public unsafe nint GroupManagerAddress => (nint)CSGroupManager.Instance(); public unsafe nint GroupManagerAddress => (nint)CSGroupManager.Instance();
/// <inheritdoc/> /// <inheritdoc/>
public nint GroupListAddress => (nint)Unsafe.AsPointer(ref GroupManagerStruct->MainGroup.PartyMembers[0]); public nint GroupListAddress => (nint)Unsafe.AsPointer(ref this.GroupManagerStruct->MainGroup.PartyMembers[0]);
/// <inheritdoc/> /// <inheritdoc/>
public nint AllianceListAddress => (nint)Unsafe.AsPointer(ref this.GroupManagerStruct->MainGroup.AllianceMembers[0]); public nint AllianceListAddress => (nint)Unsafe.AsPointer(ref this.GroupManagerStruct->MainGroup.AllianceMembers[0]);

View file

@ -6,6 +6,7 @@ using Dalamud.Game.ClientState.Objects;
using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Game.ClientState.Statuses; using Dalamud.Game.ClientState.Statuses;
using Dalamud.Game.Text.SeStringHandling; using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Utility; using Dalamud.Utility;
using Lumina.Excel; using Lumina.Excel;

View file

@ -38,7 +38,7 @@ public sealed unsafe partial class StatusList
/// <summary> /// <summary>
/// Gets the amount of status effect slots the actor has. /// Gets the amount of status effect slots the actor has.
/// </summary> /// </summary>
public int Length => Struct->NumValidStatuses; public int Length => this.Struct->NumValidStatuses;
private static int StatusSize { get; } = Marshal.SizeOf<FFXIVClientStructs.FFXIV.Client.Game.Status>(); private static int StatusSize { get; } = Marshal.SizeOf<FFXIVClientStructs.FFXIV.Client.Game.Status>();

View file

@ -24,7 +24,7 @@ namespace Dalamud.Game.Command;
[ServiceManager.EarlyLoadedService] [ServiceManager.EarlyLoadedService]
internal sealed unsafe class CommandManager : IInternalDisposableService, ICommandManager internal sealed unsafe class CommandManager : IInternalDisposableService, ICommandManager
{ {
private static readonly ModuleLog Log = new("Command"); private static readonly ModuleLog Log = ModuleLog.Create<CommandManager>();
private readonly ConcurrentDictionary<string, IReadOnlyCommandInfo> commandMap = new(); private readonly ConcurrentDictionary<string, IReadOnlyCommandInfo> commandMap = new();
private readonly ConcurrentDictionary<(string, IReadOnlyCommandInfo), string> commandAssemblyNameMap = new(); private readonly ConcurrentDictionary<(string, IReadOnlyCommandInfo), string> commandAssemblyNameMap = new();
@ -71,7 +71,7 @@ internal sealed unsafe class CommandManager : IInternalDisposableService, IComma
if (separatorPosition + 1 >= content.Length) if (separatorPosition + 1 >= content.Length)
{ {
// Remove the trailing space // Remove the trailing space
command = content.Substring(0, separatorPosition); command = content[..separatorPosition];
} }
else else
{ {
@ -262,12 +262,12 @@ internal sealed unsafe class CommandManager : IInternalDisposableService, IComma
#pragma warning restore SA1015 #pragma warning restore SA1015
internal class CommandManagerPluginScoped : IInternalDisposableService, ICommandManager internal class CommandManagerPluginScoped : IInternalDisposableService, ICommandManager
{ {
private static readonly ModuleLog Log = new("Command"); private static readonly ModuleLog Log = ModuleLog.Create<CommandManager>();
[ServiceManager.ServiceDependency] [ServiceManager.ServiceDependency]
private readonly CommandManager commandManagerService = Service<CommandManager>.Get(); private readonly CommandManager commandManagerService = Service<CommandManager>.Get();
private readonly List<string> pluginRegisteredCommands = new(); private readonly List<string> pluginRegisteredCommands = [];
private readonly LocalPlugin pluginInfo; private readonly LocalPlugin pluginInfo;
/// <summary> /// <summary>

View file

@ -1,11 +1,13 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Dalamud.Hooking; using Dalamud.Hooking;
using Dalamud.IoC; using Dalamud.IoC;
using Dalamud.IoC.Internal; using Dalamud.IoC.Internal;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Dalamud.Utility; using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Common.Configuration; using FFXIVClientStructs.FFXIV.Common.Configuration;
using Serilog; using Serilog;
namespace Dalamud.Game.Config; namespace Dalamud.Game.Config;

View file

@ -1,10 +1,12 @@
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Diagnostics; using System.Diagnostics;
using System.Text; using System.Text;
using Dalamud.Memory; using Dalamud.Memory;
using Dalamud.Utility; using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Common.Configuration; using FFXIVClientStructs.FFXIV.Common.Configuration;
using Serilog; using Serilog;
namespace Dalamud.Game.Config; namespace Dalamud.Game.Config;

View file

@ -26,7 +26,7 @@ namespace Dalamud.Game;
[ServiceManager.EarlyLoadedService] [ServiceManager.EarlyLoadedService]
internal sealed class Framework : IInternalDisposableService, IFramework internal sealed class Framework : IInternalDisposableService, IFramework
{ {
private static readonly ModuleLog Log = new("Framework"); private static readonly ModuleLog Log = ModuleLog.Create<Framework>();
private static readonly Stopwatch StatsStopwatch = new(); private static readonly Stopwatch StatsStopwatch = new();
@ -86,7 +86,7 @@ internal sealed class Framework : IInternalDisposableService, IFramework
/// <summary> /// <summary>
/// Gets the stats history mapping. /// Gets the stats history mapping.
/// </summary> /// </summary>
public static Dictionary<string, List<double>> StatsHistory { get; } = new(); public static Dictionary<string, List<double>> StatsHistory { get; } = [];
/// <inheritdoc/> /// <inheritdoc/>
public DateTime LastUpdate { get; private set; } = DateTime.MinValue; public DateTime LastUpdate { get; private set; } = DateTime.MinValue;
@ -106,7 +106,7 @@ internal sealed class Framework : IInternalDisposableService, IFramework
/// <summary> /// <summary>
/// Gets the list of update sub-delegates that didn't get updated this frame. /// Gets the list of update sub-delegates that didn't get updated this frame.
/// </summary> /// </summary>
internal List<string> NonUpdatedSubDelegates { get; private set; } = new(); internal List<string> NonUpdatedSubDelegates { get; private set; } = [];
/// <summary> /// <summary>
/// Gets or sets a value indicating whether to dispatch update events. /// Gets or sets a value indicating whether to dispatch update events.
@ -212,11 +212,10 @@ internal sealed class Framework : IInternalDisposableService, IFramework
if (cancellationToken == default) if (cancellationToken == default)
cancellationToken = this.FrameworkThreadTaskFactory.CancellationToken; cancellationToken = this.FrameworkThreadTaskFactory.CancellationToken;
return this.FrameworkThreadTaskFactory.ContinueWhenAll( return this.FrameworkThreadTaskFactory.ContinueWhenAll(
new[] [
{
Task.Delay(delay, cancellationToken), Task.Delay(delay, cancellationToken),
this.DelayTicks(delayTicks, cancellationToken), this.DelayTicks(delayTicks, cancellationToken),
}, ],
_ => func(), _ => func(),
cancellationToken, cancellationToken,
TaskContinuationOptions.HideScheduler, TaskContinuationOptions.HideScheduler,
@ -239,11 +238,10 @@ internal sealed class Framework : IInternalDisposableService, IFramework
if (cancellationToken == default) if (cancellationToken == default)
cancellationToken = this.FrameworkThreadTaskFactory.CancellationToken; cancellationToken = this.FrameworkThreadTaskFactory.CancellationToken;
return this.FrameworkThreadTaskFactory.ContinueWhenAll( return this.FrameworkThreadTaskFactory.ContinueWhenAll(
new[] [
{
Task.Delay(delay, cancellationToken), Task.Delay(delay, cancellationToken),
this.DelayTicks(delayTicks, cancellationToken), this.DelayTicks(delayTicks, cancellationToken),
}, ],
_ => action(), _ => action(),
cancellationToken, cancellationToken,
TaskContinuationOptions.HideScheduler, TaskContinuationOptions.HideScheduler,
@ -266,11 +264,10 @@ internal sealed class Framework : IInternalDisposableService, IFramework
if (cancellationToken == default) if (cancellationToken == default)
cancellationToken = this.FrameworkThreadTaskFactory.CancellationToken; cancellationToken = this.FrameworkThreadTaskFactory.CancellationToken;
return this.FrameworkThreadTaskFactory.ContinueWhenAll( return this.FrameworkThreadTaskFactory.ContinueWhenAll(
new[] [
{
Task.Delay(delay, cancellationToken), Task.Delay(delay, cancellationToken),
this.DelayTicks(delayTicks, cancellationToken), this.DelayTicks(delayTicks, cancellationToken),
}, ],
_ => func(), _ => func(),
cancellationToken, cancellationToken,
TaskContinuationOptions.HideScheduler, TaskContinuationOptions.HideScheduler,
@ -293,11 +290,10 @@ internal sealed class Framework : IInternalDisposableService, IFramework
if (cancellationToken == default) if (cancellationToken == default)
cancellationToken = this.FrameworkThreadTaskFactory.CancellationToken; cancellationToken = this.FrameworkThreadTaskFactory.CancellationToken;
return this.FrameworkThreadTaskFactory.ContinueWhenAll( return this.FrameworkThreadTaskFactory.ContinueWhenAll(
new[] [
{
Task.Delay(delay, cancellationToken), Task.Delay(delay, cancellationToken),
this.DelayTicks(delayTicks, cancellationToken), this.DelayTicks(delayTicks, cancellationToken),
}, ],
_ => func(), _ => func(),
cancellationToken, cancellationToken,
TaskContinuationOptions.HideScheduler, TaskContinuationOptions.HideScheduler,
@ -333,7 +329,7 @@ internal sealed class Framework : IInternalDisposableService, IFramework
internal static void AddToStats(string key, double ms) internal static void AddToStats(string key, double ms)
{ {
if (!StatsHistory.ContainsKey(key)) if (!StatsHistory.ContainsKey(key))
StatsHistory.Add(key, new List<double>()); StatsHistory.Add(key, []);
StatsHistory[key].Add(ms); StatsHistory[key].Add(ms);

View file

@ -37,10 +37,10 @@ namespace Dalamud.Game.Gui;
[ServiceManager.EarlyLoadedService] [ServiceManager.EarlyLoadedService]
internal sealed unsafe class ChatGui : IInternalDisposableService, IChatGui internal sealed unsafe class ChatGui : IInternalDisposableService, IChatGui
{ {
private static readonly ModuleLog Log = new("ChatGui"); private static readonly ModuleLog Log = ModuleLog.Create<ChatGui>();
private readonly Queue<XivChatEntry> chatQueue = new(); private readonly Queue<XivChatEntry> chatQueue = new();
private readonly Dictionary<(string PluginName, uint CommandId), Action<uint, SeString>> dalamudLinkHandlers = new(); private readonly Dictionary<(string PluginName, uint CommandId), Action<uint, SeString>> dalamudLinkHandlers = [];
private readonly Hook<PrintMessageDelegate> printMessageHook; private readonly Hook<PrintMessageDelegate> printMessageHook;
private readonly Hook<InventoryItem.Delegates.Copy> inventoryItemCopyHook; private readonly Hook<InventoryItem.Delegates.Copy> inventoryItemCopyHook;

View file

@ -2,6 +2,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading;
using Dalamud.Game.Text; using Dalamud.Game.Text;
using Dalamud.Game.Text.SeStringHandling; using Dalamud.Game.Text.SeStringHandling;
@ -28,7 +29,7 @@ namespace Dalamud.Game.Gui.ContextMenu;
[ServiceManager.EarlyLoadedService] [ServiceManager.EarlyLoadedService]
internal sealed unsafe class ContextMenu : IInternalDisposableService, IContextMenu internal sealed unsafe class ContextMenu : IInternalDisposableService, IContextMenu
{ {
private static readonly ModuleLog Log = new("ContextMenu"); private static readonly ModuleLog Log = ModuleLog.Create<ContextMenu>();
private readonly Hook<AtkModuleVf22OpenAddonByAgentDelegate> atkModuleVf22OpenAddonByAgentHook; private readonly Hook<AtkModuleVf22OpenAddonByAgentDelegate> atkModuleVf22OpenAddonByAgentHook;
private readonly Hook<AddonContextMenu.Delegates.OnMenuSelected> addonContextMenuOnMenuSelectedHook; private readonly Hook<AddonContextMenu.Delegates.OnMenuSelected> addonContextMenuOnMenuSelectedHook;
@ -53,7 +54,7 @@ internal sealed unsafe class ContextMenu : IInternalDisposableService, IContextM
private Dictionary<ContextMenuType, List<IMenuItem>> MenuItems { get; } = []; private Dictionary<ContextMenuType, List<IMenuItem>> MenuItems { get; } = [];
private object MenuItemsLock { get; } = new(); private Lock MenuItemsLock { get; } = new();
private AgentInterface* SelectedAgent { get; set; } private AgentInterface* SelectedAgent { get; set; }

View file

@ -1,6 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using Dalamud.Memory;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Client.UI.Agent; using FFXIVClientStructs.FFXIV.Client.UI.Agent;

View file

@ -30,7 +30,7 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
{ {
private const uint BaseNodeId = 1000; private const uint BaseNodeId = 1000;
private static readonly ModuleLog Log = new("DtrBar"); private static readonly ModuleLog Log = ModuleLog.Create<DtrBar>();
[ServiceManager.ServiceDependency] [ServiceManager.ServiceDependency]
private readonly Framework framework = Service<Framework>.Get(); private readonly Framework framework = Service<Framework>.Get();
@ -54,7 +54,7 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
private readonly ReaderWriterLockSlim entriesLock = new(); private readonly ReaderWriterLockSlim entriesLock = new();
private readonly List<DtrBarEntry> entries = []; private readonly List<DtrBarEntry> entries = [];
private readonly Dictionary<uint, List<IAddonEventHandle>> eventHandles = new(); private readonly Dictionary<uint, List<IAddonEventHandle>> eventHandles = [];
private ImmutableList<IReadOnlyDtrBarEntry>? entriesReadOnlyCopy; private ImmutableList<IReadOnlyDtrBarEntry>? entriesReadOnlyCopy;
@ -516,7 +516,7 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
var node = data.TextNode = this.MakeNode(++this.runningNodeIds); var node = data.TextNode = this.MakeNode(++this.runningNodeIds);
this.eventHandles.TryAdd(node->NodeId, new List<IAddonEventHandle>()); this.eventHandles.TryAdd(node->NodeId, []);
this.eventHandles[node->NodeId].AddRange(new List<IAddonEventHandle> this.eventHandles[node->NodeId].AddRange(new List<IAddonEventHandle>
{ {
this.uiEventManager.AddEvent(AddonEventManager.DalamudInternalKey, (nint)dtr, (nint)node, AddonEventType.MouseOver, this.DtrEventHandler), this.uiEventManager.AddEvent(AddonEventManager.DalamudInternalKey, (nint)dtr, (nint)node, AddonEventType.MouseOver, this.DtrEventHandler),

View file

@ -1,7 +1,6 @@
using System.Numerics; using System.Numerics;
using Dalamud.Configuration.Internal; using Dalamud.Configuration.Internal;
using Dalamud.Game.Addon.Events.EventDataTypes;
using Dalamud.Game.Text.SeStringHandling; using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Plugin.Internal.Types; using Dalamud.Plugin.Internal.Types;
using Dalamud.Utility; using Dalamud.Utility;

View file

@ -32,7 +32,7 @@ namespace Dalamud.Game.Gui;
[ServiceManager.EarlyLoadedService] [ServiceManager.EarlyLoadedService]
internal sealed unsafe class GameGui : IInternalDisposableService, IGameGui internal sealed unsafe class GameGui : IInternalDisposableService, IGameGui
{ {
private static readonly ModuleLog Log = new("GameGui"); private static readonly ModuleLog Log = ModuleLog.Create<GameGui>();
private readonly GameGuiAddressResolver address; private readonly GameGuiAddressResolver address;

View file

@ -427,8 +427,8 @@ internal unsafe class NamePlateUpdateHandler : INamePlateUpdateHandler
/// <inheritdoc/> /// <inheritdoc/>
public int VisibilityFlags public int VisibilityFlags
{ {
get => ObjectData->VisibilityFlags; get => this.ObjectData->VisibilityFlags;
set => ObjectData->VisibilityFlags = value; set => this.ObjectData->VisibilityFlags = value;
} }
/// <inheritdoc/> /// <inheritdoc/>

View file

@ -1,4 +1,5 @@
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Lumina.Excel.Sheets; using Lumina.Excel.Sheets;
namespace Dalamud.Game.Gui.PartyFinder.Types; namespace Dalamud.Game.Gui.PartyFinder.Types;

View file

@ -23,23 +23,7 @@ public class PartyFinderSlot
/// <summary> /// <summary>
/// Gets a list of jobs that this slot is accepting. /// Gets a list of jobs that this slot is accepting.
/// </summary> /// </summary>
public IReadOnlyCollection<JobFlags> Accepting public IReadOnlyCollection<JobFlags> Accepting => this.listAccepting ??= Enum.GetValues<JobFlags>().Where(flag => this[flag]).ToArray();
{
get
{
if (this.listAccepting != null)
{
return this.listAccepting;
}
this.listAccepting = Enum.GetValues(typeof(JobFlags))
.Cast<JobFlags>()
.Where(flag => this[flag])
.ToArray();
return this.listAccepting;
}
}
/// <summary> /// <summary>
/// Tests if this slot is accepting a job. /// Tests if this slot is accepting a job.

View file

@ -22,7 +22,7 @@ namespace Dalamud.Game.Internal;
[ServiceManager.EarlyLoadedService] [ServiceManager.EarlyLoadedService]
internal sealed unsafe class DalamudAtkTweaks : IInternalDisposableService internal sealed unsafe class DalamudAtkTweaks : IInternalDisposableService
{ {
private static readonly ModuleLog Log = new("DalamudAtkTweaks"); private static readonly ModuleLog Log = ModuleLog.Create<DalamudAtkTweaks>();
private readonly Hook<AgentHUD.Delegates.OpenSystemMenu> hookAgentHudOpenSystemMenu; private readonly Hook<AgentHUD.Delegates.OpenSystemMenu> hookAgentHudOpenSystemMenu;

View file

@ -18,15 +18,15 @@ namespace Dalamud.Game.Inventory;
[ServiceManager.EarlyLoadedService] [ServiceManager.EarlyLoadedService]
internal class GameInventory : IInternalDisposableService internal class GameInventory : IInternalDisposableService
{ {
private readonly List<GameInventoryPluginScoped> subscribersPendingChange = new(); private readonly List<GameInventoryPluginScoped> subscribersPendingChange = [];
private readonly List<GameInventoryPluginScoped> subscribers = new(); private readonly List<GameInventoryPluginScoped> subscribers = [];
private readonly List<InventoryItemAddedArgs> addedEvents = new(); private readonly List<InventoryItemAddedArgs> addedEvents = [];
private readonly List<InventoryItemRemovedArgs> removedEvents = new(); private readonly List<InventoryItemRemovedArgs> removedEvents = [];
private readonly List<InventoryItemChangedArgs> changedEvents = new(); private readonly List<InventoryItemChangedArgs> changedEvents = [];
private readonly List<InventoryItemMovedArgs> movedEvents = new(); private readonly List<InventoryItemMovedArgs> movedEvents = [];
private readonly List<InventoryItemSplitArgs> splitEvents = new(); private readonly List<InventoryItemSplitArgs> splitEvents = [];
private readonly List<InventoryItemMergedArgs> mergedEvents = new(); private readonly List<InventoryItemMergedArgs> mergedEvents = [];
[ServiceManager.ServiceDependency] [ServiceManager.ServiceDependency]
private readonly Framework framework = Service<Framework>.Get(); private readonly Framework framework = Service<Framework>.Get();
@ -151,7 +151,7 @@ internal class GameInventory : IInternalDisposableService
bool isNew; bool isNew;
lock (this.subscribersPendingChange) lock (this.subscribersPendingChange)
{ {
isNew = this.subscribersPendingChange.Any() && !this.subscribers.Any(); isNew = this.subscribersPendingChange.Count != 0 && this.subscribers.Count == 0;
this.subscribers.Clear(); this.subscribers.Clear();
this.subscribers.AddRange(this.subscribersPendingChange); this.subscribers.AddRange(this.subscribersPendingChange);
this.subscribersChanged = false; this.subscribersChanged = false;
@ -348,7 +348,7 @@ internal class GameInventory : IInternalDisposableService
#pragma warning restore SA1015 #pragma warning restore SA1015
internal class GameInventoryPluginScoped : IInternalDisposableService, IGameInventory internal class GameInventoryPluginScoped : IInternalDisposableService, IGameInventory
{ {
private static readonly ModuleLog Log = new(nameof(GameInventoryPluginScoped)); private static readonly ModuleLog Log = ModuleLog.Create<GameInventoryPluginScoped>();
[ServiceManager.ServiceDependency] [ServiceManager.ServiceDependency]
private readonly GameInventory gameInventoryService = Service<GameInventory>.Get(); private readonly GameInventory gameInventoryService = Service<GameInventory>.Get();

View file

@ -1,5 +1,3 @@
using System.Linq;
using Dalamud.Game.Network.Internal; using Dalamud.Game.Network.Internal;
using Dalamud.Game.Network.Structures; using Dalamud.Game.Network.Structures;
using Dalamud.IoC; using Dalamud.IoC;
@ -95,7 +93,7 @@ internal class MarketBoard : IInternalDisposableService, IMarketBoard
#pragma warning restore SA1015 #pragma warning restore SA1015
internal class MarketBoardPluginScoped : IInternalDisposableService, IMarketBoard internal class MarketBoardPluginScoped : IInternalDisposableService, IMarketBoard
{ {
private static readonly ModuleLog Log = new(nameof(MarketBoardPluginScoped)); private static readonly ModuleLog Log = ModuleLog.Create<MarketBoardPluginScoped>();
[ServiceManager.ServiceDependency] [ServiceManager.ServiceDependency]
private readonly MarketBoard marketBoardService = Service<MarketBoard>.Get(); private readonly MarketBoard marketBoardService = Service<MarketBoard>.Get();

View file

@ -89,7 +89,7 @@ public readonly unsafe struct AtkValuePtr(nint address) : IEquatable<AtkValuePtr
/// </returns> /// </returns>
public unsafe bool TryGet<T>([NotNullWhen(true)] out T? result) where T : struct public unsafe bool TryGet<T>([NotNullWhen(true)] out T? result) where T : struct
{ {
object? value = this.GetValue(); var value = this.GetValue();
if (value is T typed) if (value is T typed)
{ {
result = typed; result = typed;

View file

@ -2,9 +2,6 @@ using System.Runtime.InteropServices;
using Dalamud.Configuration.Internal; using Dalamud.Configuration.Internal;
using Dalamud.Hooking; using Dalamud.Hooking;
using Dalamud.IoC;
using Dalamud.IoC.Internal;
using Dalamud.Plugin.Services;
using Dalamud.Utility; using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Client.Network; using FFXIVClientStructs.FFXIV.Client.Network;

View file

@ -1,4 +1,3 @@
using System.Collections.Generic;
using System.Net.Http; using System.Net.Http;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -8,6 +7,7 @@ using Dalamud.Game.Network.Structures;
using Dalamud.Networking.Http; using Dalamud.Networking.Http;
using Newtonsoft.Json; using Newtonsoft.Json;
using Serilog; using Serilog;
namespace Dalamud.Game.Network.Internal.MarketBoardUploaders.Universalis; namespace Dalamud.Game.Network.Internal.MarketBoardUploaders.Universalis;
@ -64,7 +64,7 @@ internal class UniversalisMarketBoardUploader : IMarketBoardUploader
PricePerUnit = marketBoardItemListing.PricePerUnit, PricePerUnit = marketBoardItemListing.PricePerUnit,
Quantity = marketBoardItemListing.ItemQuantity, Quantity = marketBoardItemListing.ItemQuantity,
RetainerCity = marketBoardItemListing.RetainerCityId, RetainerCity = marketBoardItemListing.RetainerCityId,
Materia = new List<UniversalisItemMateria>(), Materia = [],
}; };
#pragma warning restore CS0618 // Type or member is obsolete #pragma warning restore CS0618 // Type or member is obsolete

View file

@ -33,7 +33,7 @@ namespace Dalamud.Game.Network.Internal;
[ServiceManager.EarlyLoadedService] [ServiceManager.EarlyLoadedService]
internal unsafe class NetworkHandlers : IInternalDisposableService internal unsafe class NetworkHandlers : IInternalDisposableService
{ {
private readonly IMarketBoardUploader uploader; private readonly UniversalisMarketBoardUploader uploader;
private readonly IDisposable handleMarketBoardItemRequest; private readonly IDisposable handleMarketBoardItemRequest;
private readonly IDisposable handleMarketTaxRates; private readonly IDisposable handleMarketTaxRates;
@ -419,7 +419,7 @@ internal unsafe class NetworkHandlers : IInternalDisposableService
private IDisposable HandleMarketBoardItemRequest() private IDisposable HandleMarketBoardItemRequest()
{ {
void LogStartObserved(MarketBoardItemRequest request) static void LogStartObserved(MarketBoardItemRequest request)
{ {
Log.Verbose("Observed start of request for item with {NumListings} expected listings", request.AmountToArrive); Log.Verbose("Observed start of request for item with {NumListings} expected listings", request.AmountToArrive);
} }
@ -448,7 +448,7 @@ internal unsafe class NetworkHandlers : IInternalDisposableService
private void UploadMarketBoardData( private void UploadMarketBoardData(
MarketBoardItemRequest request, MarketBoardItemRequest request,
(uint CatalogId, ICollection<MarketBoardHistory.MarketBoardHistoryListing> Sales) sales, (uint CatalogId, ICollection<MarketBoardHistory.MarketBoardHistoryListing> Sales) sales,
ICollection<MarketBoardCurrentOfferings.MarketBoardItemListing> listings, List<MarketBoardCurrentOfferings.MarketBoardItemListing> listings,
ulong uploaderId, ulong uploaderId,
uint worldId) uint worldId)
{ {

View file

@ -11,7 +11,9 @@ using System.Threading;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Iced.Intel; using Iced.Intel;
using Newtonsoft.Json; using Newtonsoft.Json;
using Serilog; using Serilog;
namespace Dalamud.Game; namespace Dalamud.Game;

View file

@ -48,7 +48,7 @@ namespace Dalamud.Game.Text.Evaluator;
[ResolveVia<ISeStringEvaluator>] [ResolveVia<ISeStringEvaluator>]
internal class SeStringEvaluator : IServiceType, ISeStringEvaluator internal class SeStringEvaluator : IServiceType, ISeStringEvaluator
{ {
private static readonly ModuleLog Log = new("SeStringEvaluator"); private static readonly ModuleLog Log = ModuleLog.Create<SeStringEvaluator>();
[ServiceManager.ServiceDependency] [ServiceManager.ServiceDependency]
private readonly ClientState.ClientState clientState = Service<ClientState.ClientState>.Get(); private readonly ClientState.ClientState clientState = Service<ClientState.ClientState>.Get();
@ -244,154 +244,67 @@ internal class SeStringEvaluator : IServiceType, ISeStringEvaluator
// if (context.HandlePayload(payload, in context)) // if (context.HandlePayload(payload, in context))
// return true; // return true;
switch (payload.MacroCode) return payload.MacroCode switch
{ {
case MacroCode.SetResetTime: MacroCode.SetResetTime => this.TryResolveSetResetTime(in context, payload),
return this.TryResolveSetResetTime(in context, payload); MacroCode.SetTime => this.TryResolveSetTime(in context, payload),
MacroCode.If => this.TryResolveIf(in context, payload),
case MacroCode.SetTime: MacroCode.Switch => this.TryResolveSwitch(in context, payload),
return this.TryResolveSetTime(in context, payload); MacroCode.SwitchPlatform => this.TryResolveSwitchPlatform(in context, payload),
MacroCode.PcName => this.TryResolvePcName(in context, payload),
case MacroCode.If: MacroCode.IfPcGender => this.TryResolveIfPcGender(in context, payload),
return this.TryResolveIf(in context, payload); MacroCode.IfPcName => this.TryResolveIfPcName(in context, payload),
// MacroCode.Josa
case MacroCode.Switch: // MacroCode.Josaro
return this.TryResolveSwitch(in context, payload); MacroCode.IfSelf => this.TryResolveIfSelf(in context, payload),
// MacroCode.NewLine (pass through)
case MacroCode.SwitchPlatform: // MacroCode.Wait (pass through)
return this.TryResolveSwitchPlatform(in context, payload); // MacroCode.Icon (pass through)
MacroCode.Color => this.TryResolveColor(in context, payload),
case MacroCode.PcName: MacroCode.EdgeColor => this.TryResolveEdgeColor(in context, payload),
return this.TryResolvePcName(in context, payload); MacroCode.ShadowColor => this.TryResolveShadowColor(in context, payload),
// MacroCode.SoftHyphen (pass through)
case MacroCode.IfPcGender: // MacroCode.Key
return this.TryResolveIfPcGender(in context, payload); // MacroCode.Scale
MacroCode.Bold => this.TryResolveBold(in context, payload),
case MacroCode.IfPcName: MacroCode.Italic => this.TryResolveItalic(in context, payload),
return this.TryResolveIfPcName(in context, payload); // MacroCode.Edge
// MacroCode.Shadow
// case MacroCode.Josa: // MacroCode.NonBreakingSpace (pass through)
// case MacroCode.Josaro: // MacroCode.Icon2 (pass through)
// MacroCode.Hyphen (pass through)
case MacroCode.IfSelf: MacroCode.Num => this.TryResolveNum(in context, payload),
return this.TryResolveIfSelf(in context, payload); MacroCode.Hex => this.TryResolveHex(in context, payload),
MacroCode.Kilo => this.TryResolveKilo(in context, payload),
// case MacroCode.NewLine: // pass through // MacroCode.Byte
// case MacroCode.Wait: // pass through MacroCode.Sec => this.TryResolveSec(in context, payload),
// case MacroCode.Icon: // pass through // MacroCode.Time
MacroCode.Float => this.TryResolveFloat(in context, payload),
case MacroCode.Color: // MacroCode.Link (pass through)
return this.TryResolveColor(in context, payload); MacroCode.Sheet => this.TryResolveSheet(in context, payload),
MacroCode.SheetSub => this.TryResolveSheetSub(in context, payload),
case MacroCode.EdgeColor: MacroCode.String => this.TryResolveString(in context, payload),
return this.TryResolveEdgeColor(in context, payload); MacroCode.Caps => this.TryResolveCaps(in context, payload),
MacroCode.Head => this.TryResolveHead(in context, payload),
case MacroCode.ShadowColor: MacroCode.Split => this.TryResolveSplit(in context, payload),
return this.TryResolveShadowColor(in context, payload); MacroCode.HeadAll => this.TryResolveHeadAll(in context, payload),
MacroCode.Fixed => this.TryResolveFixed(in context, payload),
// case MacroCode.SoftHyphen: // pass through MacroCode.Lower => this.TryResolveLower(in context, payload),
// case MacroCode.Key: MacroCode.JaNoun => this.TryResolveNoun(ClientLanguage.Japanese, in context, payload),
// case MacroCode.Scale: MacroCode.EnNoun => this.TryResolveNoun(ClientLanguage.English, in context, payload),
MacroCode.DeNoun => this.TryResolveNoun(ClientLanguage.German, in context, payload),
case MacroCode.Bold: MacroCode.FrNoun => this.TryResolveNoun(ClientLanguage.French, in context, payload),
return this.TryResolveBold(in context, payload); // MacroCode.ChNoun
MacroCode.LowerHead => this.TryResolveLowerHead(in context, payload),
case MacroCode.Italic: MacroCode.ColorType => this.TryResolveColorType(in context, payload),
return this.TryResolveItalic(in context, payload); MacroCode.EdgeColorType => this.TryResolveEdgeColorType(in context, payload),
// MacroCode.Ruby
// case MacroCode.Edge: MacroCode.Digit => this.TryResolveDigit(in context, payload),
// case MacroCode.Shadow: MacroCode.Ordinal => this.TryResolveOrdinal(in context, payload),
// case MacroCode.NonBreakingSpace: // pass through // MacroCode.Sound (pass through)
// case MacroCode.Icon2: // pass through MacroCode.LevelPos => this.TryResolveLevelPos(in context, payload),
// case MacroCode.Hyphen: // pass through _ => false,
};
case MacroCode.Num:
return this.TryResolveNum(in context, payload);
case MacroCode.Hex:
return this.TryResolveHex(in context, payload);
case MacroCode.Kilo:
return this.TryResolveKilo(in context, payload);
// case MacroCode.Byte:
case MacroCode.Sec:
return this.TryResolveSec(in context, payload);
// case MacroCode.Time:
case MacroCode.Float:
return this.TryResolveFloat(in context, payload);
// case MacroCode.Link: // pass through
case MacroCode.Sheet:
return this.TryResolveSheet(in context, payload);
case MacroCode.SheetSub:
return this.TryResolveSheetSub(in context, payload);
case MacroCode.String:
return this.TryResolveString(in context, payload);
case MacroCode.Caps:
return this.TryResolveCaps(in context, payload);
case MacroCode.Head:
return this.TryResolveHead(in context, payload);
case MacroCode.Split:
return this.TryResolveSplit(in context, payload);
case MacroCode.HeadAll:
return this.TryResolveHeadAll(in context, payload);
case MacroCode.Fixed:
return this.TryResolveFixed(in context, payload);
case MacroCode.Lower:
return this.TryResolveLower(in context, payload);
case MacroCode.JaNoun:
return this.TryResolveNoun(ClientLanguage.Japanese, in context, payload);
case MacroCode.EnNoun:
return this.TryResolveNoun(ClientLanguage.English, in context, payload);
case MacroCode.DeNoun:
return this.TryResolveNoun(ClientLanguage.German, in context, payload);
case MacroCode.FrNoun:
return this.TryResolveNoun(ClientLanguage.French, in context, payload);
// case MacroCode.ChNoun:
case MacroCode.LowerHead:
return this.TryResolveLowerHead(in context, payload);
case MacroCode.ColorType:
return this.TryResolveColorType(in context, payload);
case MacroCode.EdgeColorType:
return this.TryResolveEdgeColorType(in context, payload);
// case MacroCode.Ruby:
case MacroCode.Digit:
return this.TryResolveDigit(in context, payload);
case MacroCode.Ordinal:
return this.TryResolveOrdinal(in context, payload);
// case MacroCode.Sound: // pass through
case MacroCode.LevelPos:
return this.TryResolveLevelPos(in context, payload);
default:
return false;
}
} }
private unsafe bool TryResolveSetResetTime(in SeStringContext context, in ReadOnlySePayloadSpan payload) private unsafe bool TryResolveSetResetTime(in SeStringContext context, in ReadOnlySePayloadSpan payload)
@ -932,7 +845,7 @@ internal class SeStringEvaluator : IServiceType, ISeStringEvaluator
using var rssb = new RentedSeStringBuilder(); using var rssb = new RentedSeStringBuilder();
var sb = rssb.Builder; var sb = rssb.Builder;
sb.Append(this.EvaluateFromAddon(6, [rarity], context.Language)); sb.Append(this.EvaluateFromAddon(6, [rarity], context.Language)); // appends colortype and edgecolortype
if (!skipLink) if (!skipLink)
sb.PushLink(LinkMacroPayloadType.Item, itemId, rarity, 0u); // arg3 = some LogMessage flag based on LogKind RowId? => "89 5C 24 20 E8 ?? ?? ?? ?? 48 8B 1F" sb.PushLink(LinkMacroPayloadType.Item, itemId, rarity, 0u); // arg3 = some LogMessage flag based on LogKind RowId? => "89 5C 24 20 E8 ?? ?? ?? ?? 48 8B 1F"
@ -955,6 +868,9 @@ internal class SeStringEvaluator : IServiceType, ISeStringEvaluator
if (!skipLink) if (!skipLink)
sb.PopLink(); sb.PopLink();
sb.PopEdgeColorType();
sb.PopColorType();
text = sb.ToReadOnlySeString(); text = sb.ToReadOnlySeString();
} }

View file

@ -85,7 +85,7 @@ internal class NounProcessor : IServiceType
private const int PronounColumnIdx = 6; private const int PronounColumnIdx = 6;
private const int ArticleColumnIdx = 7; private const int ArticleColumnIdx = 7;
private static readonly ModuleLog Log = new("NounProcessor"); private static readonly ModuleLog Log = ModuleLog.Create<NounProcessor>();
[ServiceManager.ServiceDependency] [ServiceManager.ServiceDependency]
private readonly DataManager dataManager = Service<DataManager>.Get(); private readonly DataManager dataManager = Service<DataManager>.Get();

View file

@ -213,11 +213,10 @@ public abstract partial class Payload
return payload; return payload;
} }
private static Payload DecodeText(BinaryReader reader) private static TextPayload DecodeText(BinaryReader reader)
{ {
var payload = new TextPayload(); var payload = new TextPayload();
payload.DecodeImpl(reader, reader.BaseStream.Length); payload.DecodeImpl(reader, reader.BaseStream.Length);
return payload; return payload;
} }
} }
@ -382,7 +381,7 @@ public abstract partial class Payload
{ {
if (value < 0xCF) if (value < 0xCF)
{ {
return new byte[] { (byte)(value + 1) }; return [(byte)(value + 1)];
} }
var bytes = BitConverter.GetBytes(value); var bytes = BitConverter.GetBytes(value);

View file

@ -45,10 +45,10 @@ public class IconPayload : Payload
{ {
var indexBytes = MakeInteger((uint)this.Icon); var indexBytes = MakeInteger((uint)this.Icon);
var chunkLen = indexBytes.Length + 1; var chunkLen = indexBytes.Length + 1;
var bytes = new List<byte>(new byte[] var bytes = new List<byte>(
{ [
START_BYTE, (byte)SeStringChunkType.Icon, (byte)chunkLen, START_BYTE, (byte)SeStringChunkType.Icon, (byte)chunkLen,
}); ]);
bytes.AddRange(indexBytes); bytes.AddRange(indexBytes);
bytes.Add(END_BYTE); bytes.Add(END_BYTE);
return bytes.ToArray(); return bytes.ToArray();

View file

@ -8,6 +8,7 @@ using Dalamud.Utility;
using Lumina.Excel; using Lumina.Excel;
using Lumina.Excel.Sheets; using Lumina.Excel.Sheets;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace Dalamud.Game.Text.SeStringHandling.Payloads; namespace Dalamud.Game.Text.SeStringHandling.Payloads;
@ -172,7 +173,7 @@ public class ItemPayload : Payload
}; };
bytes.AddRange(idBytes); bytes.AddRange(idBytes);
// unk // unk
bytes.AddRange(new byte[] { 0x02, 0x01 }); bytes.AddRange([0x02, 0x01]);
// Links don't have to include the name, but if they do, it requires additional work // Links don't have to include the name, but if they do, it requires additional work
if (hasName) if (hasName)
@ -183,17 +184,17 @@ public class ItemPayload : Payload
nameLen += 4; // space plus 3 bytes for HQ symbol nameLen += 4; // space plus 3 bytes for HQ symbol
} }
bytes.AddRange(new byte[] bytes.AddRange(
{ [
0xFF, // unk 0xFF, // unk
(byte)nameLen, (byte)nameLen,
}); ]);
bytes.AddRange(Encoding.UTF8.GetBytes(this.displayName)); bytes.AddRange(Encoding.UTF8.GetBytes(this.displayName));
if (this.IsHQ) if (this.IsHQ)
{ {
// space and HQ symbol // space and HQ symbol
bytes.AddRange(new byte[] { 0x20, 0xEE, 0x80, 0xBC }); bytes.AddRange([0x20, 0xEE, 0x80, 0xBC]);
} }
} }

View file

@ -5,6 +5,7 @@ using Dalamud.Data;
using Lumina.Excel; using Lumina.Excel;
using Lumina.Excel.Sheets; using Lumina.Excel.Sheets;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace Dalamud.Game.Text.SeStringHandling.Payloads; namespace Dalamud.Game.Text.SeStringHandling.Payloads;
@ -174,7 +175,7 @@ public class MapLinkPayload : Payload
bytes.AddRange(yBytes); bytes.AddRange(yBytes);
// unk // unk
bytes.AddRange(new byte[] { 0xFF, 0x01, END_BYTE }); bytes.AddRange([0xFF, 0x01, END_BYTE]);
return bytes.ToArray(); return bytes.ToArray();
} }

View file

@ -7,7 +7,7 @@ namespace Dalamud.Game.Text.SeStringHandling.Payloads;
/// </summary> /// </summary>
public class NewLinePayload : Payload, ITextProvider public class NewLinePayload : Payload, ITextProvider
{ {
private readonly byte[] bytes = { START_BYTE, (byte)SeStringChunkType.NewLine, 0x01, END_BYTE }; private readonly byte[] bytes = [START_BYTE, (byte)SeStringChunkType.NewLine, 0x01, END_BYTE];
/// <summary> /// <summary>
/// Gets an instance of NewLinePayload. /// Gets an instance of NewLinePayload.

View file

@ -3,6 +3,7 @@ using System.Diagnostics.CodeAnalysis;
using System.IO; using System.IO;
using Lumina.Extensions; using Lumina.Extensions;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace Dalamud.Game.Text.SeStringHandling.Payloads namespace Dalamud.Game.Text.SeStringHandling.Payloads
@ -97,7 +98,7 @@ namespace Dalamud.Game.Text.SeStringHandling.Payloads
reader.ReadByte(); reader.ReadByte();
// if the next byte is 0xF3 then this listing is limited to home world // if the next byte is 0xF3 then this listing is limited to home world
byte nextByte = reader.ReadByte(); var nextByte = reader.ReadByte();
switch (nextByte) switch (nextByte)
{ {
case (byte)PartyFinderLinkType.LimitedToHomeWorld: case (byte)PartyFinderLinkType.LimitedToHomeWorld:
@ -121,11 +122,11 @@ namespace Dalamud.Game.Text.SeStringHandling.Payloads
// if the link type is notification, just use premade payload data since it's always the same. // if the link type is notification, just use premade payload data since it's always the same.
// i have no idea why it is formatted like this, but it is how it is. // i have no idea why it is formatted like this, but it is how it is.
// note it is identical to the link terminator payload except the embedded info type is 0x08 // note it is identical to the link terminator payload except the embedded info type is 0x08
if (this.LinkType == PartyFinderLinkType.PartyFinderNotification) return new byte[] { 0x02, 0x27, 0x07, 0x08, 0x01, 0x01, 0x01, 0xFF, 0x01, 0x03, }; if (this.LinkType == PartyFinderLinkType.PartyFinderNotification) return [0x02, 0x27, 0x07, 0x08, 0x01, 0x01, 0x01, 0xFF, 0x01, 0x03,];
// back to our regularly scheduled programming... // back to our regularly scheduled programming...
var listingIDBytes = MakeInteger(this.ListingId); var listingIDBytes = MakeInteger(this.ListingId);
bool isFlagSpecified = this.LinkType != PartyFinderLinkType.NotSpecified; var isFlagSpecified = this.LinkType != PartyFinderLinkType.NotSpecified;
var chunkLen = listingIDBytes.Length + 4; var chunkLen = listingIDBytes.Length + 4;
// 1 more byte for the type flag if it is specified // 1 more byte for the type flag if it is specified

View file

@ -5,6 +5,7 @@ using Dalamud.Data;
using Lumina.Excel; using Lumina.Excel;
using Lumina.Excel.Sheets; using Lumina.Excel.Sheets;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace Dalamud.Game.Text.SeStringHandling.Payloads; namespace Dalamud.Game.Text.SeStringHandling.Payloads;
@ -62,7 +63,7 @@ public class QuestPayload : Payload
}; };
bytes.AddRange(idBytes); bytes.AddRange(idBytes);
bytes.AddRange(new byte[] { 0x01, 0x01, END_BYTE }); bytes.AddRange([0x01, 0x01, END_BYTE]);
return bytes.ToArray(); return bytes.ToArray();
} }

View file

@ -45,7 +45,7 @@ public class RawPayload : Payload
/// <summary> /// <summary>
/// Gets a fixed Payload representing a common link-termination sequence, found in many payload chains. /// Gets a fixed Payload representing a common link-termination sequence, found in many payload chains.
/// </summary> /// </summary>
public static RawPayload LinkTerminator => new(new byte[] { 0x02, 0x27, 0x07, 0xCF, 0x01, 0x01, 0x01, 0xFF, 0x01, 0x03 }); public static RawPayload LinkTerminator => new([0x02, 0x27, 0x07, 0xCF, 0x01, 0x01, 0x01, 0xFF, 0x01, 0x03]);
/// <inheritdoc/> /// <inheritdoc/>
public override PayloadType Type => PayloadType.Unknown; public override PayloadType Type => PayloadType.Unknown;

View file

@ -7,7 +7,7 @@ namespace Dalamud.Game.Text.SeStringHandling.Payloads;
/// </summary> /// </summary>
public class SeHyphenPayload : Payload, ITextProvider public class SeHyphenPayload : Payload, ITextProvider
{ {
private readonly byte[] bytes = { START_BYTE, (byte)SeStringChunkType.SeHyphen, 0x01, END_BYTE }; private readonly byte[] bytes = [START_BYTE, (byte)SeStringChunkType.SeHyphen, 0x01, END_BYTE];
/// <summary> /// <summary>
/// Gets an instance of SeHyphenPayload. /// Gets an instance of SeHyphenPayload.

View file

@ -5,6 +5,7 @@ using Dalamud.Data;
using Lumina.Excel; using Lumina.Excel;
using Lumina.Excel.Sheets; using Lumina.Excel.Sheets;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace Dalamud.Game.Text.SeStringHandling.Payloads; namespace Dalamud.Game.Text.SeStringHandling.Payloads;
@ -63,7 +64,7 @@ public class StatusPayload : Payload
bytes.AddRange(idBytes); bytes.AddRange(idBytes);
// unk // unk
bytes.AddRange(new byte[] { 0x01, 0x01, 0xFF, 0x02, 0x20, END_BYTE }); bytes.AddRange([0x01, 0x01, 0xFF, 0x02, 0x20, END_BYTE]);
return bytes.ToArray(); return bytes.ToArray();
} }

View file

@ -5,6 +5,7 @@ using Dalamud.Data;
using Lumina.Excel; using Lumina.Excel;
using Lumina.Excel.Sheets; using Lumina.Excel.Sheets;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace Dalamud.Game.Text.SeStringHandling.Payloads; namespace Dalamud.Game.Text.SeStringHandling.Payloads;
@ -95,10 +96,10 @@ public class UIForegroundPayload : Payload
var colorBytes = MakeInteger(this.colorKey); var colorBytes = MakeInteger(this.colorKey);
var chunkLen = colorBytes.Length + 1; var chunkLen = colorBytes.Length + 1;
var bytes = new List<byte>(new byte[] var bytes = new List<byte>(
{ [
START_BYTE, (byte)SeStringChunkType.UIForeground, (byte)chunkLen, START_BYTE, (byte)SeStringChunkType.UIForeground, (byte)chunkLen,
}); ]);
bytes.AddRange(colorBytes); bytes.AddRange(colorBytes);
bytes.Add(END_BYTE); bytes.Add(END_BYTE);

View file

@ -5,6 +5,7 @@ using Dalamud.Data;
using Lumina.Excel; using Lumina.Excel;
using Lumina.Excel.Sheets; using Lumina.Excel.Sheets;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace Dalamud.Game.Text.SeStringHandling.Payloads; namespace Dalamud.Game.Text.SeStringHandling.Payloads;
@ -98,10 +99,10 @@ public class UIGlowPayload : Payload
var colorBytes = MakeInteger(this.colorKey); var colorBytes = MakeInteger(this.colorKey);
var chunkLen = colorBytes.Length + 1; var chunkLen = colorBytes.Length + 1;
var bytes = new List<byte>(new byte[] var bytes = new List<byte>(
{ [
START_BYTE, (byte)SeStringChunkType.UIGlow, (byte)chunkLen, START_BYTE, (byte)SeStringChunkType.UIGlow, (byte)chunkLen,
}); ]);
bytes.AddRange(colorBytes); bytes.AddRange(colorBytes);
bytes.Add(END_BYTE); bytes.Add(END_BYTE);

View file

@ -28,7 +28,7 @@ public class SeString
/// </summary> /// </summary>
public SeString() public SeString()
{ {
this.Payloads = new List<Payload>(); this.Payloads = [];
} }
/// <summary> /// <summary>

View file

@ -169,9 +169,6 @@ public sealed class AsmHook : IDisposable, IDalamudHook
/// </summary> /// </summary>
private void CheckDisposed() private void CheckDisposed()
{ {
if (this.IsDisposed) ObjectDisposedException.ThrowIf(this.IsDisposed, this);
{
throw new ObjectDisposedException(message: "Hook is already disposed", null);
}
} }
} }

View file

@ -160,7 +160,7 @@ public abstract class Hook<T> : IDalamudHook where T : Delegate
(int)Math.Min(pDataDirectory->Size + pDataDirectory->VirtualAddress - importDescriptor.Name, moduleNameLowerWithNullTerminator.Length)); (int)Math.Min(pDataDirectory->Size + pDataDirectory->VirtualAddress - importDescriptor.Name, moduleNameLowerWithNullTerminator.Length));
// Is this entry about the DLL that we're looking for? (Case insensitive) // Is this entry about the DLL that we're looking for? (Case insensitive)
if (currentDllNameWithNullTerminator.ToLowerInvariant() != moduleNameLowerWithNullTerminator) if (!currentDllNameWithNullTerminator.Equals(moduleNameLowerWithNullTerminator, StringComparison.InvariantCultureIgnoreCase))
continue; continue;
if (isPe64) if (isPe64)
@ -245,10 +245,7 @@ public abstract class Hook<T> : IDalamudHook where T : Delegate
/// </summary> /// </summary>
protected void CheckDisposed() protected void CheckDisposed()
{ {
if (this.IsDisposed) ObjectDisposedException.ThrowIf(this.IsDisposed, this);
{
throw new ObjectDisposedException(message: "Hook is already disposed", null);
}
} }
private static unsafe IntPtr FromImportHelper32(IntPtr baseAddress, ref PeHeader.IMAGE_IMPORT_DESCRIPTOR desc, ref PeHeader.IMAGE_DATA_DIRECTORY dir, string functionName, uint hintOrOrdinal) private static unsafe IntPtr FromImportHelper32(IntPtr baseAddress, ref PeHeader.IMAGE_IMPORT_DESCRIPTOR desc, ref PeHeader.IMAGE_DATA_DIRECTORY dir, string functionName, uint hintOrOrdinal)

View file

@ -1,8 +1,8 @@
using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using JetBrains.Annotations; using JetBrains.Annotations;
using Windows.Win32.System.Memory; using Windows.Win32.System.Memory;
using Win32Exception = System.ComponentModel.Win32Exception; using Win32Exception = System.ComponentModel.Win32Exception;
@ -45,7 +45,7 @@ internal unsafe class FunctionPointerVariableHook<T> : Hook<T>
if (!HookManager.MultiHookTracker.TryGetValue(this.Address, out var indexList)) if (!HookManager.MultiHookTracker.TryGetValue(this.Address, out var indexList))
{ {
indexList = HookManager.MultiHookTracker[this.Address] = new List<IDalamudHook>(); indexList = HookManager.MultiHookTracker[this.Address] = [];
} }
this.detourDelegate = detour; this.detourDelegate = detour;

View file

@ -1,4 +1,4 @@
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using Dalamud.Game; using Dalamud.Game;
@ -8,6 +8,7 @@ using Dalamud.Plugin.Internal.Types;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Dalamud.Utility; using Dalamud.Utility;
using Dalamud.Utility.Signatures; using Dalamud.Utility.Signatures;
using Serilog; using Serilog;
namespace Dalamud.Hooking.Internal; namespace Dalamud.Hooking.Internal;
@ -25,7 +26,7 @@ internal class GameInteropProviderPluginScoped : IGameInteropProvider, IInternal
private readonly LocalPlugin plugin; private readonly LocalPlugin plugin;
private readonly SigScanner scanner; private readonly SigScanner scanner;
private readonly WeakConcurrentCollection<IDalamudHook> trackedHooks = new(); private readonly WeakConcurrentCollection<IDalamudHook> trackedHooks = [];
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="GameInteropProviderPluginScoped"/> class. /// Initializes a new instance of the <see cref="GameInteropProviderPluginScoped"/> class.

View file

@ -2,6 +2,7 @@ using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading;
using Dalamud.Logging.Internal; using Dalamud.Logging.Internal;
using Dalamud.Memory; using Dalamud.Memory;
@ -20,7 +21,7 @@ internal class HookManager : IInternalDisposableService
/// <summary> /// <summary>
/// Logger shared with <see cref="Unhooker"/>. /// Logger shared with <see cref="Unhooker"/>.
/// </summary> /// </summary>
internal static readonly ModuleLog Log = new("HM"); internal static readonly ModuleLog Log = ModuleLog.Create<HookManager>();
[ServiceManager.ServiceConstructor] [ServiceManager.ServiceConstructor]
private HookManager() private HookManager()
@ -30,7 +31,7 @@ internal class HookManager : IInternalDisposableService
/// <summary> /// <summary>
/// Gets sync root object for hook enabling/disabling. /// Gets sync root object for hook enabling/disabling.
/// </summary> /// </summary>
internal static object HookEnableSyncRoot { get; } = new(); internal static Lock HookEnableSyncRoot { get; } = new();
/// <summary> /// <summary>
/// Gets a static list of tracked and registered hooks. /// Gets a static list of tracked and registered hooks.

View file

@ -24,7 +24,7 @@ internal class MinHookHook<T> : Hook<T> where T : Delegate
var unhooker = HookManager.RegisterUnhooker(this.Address); var unhooker = HookManager.RegisterUnhooker(this.Address);
if (!HookManager.MultiHookTracker.TryGetValue(this.Address, out var indexList)) 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; var index = (ulong)indexList.Count;

View file

@ -17,10 +17,10 @@ namespace Dalamud.Hooking.WndProcHook;
[ServiceManager.EarlyLoadedService] [ServiceManager.EarlyLoadedService]
internal sealed class WndProcHookManager : IInternalDisposableService internal sealed class WndProcHookManager : IInternalDisposableService
{ {
private static readonly ModuleLog Log = new(nameof(WndProcHookManager)); private static readonly ModuleLog Log = ModuleLog.Create<WndProcHookManager>();
private readonly Hook<DispatchMessageWDelegate> dispatchMessageWHook; private readonly Hook<DispatchMessageWDelegate> dispatchMessageWHook;
private readonly Dictionary<HWND, WndProcEventArgs> wndProcOverrides = new(); private readonly Dictionary<HWND, WndProcEventArgs> wndProcOverrides = [];
private HWND mainWindowHwnd; private HWND mainWindowHwnd;

View file

@ -56,11 +56,10 @@ public static class ColorHelpers
var min = Math.Min(r, Math.Min(g, b)); var min = Math.Min(r, Math.Min(g, b));
var h = max; var h = max;
var s = max;
var v = max; var v = max;
var d = max - min; var d = max - min;
s = max == 0 ? 0 : d / max; var s = max == 0 ? 0 : d / max;
if (max == min) if (max == min)
{ {

View file

@ -1,5 +1,6 @@
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;
using FFXIVClientStructs.FFXIV.Common.Math; using FFXIVClientStructs.FFXIV.Common.Math;
namespace Dalamud.Interface.Components; namespace Dalamud.Interface.Components;

View file

@ -5,6 +5,7 @@ using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Internal; using Dalamud.Interface.Internal;
using Dalamud.IoC; using Dalamud.IoC;
using Dalamud.IoC.Internal; using Dalamud.IoC.Internal;
using Serilog; using Serilog;
namespace Dalamud.Interface.DragDrop; namespace Dalamud.Interface.DragDrop;

View file

@ -6,6 +6,7 @@ using System.Text;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Dalamud.Utility; using Dalamud.Utility;
using Serilog; using Serilog;
namespace Dalamud.Interface.DragDrop; namespace Dalamud.Interface.DragDrop;

View file

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using Dalamud.Utility; using Dalamud.Utility;
@ -37,7 +37,7 @@ public static class FontAwesomeExtensions
public static IEnumerable<string> GetSearchTerms(this FontAwesomeIcon icon) public static IEnumerable<string> GetSearchTerms(this FontAwesomeIcon icon)
{ {
var searchTermsAttribute = icon.GetAttribute<FontAwesomeSearchTermsAttribute>(); var searchTermsAttribute = icon.GetAttribute<FontAwesomeSearchTermsAttribute>();
return searchTermsAttribute == null ? new string[] { } : searchTermsAttribute.SearchTerms; return searchTermsAttribute == null ? [] : searchTermsAttribute.SearchTerms;
} }
/// <summary> /// <summary>
@ -48,6 +48,6 @@ public static class FontAwesomeExtensions
public static IEnumerable<string> GetCategories(this FontAwesomeIcon icon) public static IEnumerable<string> GetCategories(this FontAwesomeIcon icon)
{ {
var categoriesAttribute = icon.GetAttribute<FontAwesomeCategoriesAttribute>(); var categoriesAttribute = icon.GetAttribute<FontAwesomeCategoriesAttribute>();
return categoriesAttribute == null ? new string[] { } : categoriesAttribute.Categories; return categoriesAttribute == null ? [] : categoriesAttribute.Categories;
} }
} }

View file

@ -16,14 +16,7 @@ public static class FontAwesomeHelpers
/// <returns>list of font awesome icons.</returns> /// <returns>list of font awesome icons.</returns>
public static List<FontAwesomeIcon> GetIcons() public static List<FontAwesomeIcon> GetIcons()
{ {
var icons = new List<FontAwesomeIcon>(); return [.. Enum.GetValues<FontAwesomeIcon>().Where(icon => !icon.IsObsolete())];
foreach (var icon in Enum.GetValues(typeof(FontAwesomeIcon)).Cast<FontAwesomeIcon>().ToList())
{
if (icon.IsObsolete()) continue;
icons.Add(icon);
}
return icons;
} }
/// <summary> /// <summary>
@ -75,7 +68,7 @@ public static class FontAwesomeHelpers
{ {
var name = Enum.GetName(icon)?.ToLowerInvariant(); var name = Enum.GetName(icon)?.ToLowerInvariant();
var searchTerms = icon.GetSearchTerms(); var searchTerms = icon.GetSearchTerms();
if (name!.Contains(search.ToLowerInvariant()) || searchTerms.Contains(search.ToLowerInvariant())) if (name!.Contains(search, StringComparison.InvariantCultureIgnoreCase) || searchTerms.Contains(search.ToLowerInvariant()))
{ {
result.Add(icon); result.Add(icon);
} }
@ -105,7 +98,7 @@ public static class FontAwesomeHelpers
var name = Enum.GetName(icon)?.ToLowerInvariant(); var name = Enum.GetName(icon)?.ToLowerInvariant();
var searchTerms = icon.GetSearchTerms(); var searchTerms = icon.GetSearchTerms();
var categories = icon.GetCategories(); var categories = icon.GetCategories();
if ((name!.Contains(search.ToLowerInvariant()) || searchTerms.Contains(search.ToLowerInvariant())) && categories.Contains(category)) if ((name!.Contains(search, StringComparison.InvariantCultureIgnoreCase) || searchTerms.Contains(search.ToLowerInvariant())) && categories.Contains(category))
{ {
result.Add(icon); result.Add(icon);
} }

View file

@ -3,7 +3,9 @@ using System.Collections.Generic;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Dalamud.Interface.ManagedFontAtlas; using Dalamud.Interface.ManagedFontAtlas;
using Dalamud.Storage.Assets; using Dalamud.Storage.Assets;
using Newtonsoft.Json; using Newtonsoft.Json;
using TerraFX.Interop.DirectX; using TerraFX.Interop.DirectX;
namespace Dalamud.Interface.FontIdentifier; namespace Dalamud.Interface.FontIdentifier;

View file

@ -2,7 +2,9 @@ using System.Collections.Generic;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Dalamud.Interface.ManagedFontAtlas; using Dalamud.Interface.ManagedFontAtlas;
using Newtonsoft.Json; using Newtonsoft.Json;
using TerraFX.Interop.DirectX; using TerraFX.Interop.DirectX;
namespace Dalamud.Interface.FontIdentifier; namespace Dalamud.Interface.FontIdentifier;

View file

@ -3,7 +3,9 @@ using System.Collections.Generic;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Dalamud.Interface.GameFonts; using Dalamud.Interface.GameFonts;
using Dalamud.Interface.ManagedFontAtlas; using Dalamud.Interface.ManagedFontAtlas;
using Newtonsoft.Json; using Newtonsoft.Json;
using TerraFX.Interop.DirectX; using TerraFX.Interop.DirectX;
namespace Dalamud.Interface.FontIdentifier; namespace Dalamud.Interface.FontIdentifier;

View file

@ -36,26 +36,25 @@ public interface IFontFamilyId : IObjectWithLocalizableName
/// </summary> /// </summary>
/// <returns>The list of fonts.</returns> /// <returns>The list of fonts.</returns>
public static List<IFontFamilyId> ListDalamudFonts() => public static List<IFontFamilyId> ListDalamudFonts() =>
new() [
{
new DalamudAssetFontAndFamilyId(DalamudAsset.NotoSansJpMedium), new DalamudAssetFontAndFamilyId(DalamudAsset.NotoSansJpMedium),
new DalamudAssetFontAndFamilyId(DalamudAsset.InconsolataRegular), new DalamudAssetFontAndFamilyId(DalamudAsset.InconsolataRegular),
new DalamudAssetFontAndFamilyId(DalamudAsset.FontAwesomeFreeSolid), new DalamudAssetFontAndFamilyId(DalamudAsset.FontAwesomeFreeSolid),
}; ];
/// <summary> /// <summary>
/// Gets the list of Game-provided fonts. /// Gets the list of Game-provided fonts.
/// </summary> /// </summary>
/// <returns>The list of fonts.</returns> /// <returns>The list of fonts.</returns>
public static List<IFontFamilyId> ListGameFonts() => new() public static List<IFontFamilyId> ListGameFonts() =>
{ [
new GameFontAndFamilyId(GameFontFamily.Axis), new GameFontAndFamilyId(GameFontFamily.Axis),
new GameFontAndFamilyId(GameFontFamily.Jupiter), new GameFontAndFamilyId(GameFontFamily.Jupiter),
new GameFontAndFamilyId(GameFontFamily.JupiterNumeric), new GameFontAndFamilyId(GameFontFamily.JupiterNumeric),
new GameFontAndFamilyId(GameFontFamily.Meidinger), new GameFontAndFamilyId(GameFontFamily.Meidinger),
new GameFontAndFamilyId(GameFontFamily.MiedingerMid), new GameFontAndFamilyId(GameFontFamily.MiedingerMid),
new GameFontAndFamilyId(GameFontFamily.TrumpGothic), new GameFontAndFamilyId(GameFontFamily.TrumpGothic),
}; ];
/// <summary> /// <summary>
/// Gets the list of System-provided fonts. /// Gets the list of System-provided fonts.

View file

@ -6,6 +6,7 @@ using System.Text;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Dalamud.Interface.ManagedFontAtlas; using Dalamud.Interface.ManagedFontAtlas;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace Dalamud.Interface.FontIdentifier; namespace Dalamud.Interface.FontIdentifier;

View file

@ -83,7 +83,7 @@ public sealed class SystemFontFamilyId : IFontFamilyId
else if (candidates.Any(x => x.Style == (int)DWRITE_FONT_STYLE.DWRITE_FONT_STYLE_NORMAL)) else if (candidates.Any(x => x.Style == (int)DWRITE_FONT_STYLE.DWRITE_FONT_STYLE_NORMAL))
candidates.RemoveAll(x => x.Style != (int)DWRITE_FONT_STYLE.DWRITE_FONT_STYLE_NORMAL); candidates.RemoveAll(x => x.Style != (int)DWRITE_FONT_STYLE.DWRITE_FONT_STYLE_NORMAL);
if (!candidates.Any()) if (candidates.Count == 0)
return 0; return 0;
for (var i = 0; i < this.Fonts.Count; i++) for (var i = 0; i < this.Fonts.Count; i++)
@ -117,7 +117,7 @@ public sealed class SystemFontFamilyId : IFontFamilyId
return new(IObjectWithLocalizableName.GetLocaleNames(fn)); return new(IObjectWithLocalizableName.GetLocaleNames(fn));
} }
private unsafe IReadOnlyList<IFontId> GetFonts() private unsafe List<IFontId> GetFonts()
{ {
using var dwf = default(ComPtr<IDWriteFactory>); using var dwf = default(ComPtr<IDWriteFactory>);
fixed (Guid* piid = &IID.IID_IDWriteFactory) fixed (Guid* piid = &IID.IID_IDWriteFactory)

View file

@ -5,7 +5,9 @@ using System.Linq;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Dalamud.Interface.ManagedFontAtlas; using Dalamud.Interface.ManagedFontAtlas;
using Dalamud.Utility; using Dalamud.Utility;
using Newtonsoft.Json; using Newtonsoft.Json;
using TerraFX.Interop.DirectX; using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows; using TerraFX.Interop.Windows;

View file

@ -43,12 +43,12 @@ public class FdtReader
/// <summary> /// <summary>
/// Gets all the glyphs defined in this file. /// Gets all the glyphs defined in this file.
/// </summary> /// </summary>
public List<FontTableEntry> Glyphs { get; init; } = new(); public List<FontTableEntry> Glyphs { get; init; } = [];
/// <summary> /// <summary>
/// Gets all the kerning entries defined in this file. /// Gets all the kerning entries defined in this file.
/// </summary> /// </summary>
public List<KerningTableEntry> Distances { get; init; } = new(); public List<KerningTableEntry> Distances { get; init; } = [];
/// <summary> /// <summary>
/// Finds the glyph index for the corresponding codepoint. /// Finds the glyph index for the corresponding codepoint.
@ -269,7 +269,7 @@ public class FdtReader
/// <summary> /// <summary>
/// Mapping of texture channel index to byte index. /// Mapping of texture channel index to byte index.
/// </summary> /// </summary>
public static readonly int[] TextureChannelOrder = { 2, 1, 0, 3 }; public static readonly int[] TextureChannelOrder = [2, 1, 0, 3];
/// <summary> /// <summary>
/// Integer representation of a Unicode character in UTF-8 in reverse order, read in little endian. /// Integer representation of a Unicode character in UTF-8 in reverse order, read in little endian.

View file

@ -200,30 +200,25 @@ public class GameFontLayoutPlan
return false; return false;
// TODO: Whatever // TODO: Whatever
switch (char.GetUnicodeCategory((char)this.Codepoint)) return char.GetUnicodeCategory((char)this.Codepoint)
{ is System.Globalization.UnicodeCategory.SpaceSeparator
case System.Globalization.UnicodeCategory.SpaceSeparator: or System.Globalization.UnicodeCategory.LineSeparator
case System.Globalization.UnicodeCategory.LineSeparator: or System.Globalization.UnicodeCategory.ParagraphSeparator
case System.Globalization.UnicodeCategory.ParagraphSeparator: or System.Globalization.UnicodeCategory.Control
case System.Globalization.UnicodeCategory.Control: or System.Globalization.UnicodeCategory.Format
case System.Globalization.UnicodeCategory.Format: or System.Globalization.UnicodeCategory.Surrogate
case System.Globalization.UnicodeCategory.Surrogate: or System.Globalization.UnicodeCategory.PrivateUse
case System.Globalization.UnicodeCategory.PrivateUse: or System.Globalization.UnicodeCategory.ConnectorPunctuation
case System.Globalization.UnicodeCategory.ConnectorPunctuation: or System.Globalization.UnicodeCategory.DashPunctuation
case System.Globalization.UnicodeCategory.DashPunctuation: or System.Globalization.UnicodeCategory.OpenPunctuation
case System.Globalization.UnicodeCategory.OpenPunctuation: or System.Globalization.UnicodeCategory.ClosePunctuation
case System.Globalization.UnicodeCategory.ClosePunctuation: or System.Globalization.UnicodeCategory.InitialQuotePunctuation
case System.Globalization.UnicodeCategory.InitialQuotePunctuation: or System.Globalization.UnicodeCategory.FinalQuotePunctuation
case System.Globalization.UnicodeCategory.FinalQuotePunctuation: or System.Globalization.UnicodeCategory.OtherPunctuation
case System.Globalization.UnicodeCategory.OtherPunctuation: or System.Globalization.UnicodeCategory.MathSymbol
case System.Globalization.UnicodeCategory.MathSymbol: or System.Globalization.UnicodeCategory.ModifierSymbol
case System.Globalization.UnicodeCategory.ModifierSymbol: or System.Globalization.UnicodeCategory.OtherSymbol
case System.Globalization.UnicodeCategory.OtherSymbol: or System.Globalization.UnicodeCategory.OtherNotAssigned;
case System.Globalization.UnicodeCategory.OtherNotAssigned:
return true;
}
return false;
} }
} }
} }
@ -300,7 +295,7 @@ public class GameFontLayoutPlan
elements.Add(new() { Codepoint = c, Glyph = this.fdt.GetGlyph(c), }); elements.Add(new() { Codepoint = c, Glyph = this.fdt.GetGlyph(c), });
var lastBreakIndex = 0; var lastBreakIndex = 0;
List<int> lineBreakIndices = new() { 0 }; List<int> lineBreakIndices = [0];
for (var i = 1; i < elements.Count; i++) for (var i = 1; i < elements.Count; i++)
{ {
var prev = elements[i - 1]; var prev = elements[i - 1];

View file

@ -8,8 +8,8 @@ public static class GlyphRangesJapanese
/// <summary> /// <summary>
/// Gets the unicode glyph ranges for the Japanese language. /// Gets the unicode glyph ranges for the Japanese language.
/// </summary> /// </summary>
public static ushort[] GlyphRanges => new ushort[] public static ushort[] GlyphRanges =>
{ [
0x0020, 0x00FF, 0x0391, 0x03A1, 0x03A3, 0x03A9, 0x03B1, 0x03C1, 0x03C3, 0x03C9, 0x0401, 0x0401, 0x0410, 0x044F, 0x0451, 0x0451, 0x0020, 0x00FF, 0x0391, 0x03A1, 0x03A3, 0x03A9, 0x03B1, 0x03C1, 0x03C3, 0x03C9, 0x0401, 0x0401, 0x0410, 0x044F, 0x0451, 0x0451,
0x2000, 0x206F, 0x2103, 0x2103, 0x212B, 0x212B, 0x2190, 0x2193, 0x21D2, 0x21D2, 0x21D4, 0x21D4, 0x2200, 0x2200, 0x2202, 0x2203, 0x2000, 0x206F, 0x2103, 0x2103, 0x212B, 0x212B, 0x2190, 0x2193, 0x21D2, 0x21D2, 0x21D4, 0x21D4, 0x2200, 0x2200, 0x2202, 0x2203,
0x2207, 0x2208, 0x220B, 0x220B, 0x2212, 0x2212, 0x221A, 0x221A, 0x221D, 0x221E, 0x2220, 0x2220, 0x2227, 0x222C, 0x2234, 0x2235, 0x2207, 0x2208, 0x220B, 0x220B, 0x2212, 0x2212, 0x221A, 0x221A, 0x221D, 0x221E, 0x2220, 0x2220, 0x2227, 0x222C, 0x2234, 0x2235,
@ -524,5 +524,5 @@ public static class GlyphRangesJapanese
0x9F4E, 0x9F4F, 0x9F52, 0x9F52, 0x9F54, 0x9F54, 0x9F5F, 0x9F63, 0x9F66, 0x9F67, 0x9F6A, 0x9F6A, 0x9F6C, 0x9F6C, 0x9F72, 0x9F72, 0x9F4E, 0x9F4F, 0x9F52, 0x9F52, 0x9F54, 0x9F54, 0x9F5F, 0x9F63, 0x9F66, 0x9F67, 0x9F6A, 0x9F6A, 0x9F6C, 0x9F6C, 0x9F72, 0x9F72,
0x9F76, 0x9F77, 0x9F8D, 0x9F8D, 0x9F95, 0x9F95, 0x9F9C, 0x9F9D, 0x9FA0, 0x9FA0, 0xFF01, 0xFF01, 0xFF03, 0xFF06, 0xFF08, 0xFF0C, 0x9F76, 0x9F77, 0x9F8D, 0x9F8D, 0x9F95, 0x9F95, 0x9F9C, 0x9F9D, 0x9FA0, 0x9FA0, 0xFF01, 0xFF01, 0xFF03, 0xFF06, 0xFF08, 0xFF0C,
0xFF0E, 0xFF3B, 0xFF3D, 0xFF5D, 0xFF61, 0xFF9F, 0xFFE3, 0xFFE3, 0xFFE5, 0xFFE5, 0xFFFF, 0xFFFF, 0, 0xFF0E, 0xFF3B, 0xFF3D, 0xFF5D, 0xFF61, 0xFF9F, 0xFFE3, 0xFFE3, 0xFFE5, 0xFFE5, 0xFFFF, 0xFFFF, 0,
}; ];
} }

View file

@ -1,9 +1,4 @@
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Dalamud.Bindings.ImGuizmo; using Dalamud.Bindings.ImGuizmo;
@ -14,8 +9,6 @@ using Dalamud.Interface.ImGuiBackend.InputHandler;
using Dalamud.Interface.ImGuiBackend.Renderers; using Dalamud.Interface.ImGuiBackend.Renderers;
using Dalamud.Utility; using Dalamud.Utility;
using Serilog;
using TerraFX.Interop.DirectX; using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows; using TerraFX.Interop.Windows;

View file

@ -5,6 +5,7 @@ using System.Runtime.InteropServices;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Dalamud.Interface.ImGuiBackend.Helpers; using Dalamud.Interface.ImGuiBackend.Helpers;
using Dalamud.Utility; using Dalamud.Utility;
using TerraFX.Interop.DirectX; using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows; using TerraFX.Interop.Windows;

View file

@ -15,6 +15,7 @@ using Dalamud.Interface.Textures.TextureWraps;
using Dalamud.Interface.Textures.TextureWraps.Internal; using Dalamud.Interface.Textures.TextureWraps.Internal;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using Dalamud.Utility; using Dalamud.Utility;
using TerraFX.Interop.DirectX; using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows; using TerraFX.Interop.Windows;
@ -30,7 +31,7 @@ namespace Dalamud.Interface.ImGuiBackend.Renderers;
Justification = "Multiple fixed/using scopes")] Justification = "Multiple fixed/using scopes")]
internal unsafe partial class Dx11Renderer : IImGuiRenderer internal unsafe partial class Dx11Renderer : IImGuiRenderer
{ {
private readonly List<IDalamudTextureWrap> fontTextures = new(); private readonly List<IDalamudTextureWrap> fontTextures = [];
private readonly D3D_FEATURE_LEVEL featureLevel; private readonly D3D_FEATURE_LEVEL featureLevel;
private readonly ViewportHandler viewportHandler; private readonly ViewportHandler viewportHandler;
private readonly nint renderNamePtr; private readonly nint renderNamePtr;
@ -398,10 +399,9 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
/// </summary> /// </summary>
private void CreateFontsTexture() private void CreateFontsTexture()
{ {
if (this.device.IsEmpty()) ObjectDisposedException.ThrowIf(this.device.IsEmpty(), this);
throw new ObjectDisposedException(nameof(Dx11Renderer));
if (this.fontTextures.Any()) if (this.fontTextures.Count != 0)
return; return;
var io = ImGui.GetIO(); var io = ImGui.GetIO();
@ -479,8 +479,7 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
/// </summary> /// </summary>
private void EnsureDeviceObjects() private void EnsureDeviceObjects()
{ {
if (this.device.IsEmpty()) ObjectDisposedException.ThrowIf(this.device.IsEmpty(), this);
throw new ObjectDisposedException(nameof(Dx11Renderer));
var assembly = Assembly.GetExecutingAssembly(); var assembly = Assembly.GetExecutingAssembly();

View file

@ -1,6 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading;
using Dalamud.Utility; using Dalamud.Utility;
@ -11,7 +12,7 @@ namespace Dalamud.Interface.ImGuiFileDialog;
/// </summary> /// </summary>
public partial class FileDialog public partial class FileDialog
{ {
private readonly object filesLock = new(); private readonly Lock filesLock = new();
private readonly DriveListLoader driveListLoader = new(); private readonly DriveListLoader driveListLoader = new();

View file

@ -8,11 +8,12 @@ namespace Dalamud.Interface.ImGuiFileDialog;
/// </summary> /// </summary>
public partial class FileDialog public partial class FileDialog
{ {
private static Regex filterRegex = new(@"[^,{}]+(\{([^{}]*?)\})?", RegexOptions.Compiled); private List<FilterStruct> filters = [];
private List<FilterStruct> filters = new();
private FilterStruct selectedFilter; private FilterStruct selectedFilter;
[GeneratedRegex(@"[^,{}]+(\{([^{}]*?)\})?", RegexOptions.Compiled)]
private static partial Regex FilterRegex();
private void ParseFilters(string filters) private void ParseFilters(string filters)
{ {
// ".*,.cpp,.h,.hpp" // ".*,.cpp,.h,.hpp"
@ -22,13 +23,13 @@ public partial class FileDialog
if (filters.Length == 0) return; if (filters.Length == 0) return;
var currentFilterFound = false; var currentFilterFound = false;
var matches = filterRegex.Matches(filters); var matches = FilterRegex().Matches(filters);
foreach (Match m in matches) foreach (Match m in matches)
{ {
var match = m.Value; var match = m.Value;
var filter = default(FilterStruct); var filter = default(FilterStruct);
if (match.Contains("{")) if (match.Contains('{'))
{ {
var exts = m.Groups[2].Value; var exts = m.Groups[2].Value;
filter = new FilterStruct filter = new FilterStruct
@ -42,7 +43,7 @@ public partial class FileDialog
filter = new FilterStruct filter = new FilterStruct
{ {
Filter = match, Filter = match,
CollectionFilters = new(), CollectionFilters = [],
}; };
} }
@ -89,7 +90,7 @@ public partial class FileDialog
foreach (var file in this.files) foreach (var file in this.files)
{ {
var show = true; var show = true;
if (!string.IsNullOrEmpty(this.searchBuffer) && !file.FileName.ToLowerInvariant().Contains(this.searchBuffer.ToLowerInvariant())) if (!string.IsNullOrEmpty(this.searchBuffer) && !file.FileName.Contains(this.searchBuffer, StringComparison.InvariantCultureIgnoreCase))
{ {
show = false; show = false;
} }

View file

@ -12,7 +12,7 @@ public partial class FileDialog
private static string BytesToString(long byteCount) private static string BytesToString(long byteCount)
{ {
string[] suf = { " B", " KB", " MB", " GB", " TB" }; string[] suf = [" B", " KB", " MB", " GB", " TB"];
if (byteCount == 0) if (byteCount == 0)
return "0" + suf[0]; return "0" + suf[0];
var bytes = Math.Abs(byteCount); var bytes = Math.Abs(byteCount);

View file

@ -54,7 +54,7 @@ public partial class FileDialog
windowVisible = ImGui.Begin(name, ref this.visible, this.WindowFlags); windowVisible = ImGui.Begin(name, ref this.visible, this.WindowFlags);
} }
bool wasClosed = false; var wasClosed = false;
if (windowVisible) if (windowVisible)
{ {
if (!this.visible) if (!this.visible)
@ -122,15 +122,15 @@ public partial class FileDialog
{ {
if (iconMap == null) if (iconMap == null)
{ {
iconMap = new(); iconMap = [];
AddToIconMap(new[] { "mp4", "gif", "mov", "avi" }, FontAwesomeIcon.FileVideo, miscTextColor); AddToIconMap(["mp4", "gif", "mov", "avi"], FontAwesomeIcon.FileVideo, miscTextColor);
AddToIconMap(new[] { "pdf" }, FontAwesomeIcon.FilePdf, miscTextColor); AddToIconMap(["pdf"], FontAwesomeIcon.FilePdf, miscTextColor);
AddToIconMap(new[] { "png", "jpg", "jpeg", "tiff" }, FontAwesomeIcon.FileImage, imageTextColor); AddToIconMap(["png", "jpg", "jpeg", "tiff"], FontAwesomeIcon.FileImage, imageTextColor);
AddToIconMap(new[] { "cs", "json", "cpp", "h", "py", "xml", "yaml", "js", "html", "css", "ts", "java" }, FontAwesomeIcon.FileCode, codeTextColor); AddToIconMap(["cs", "json", "cpp", "h", "py", "xml", "yaml", "js", "html", "css", "ts", "java"], FontAwesomeIcon.FileCode, codeTextColor);
AddToIconMap(new[] { "txt", "md" }, FontAwesomeIcon.FileAlt, standardTextColor); AddToIconMap(["txt", "md"], FontAwesomeIcon.FileAlt, standardTextColor);
AddToIconMap(new[] { "zip", "7z", "gz", "tar" }, FontAwesomeIcon.FileArchive, miscTextColor); AddToIconMap(["zip", "7z", "gz", "tar"], FontAwesomeIcon.FileArchive, miscTextColor);
AddToIconMap(new[] { "mp3", "m4a", "ogg", "wav" }, FontAwesomeIcon.FileAudio, miscTextColor); AddToIconMap(["mp3", "m4a", "ogg", "wav"], FontAwesomeIcon.FileAudio, miscTextColor);
AddToIconMap(new[] { "csv" }, FontAwesomeIcon.FileCsv, miscTextColor); AddToIconMap(["csv"], FontAwesomeIcon.FileCsv, miscTextColor);
} }
return iconMap.TryGetValue(ext.ToLowerInvariant(), out var icon) ? icon : new IconColorItem return iconMap.TryGetValue(ext.ToLowerInvariant(), out var icon) ? icon : new IconColorItem

View file

@ -30,7 +30,7 @@ public partial class FileDialog
private string currentPath; private string currentPath;
private string fileNameBuffer = string.Empty; private string fileNameBuffer = string.Empty;
private List<string> pathDecomposition = new(); private List<string> pathDecomposition = [];
private bool pathClicked = true; private bool pathClicked = true;
private bool pathInputActivated = false; private bool pathInputActivated = false;
private string pathInputBuffer = string.Empty; private string pathInputBuffer = string.Empty;
@ -46,12 +46,12 @@ public partial class FileDialog
private string searchBuffer = string.Empty; private string searchBuffer = string.Empty;
private string lastSelectedFileName = string.Empty; private string lastSelectedFileName = string.Empty;
private List<string> selectedFileNames = new(); private List<string> selectedFileNames = [];
private float footerHeight = 0; private float footerHeight = 0;
private string selectedSideBar = string.Empty; private string selectedSideBar = string.Empty;
private List<SideBarItem> quickAccess = new(); private List<SideBarItem> quickAccess = [];
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="FileDialog"/> class. /// Initializes a new instance of the <see cref="FileDialog"/> class.
@ -130,12 +130,12 @@ public partial class FileDialog
{ {
if (!this.flags.HasFlag(ImGuiFileDialogFlags.SelectOnly)) if (!this.flags.HasFlag(ImGuiFileDialogFlags.SelectOnly))
{ {
return new List<string> { this.GetFilePathName() }; return [this.GetFilePathName()];
} }
if (this.IsDirectoryMode() && this.selectedFileNames.Count == 0) if (this.IsDirectoryMode() && this.selectedFileNames.Count == 0)
{ {
return new List<string> { 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)); var fullPaths = this.selectedFileNames.Where(x => !string.IsNullOrEmpty(x)).Select(x => Path.Combine(this.currentPath, x));

View file

@ -13,6 +13,7 @@ using Dalamud.Interface.ManagedFontAtlas;
using Dalamud.Interface.ManagedFontAtlas.Internals; using Dalamud.Interface.ManagedFontAtlas.Internals;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using Dalamud.Utility; using Dalamud.Utility;
using TerraFX.Interop.DirectX; using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows; using TerraFX.Interop.Windows;
@ -31,10 +32,10 @@ public sealed class SingleFontChooserDialog : IDisposable
private const float MaxFontSizePt = 127; private const float MaxFontSizePt = 127;
private static readonly List<IFontId> EmptyIFontList = new(); private static readonly List<IFontId> EmptyIFontList = [];
private static readonly (string Name, float Value)[] FontSizeList = private static readonly (string Name, float Value)[] FontSizeList =
{ [
("9.6", 9.6f), ("9.6", 9.6f),
("10", 10f), ("10", 10f),
("12", 12f), ("12", 12f),
@ -51,7 +52,7 @@ public sealed class SingleFontChooserDialog : IDisposable
("46", 46), ("46", 46),
("68", 68), ("68", 68),
("90", 90), ("90", 90),
}; ];
private static int counterStatic; private static int counterStatic;
@ -1235,7 +1236,7 @@ public sealed class SingleFontChooserDialog : IDisposable
} }
private void UpdateSelectedFamilyAndFontIndices( private void UpdateSelectedFamilyAndFontIndices(
IReadOnlyList<IFontFamilyId> fonts, List<IFontFamilyId> fonts,
string familyName, string familyName,
string fontName) string fontName)
{ {

View file

@ -26,8 +26,8 @@ internal class NotificationManager : INotificationManager, IInternalDisposableSe
[ServiceManager.ServiceDependency] [ServiceManager.ServiceDependency]
private readonly DalamudConfiguration configuration = Service<DalamudConfiguration>.Get(); private readonly DalamudConfiguration configuration = Service<DalamudConfiguration>.Get();
private readonly List<ActiveNotification> notifications = new(); private readonly List<ActiveNotification> notifications = [];
private readonly ConcurrentBag<ActiveNotification> pendingNotifications = new(); private readonly ConcurrentBag<ActiveNotification> pendingNotifications = [];
private NotificationPositionChooser? positionChooser; private NotificationPositionChooser? positionChooser;

View file

@ -1,9 +1,5 @@
using System.Threading.Tasks;
using Dalamud.Interface.ImGuiNotification.Internal; using Dalamud.Interface.ImGuiNotification.Internal;
using Dalamud.Interface.Textures; using Dalamud.Interface.Textures;
using Dalamud.Interface.Textures.TextureWraps;
using Serilog;
namespace Dalamud.Interface.ImGuiNotification; namespace Dalamud.Interface.ImGuiNotification;
/// <summary>Represents a blueprint for a notification.</summary> /// <summary>Represents a blueprint for a notification.</summary>

Some files were not shown because too many files have changed in this diff Show more