mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
fix warnings in Dalamud
This commit is contained in:
parent
b9101a55e8
commit
166301f56f
24 changed files with 124 additions and 98 deletions
|
|
@ -6,12 +6,12 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
// General
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1118:Parameter should not span multiple lines", Justification = "Preventing long lines", Scope = "namespaceanddescendants", Target = "~N:Dalamud")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1124:Do not use regions", Justification = "I like regions", Scope = "namespaceanddescendants", Target = "~N:Dalamud")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1123:Do not place regions within elements", Justification = "I like regions in elements too", Scope = "namespaceanddescendants", Target = "~N:Dalamud")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "This is annoying", Scope = "namespaceanddescendants", Target = "~N:Dalamud")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1512:Single-line comments should not be followed by blank line", Justification = "I like this better", Scope = "namespaceanddescendants", Target = "~N:Dalamud")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1515:Single-line comment should be preceded by blank line", Justification = "I like this better", Scope = "namespaceanddescendants", Target = "~N:Dalamud")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1127:Generic type constraints should be on their own line", Justification = "I like this better", Scope = "namespaceanddescendants", Target = "~N:Dalamud")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "I like this better", Scope = "namespaceanddescendants", Target = "~N:Dalamud")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1118:Parameter should not span multiple lines", Justification = "Preventing long lines")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1124:Do not use regions", Justification = "I like regions")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1123:Do not place regions within elements", Justification = "I like regions in elements too")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "This is annoying")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1512:Single-line comments should not be followed by blank line", Justification = "I like this better")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1515:Single-line comment should be preceded by blank line", Justification = "I like this better")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1127:Generic type constraints should be on their own line", Justification = "I like this better")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "I like this better")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1633:File should have header", Justification = "We don't do those yet")]
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using System.Diagnostics.CodeAnalysis;
|
|||
|
||||
// General
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1633:File should have header", Justification = "We don't do those yet")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "This is annoying", Scope = "namespaceanddescendants", Target = "~N:Dalamud")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1512:Single-line comments should not be followed by blank line", Justification = "I like this better", Scope = "namespaceanddescendants", Target = "~N:Dalamud")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1515:Single-line comment should be preceded by blank line", Justification = "I like this better", Scope = "namespaceanddescendants", Target = "~N:Dalamud")]
|
||||
[assembly: SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "I'll make what I want static", Scope = "namespaceanddescendants", Target = "~N:Dalamud")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "This is annoying")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1512:Single-line comments should not be followed by blank line", Justification = "I like this better")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1515:Single-line comment should be preceded by blank line", Justification = "I like this better")]
|
||||
[assembly: SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "I'll make what I want static")]
|
||||
|
|
|
|||
|
|
@ -248,7 +248,8 @@ public class ChatHandlers : IServiceType
|
|||
|
||||
var assemblyVersion = Assembly.GetAssembly(typeof(ChatHandlers)).GetName().Version.ToString();
|
||||
|
||||
if (this.configuration.PrintDalamudWelcomeMsg) {
|
||||
if (this.configuration.PrintDalamudWelcomeMsg)
|
||||
{
|
||||
chatGui.Print(string.Format(Loc.Localize("DalamudWelcome", "Dalamud vD{0} loaded."), assemblyVersion)
|
||||
+ string.Format(Loc.Localize("PluginsWelcome", " {0} plugin(s) loaded."), pluginManager.InstalledPlugins.Count(x => x.IsLoaded)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public enum BattleNpcSubKind : byte
|
|||
|
||||
/// <summary>
|
||||
/// Weak Spots / Battle NPC parts
|
||||
/// Eg: Titan's Heart (Naval), Tioman's left and right wing (Sohm Al), Golem Soulstone (The Sunken Temple of Qarn)
|
||||
/// Eg: Titan's Heart (Naval), Tioman's left and right wing (Sohm Al), Golem Soulstone (The Sunken Temple of Qarn).
|
||||
/// </summary>
|
||||
BattleNpcPart = 1,
|
||||
|
||||
|
|
|
|||
|
|
@ -22,42 +22,42 @@ public unsafe class BattleChara : Character
|
|||
/// <summary>
|
||||
/// Gets the current status effects.
|
||||
/// </summary>
|
||||
public StatusList StatusList => new(&this.Struct->StatusManager);
|
||||
public StatusList StatusList => new(this.Struct->GetStatusManager);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the chara is currently casting.
|
||||
/// </summary>
|
||||
public bool IsCasting => this.Struct->SpellCastInfo.IsCasting > 0;
|
||||
public bool IsCasting => this.Struct->GetCastInfo->IsCasting > 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the cast is interruptible.
|
||||
/// </summary>
|
||||
public bool IsCastInterruptible => this.Struct->SpellCastInfo.Interruptible > 0;
|
||||
public bool IsCastInterruptible => this.Struct->GetCastInfo->Interruptible > 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the spell action type of the spell being cast by the actor.
|
||||
/// </summary>
|
||||
public byte CastActionType => (byte)this.Struct->SpellCastInfo.ActionType;
|
||||
public byte CastActionType => (byte)this.Struct->GetCastInfo->ActionType;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the spell action ID of the spell being cast by the actor.
|
||||
/// </summary>
|
||||
public uint CastActionId => this.Struct->SpellCastInfo.ActionID;
|
||||
public uint CastActionId => this.Struct->GetCastInfo->ActionID;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the object ID of the target currently being cast at by the chara.
|
||||
/// </summary>
|
||||
public uint CastTargetObjectId => this.Struct->SpellCastInfo.CastTargetID;
|
||||
public uint CastTargetObjectId => this.Struct->GetCastInfo->CastTargetID;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current casting time of the spell being cast by the chara.
|
||||
/// </summary>
|
||||
public float CurrentCastTime => this.Struct->SpellCastInfo.CurrentCastTime;
|
||||
public float CurrentCastTime => this.Struct->GetCastInfo->CurrentCastTime;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the total casting time of the spell being cast by the chara.
|
||||
/// </summary>
|
||||
public float TotalCastTime => this.Struct->SpellCastInfo.TotalCastTime;
|
||||
public float TotalCastTime => this.Struct->GetCastInfo->TotalCastTime;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the underlying structure.
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public unsafe class Character : GameObject
|
|||
/// Gets a byte array describing the visual appearance of this Chara.
|
||||
/// Indexed by <see cref="CustomizeIndex"/>.
|
||||
/// </summary>
|
||||
public byte[] Customize => MemoryHelper.Read<byte>((IntPtr)this.Struct->CustomizeData, 28);
|
||||
public byte[] Customize => MemoryHelper.Read<byte>((IntPtr)this.Struct->DrawData.CustomizeData.Data, 28);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Free Company tag of this chara.
|
||||
|
|
|
|||
|
|
@ -67,7 +67,8 @@ public class GameConfigSection
|
|||
/// <param name="name">Name of the config option.</param>
|
||||
/// <param name="value">The returned value of the config option.</param>
|
||||
/// <returns>A value representing the success.</returns>
|
||||
public unsafe bool TryGetBool(string name, out bool value) {
|
||||
public unsafe bool TryGetBool(string name, out bool value)
|
||||
{
|
||||
value = false;
|
||||
if (!this.TryGetIndex(name, out var index))
|
||||
{
|
||||
|
|
@ -97,7 +98,8 @@ public class GameConfigSection
|
|||
/// <param name="name">Name of the config option.</param>
|
||||
/// <returns>Value of the config option.</returns>
|
||||
/// <exception cref="ConfigOptionNotFoundException">Thrown if the config option is not found.</exception>
|
||||
public bool GetBool(string name) {
|
||||
public bool GetBool(string name)
|
||||
{
|
||||
if (!this.TryGetBool(name, out var value))
|
||||
{
|
||||
throw new ConfigOptionNotFoundException(this.SectionName, name);
|
||||
|
|
@ -114,7 +116,8 @@ public class GameConfigSection
|
|||
/// <param name="value">New value of the config option.</param>
|
||||
/// <exception cref="ConfigOptionNotFoundException">Throw if the config option is not found.</exception>
|
||||
/// <exception cref="UnreachableException">Thrown if the name of the config option is found, but the struct was not.</exception>
|
||||
public unsafe void Set(string name, bool value) {
|
||||
public unsafe void Set(string name, bool value)
|
||||
{
|
||||
if (!this.TryGetIndex(name, out var index))
|
||||
{
|
||||
throw new ConfigOptionNotFoundException(this.SectionName, name);
|
||||
|
|
@ -139,7 +142,8 @@ public class GameConfigSection
|
|||
/// <param name="name">Name of the config option.</param>
|
||||
/// <param name="value">The returned value of the config option.</param>
|
||||
/// <returns>A value representing the success.</returns>
|
||||
public unsafe bool TryGetUInt(string name, out uint value) {
|
||||
public unsafe bool TryGetUInt(string name, out uint value)
|
||||
{
|
||||
value = 0;
|
||||
if (!this.TryGetIndex(name, out var index))
|
||||
{
|
||||
|
|
@ -169,7 +173,8 @@ public class GameConfigSection
|
|||
/// <param name="name">Name of the config option.</param>
|
||||
/// <returns>Value of the config option.</returns>
|
||||
/// <exception cref="ConfigOptionNotFoundException">Thrown if the config option is not found.</exception>
|
||||
public uint GetUInt(string name) {
|
||||
public uint GetUInt(string name)
|
||||
{
|
||||
if (!this.TryGetUInt(name, out var value))
|
||||
{
|
||||
throw new ConfigOptionNotFoundException(this.SectionName, name);
|
||||
|
|
@ -186,8 +191,10 @@ public class GameConfigSection
|
|||
/// <param name="value">New value of the config option.</param>
|
||||
/// <exception cref="ConfigOptionNotFoundException">Throw if the config option is not found.</exception>
|
||||
/// <exception cref="UnreachableException">Thrown if the name of the config option is found, but the struct was not.</exception>
|
||||
public unsafe void Set(string name, uint value) {
|
||||
this.framework.RunOnFrameworkThread(() => {
|
||||
public unsafe void Set(string name, uint value)
|
||||
{
|
||||
this.framework.RunOnFrameworkThread(() =>
|
||||
{
|
||||
if (!this.TryGetIndex(name, out var index))
|
||||
{
|
||||
throw new ConfigOptionNotFoundException(this.SectionName, name);
|
||||
|
|
@ -213,7 +220,8 @@ public class GameConfigSection
|
|||
/// <param name="name">Name of the config option.</param>
|
||||
/// <param name="value">The returned value of the config option.</param>
|
||||
/// <returns>A value representing the success.</returns>
|
||||
public unsafe bool TryGetFloat(string name, out float value) {
|
||||
public unsafe bool TryGetFloat(string name, out float value)
|
||||
{
|
||||
value = 0;
|
||||
if (!this.TryGetIndex(name, out var index))
|
||||
{
|
||||
|
|
@ -243,7 +251,8 @@ public class GameConfigSection
|
|||
/// <param name="name">Name of the config option.</param>
|
||||
/// <returns>Value of the config option.</returns>
|
||||
/// <exception cref="ConfigOptionNotFoundException">Thrown if the config option is not found.</exception>
|
||||
public float GetFloat(string name) {
|
||||
public float GetFloat(string name)
|
||||
{
|
||||
if (!this.TryGetFloat(name, out var value))
|
||||
{
|
||||
throw new ConfigOptionNotFoundException(this.SectionName, name);
|
||||
|
|
@ -260,8 +269,10 @@ public class GameConfigSection
|
|||
/// <param name="value">New value of the config option.</param>
|
||||
/// <exception cref="ConfigOptionNotFoundException">Throw if the config option is not found.</exception>
|
||||
/// <exception cref="UnreachableException">Thrown if the name of the config option is found, but the struct was not.</exception>
|
||||
public unsafe void Set(string name, float value) {
|
||||
this.framework.RunOnFrameworkThread(() => {
|
||||
public unsafe void Set(string name, float value)
|
||||
{
|
||||
this.framework.RunOnFrameworkThread(() =>
|
||||
{
|
||||
if (!this.TryGetIndex(name, out var index))
|
||||
{
|
||||
throw new ConfigOptionNotFoundException(this.SectionName, name);
|
||||
|
|
@ -287,7 +298,8 @@ public class GameConfigSection
|
|||
/// <param name="name">Name of the config option.</param>
|
||||
/// <param name="value">The returned value of the config option.</param>
|
||||
/// <returns>A value representing the success.</returns>
|
||||
public unsafe bool TryGetString(string name, out string value) {
|
||||
public unsafe bool TryGetString(string name, out string value)
|
||||
{
|
||||
value = string.Empty;
|
||||
if (!this.TryGetIndex(name, out var index))
|
||||
{
|
||||
|
|
@ -327,7 +339,8 @@ public class GameConfigSection
|
|||
/// <param name="name">Name of the config option.</param>
|
||||
/// <returns>Value of the config option.</returns>
|
||||
/// <exception cref="ConfigOptionNotFoundException">Thrown if the config option is not found.</exception>
|
||||
public string GetString(string name) {
|
||||
public string GetString(string name)
|
||||
{
|
||||
if (!this.TryGetString(name, out var value))
|
||||
{
|
||||
throw new ConfigOptionNotFoundException(this.SectionName, name);
|
||||
|
|
@ -344,8 +357,10 @@ public class GameConfigSection
|
|||
/// <param name="value">New value of the config option.</param>
|
||||
/// <exception cref="ConfigOptionNotFoundException">Throw if the config option is not found.</exception>
|
||||
/// <exception cref="UnreachableException">Thrown if the name of the config option is found, but the struct was not.</exception>
|
||||
public unsafe void Set(string name, string value) {
|
||||
this.framework.RunOnFrameworkThread(() => {
|
||||
public unsafe void Set(string name, string value)
|
||||
{
|
||||
this.framework.RunOnFrameworkThread(() =>
|
||||
{
|
||||
if (!this.TryGetIndex(name, out var index))
|
||||
{
|
||||
throw new ConfigOptionNotFoundException(this.SectionName, name);
|
||||
|
|
@ -365,7 +380,8 @@ public class GameConfigSection
|
|||
});
|
||||
}
|
||||
|
||||
private unsafe bool TryGetIndex(string name, out uint index) {
|
||||
private unsafe bool TryGetIndex(string name, out uint index)
|
||||
{
|
||||
if (this.indexMap.TryGetValue(name, out index))
|
||||
{
|
||||
return true;
|
||||
|
|
@ -373,14 +389,16 @@ public class GameConfigSection
|
|||
|
||||
var configBase = this.GetConfigBase();
|
||||
var e = configBase->ConfigEntry;
|
||||
for (var i = 0U; i < configBase->ConfigCount; i++, e++) {
|
||||
for (var i = 0U; i < configBase->ConfigCount; i++, e++)
|
||||
{
|
||||
if (e->Name == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var eName = MemoryHelper.ReadStringNullTerminated(new IntPtr(e->Name));
|
||||
if (eName.Equals(name)) {
|
||||
if (eName.Equals(name))
|
||||
{
|
||||
this.indexMap.TryAdd(name, i);
|
||||
this.nameMap.TryAdd(i, name);
|
||||
index = i;
|
||||
|
|
@ -392,7 +410,8 @@ public class GameConfigSection
|
|||
return false;
|
||||
}
|
||||
|
||||
private unsafe bool TryGetEntry(uint index, out ConfigEntry* entry) {
|
||||
private unsafe bool TryGetEntry(uint index, out ConfigEntry* entry)
|
||||
{
|
||||
entry = null;
|
||||
var configBase = this.GetConfigBase();
|
||||
if (configBase->ConfigEntry == null || index >= configBase->ConfigCount)
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ namespace Dalamud.Game;
|
|||
[ServiceManager.BlockingEarlyLoadedService]
|
||||
public sealed class Framework : IDisposable, IServiceType
|
||||
{
|
||||
private readonly GameLifecycle lifecycle;
|
||||
private static readonly Stopwatch StatsStopwatch = new();
|
||||
|
||||
private static Stopwatch statsStopwatch = new();
|
||||
private readonly GameLifecycle lifecycle;
|
||||
|
||||
private readonly Stopwatch updateStopwatch = new();
|
||||
private readonly HitchDetector hitchDetector;
|
||||
|
|
@ -35,15 +35,15 @@ public sealed class Framework : IDisposable, IServiceType
|
|||
private readonly Hook<OnUpdateDetour> updateHook;
|
||||
private readonly Hook<OnRealDestroyDelegate> destroyHook;
|
||||
|
||||
[ServiceManager.ServiceDependency]
|
||||
private readonly DalamudConfiguration configuration = Service<DalamudConfiguration>.Get();
|
||||
|
||||
private readonly object runOnNextTickTaskListSync = new();
|
||||
private List<RunOnNextTickTaskBase> runOnNextTickTaskList = new();
|
||||
private List<RunOnNextTickTaskBase> runOnNextTickTaskList2 = new();
|
||||
|
||||
private Thread? frameworkUpdateThread;
|
||||
|
||||
[ServiceManager.ServiceDependency]
|
||||
private readonly DalamudConfiguration configuration = Service<DalamudConfiguration>.Get();
|
||||
|
||||
[ServiceManager.ServiceConstructor]
|
||||
private Framework(SigScanner sigScanner, GameLifecycle lifecycle)
|
||||
{
|
||||
|
|
@ -346,7 +346,7 @@ public sealed class Framework : IDisposable, IServiceType
|
|||
this.destroyHook.Dispose();
|
||||
|
||||
this.updateStopwatch.Reset();
|
||||
statsStopwatch.Reset();
|
||||
StatsStopwatch.Reset();
|
||||
}
|
||||
|
||||
[ServiceManager.CallWhenServicesReady]
|
||||
|
|
@ -420,11 +420,11 @@ public sealed class Framework : IDisposable, IServiceType
|
|||
|
||||
if (StatsEnabled)
|
||||
{
|
||||
statsStopwatch.Restart();
|
||||
StatsStopwatch.Restart();
|
||||
this.RunPendingTickTasks();
|
||||
statsStopwatch.Stop();
|
||||
StatsStopwatch.Stop();
|
||||
|
||||
AddToStats(nameof(this.RunPendingTickTasks), statsStopwatch.Elapsed.TotalMilliseconds);
|
||||
AddToStats(nameof(this.RunPendingTickTasks), StatsStopwatch.Elapsed.TotalMilliseconds);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -440,7 +440,7 @@ public sealed class Framework : IDisposable, IServiceType
|
|||
// Individually invoke OnUpdate handlers and time them.
|
||||
foreach (var d in invokeList)
|
||||
{
|
||||
statsStopwatch.Restart();
|
||||
StatsStopwatch.Restart();
|
||||
try
|
||||
{
|
||||
d.Method.Invoke(d.Target, new object[] { this });
|
||||
|
|
@ -450,13 +450,13 @@ public sealed class Framework : IDisposable, IServiceType
|
|||
Log.Error(ex, "Exception while dispatching Framework::Update event.");
|
||||
}
|
||||
|
||||
statsStopwatch.Stop();
|
||||
StatsStopwatch.Stop();
|
||||
|
||||
var key = $"{d.Target}::{d.Method.Name}";
|
||||
if (notUpdated.Contains(key))
|
||||
notUpdated.Remove(key);
|
||||
|
||||
AddToStats(key, statsStopwatch.Elapsed.TotalMilliseconds);
|
||||
AddToStats(key, StatsStopwatch.Elapsed.TotalMilliseconds);
|
||||
}
|
||||
|
||||
// Cleanup handlers that are no longer being called
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using Dalamud.Configuration.Internal;
|
||||
using Dalamud.Hooking;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.IoC.Internal;
|
||||
using Dalamud.Utility;
|
||||
using Serilog;
|
||||
using Serilog.Core;
|
||||
|
||||
namespace Dalamud.Game.Network;
|
||||
|
||||
|
|
@ -26,11 +25,11 @@ public sealed class GameNetwork : IDisposable, IServiceType
|
|||
private readonly HitchDetector hitchDetectorUp;
|
||||
private readonly HitchDetector hitchDetectorDown;
|
||||
|
||||
private IntPtr baseAddress;
|
||||
|
||||
[ServiceManager.ServiceDependency]
|
||||
private readonly DalamudConfiguration configuration = Service<DalamudConfiguration>.Get();
|
||||
|
||||
private IntPtr baseAddress;
|
||||
|
||||
[ServiceManager.ServiceConstructor]
|
||||
private GameNetwork(SigScanner sigScanner)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
// General
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1118:Parameter should not span multiple lines", Justification = "Preventing long lines", Scope = "namespaceanddescendants", Target = "~N:Dalamud")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1124:Do not use regions", Justification = "I like regions", Scope = "namespaceanddescendants", Target = "~N:Dalamud")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1123:Do not place regions within elements", Justification = "I like regions in elements too", Scope = "namespaceanddescendants", Target = "~N:Dalamud")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "This is annoying", Scope = "namespaceanddescendants", Target = "~N:Dalamud")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1512:Single-line comments should not be followed by blank line", Justification = "I like this better", Scope = "namespaceanddescendants", Target = "~N:Dalamud")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1515:Single-line comment should be preceded by blank line", Justification = "I like this better", Scope = "namespaceanddescendants", Target = "~N:Dalamud")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1127:Generic type constraints should be on their own line", Justification = "I like this better", Scope = "namespaceanddescendants", Target = "~N:Dalamud")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1028:Code should not contain trailing whitespace", Justification = "I don't care anymore", Scope = "namespaceanddescendants", Target = "~N:Dalamud")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1118:Parameter should not span multiple lines", Justification = "Preventing long lines")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1124:Do not use regions", Justification = "I like regions")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1123:Do not place regions within elements", Justification = "I like regions in elements too")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "This is annoying")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1512:Single-line comments should not be followed by blank line", Justification = "I like this better")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1515:Single-line comment should be preceded by blank line", Justification = "I like this better")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1127:Generic type constraints should be on their own line", Justification = "I like this better")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1028:Code should not contain trailing whitespace", Justification = "I don't care anymore")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1633:File should have header", Justification = "We don't do those yet")]
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace Dalamud.Hooking.Internal;
|
|||
internal class HookManager : IDisposable, IServiceType
|
||||
{
|
||||
/// <summary>
|
||||
/// Logger shared with <see cref="Unhooker"/>
|
||||
/// Logger shared with <see cref="Unhooker"/>.
|
||||
/// </summary>
|
||||
internal static readonly ModuleLog Log = new("HM");
|
||||
|
||||
|
|
@ -41,6 +41,11 @@ internal class HookManager : IDisposable, IServiceType
|
|||
/// </summary>
|
||||
internal static ConcurrentDictionary<IntPtr, Unhooker> Unhookers { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a static dictionary of the number of hooks on a given address.
|
||||
/// </summary>
|
||||
internal static ConcurrentDictionary<IntPtr, List<IDalamudHook?>> MultiHookTracker { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new Unhooker instance for the provided address if no such unhooker was already registered, or returns
|
||||
/// an existing instance if the address was registered previously. By default, the unhooker will restore between 0
|
||||
|
|
@ -68,11 +73,6 @@ internal class HookManager : IDisposable, IServiceType
|
|||
return Unhookers.GetOrAdd(address, _ => new Unhooker(address, minBytes, maxBytes));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a static dictionary of the number of hooks on a given address.
|
||||
/// </summary>
|
||||
internal static ConcurrentDictionary<IntPtr, List<IDalamudHook?>> MultiHookTracker { get; } = new();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Dispose()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1792,7 +1792,8 @@ internal class DataWindow : Window
|
|||
ImGui.TableNextColumn();
|
||||
ImGui.TextUnformatted(string.Join(", ", share.Users));
|
||||
}
|
||||
} finally
|
||||
}
|
||||
finally
|
||||
{
|
||||
ImGui.EndTable();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Net.Http.Json;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Dalamud.Networking.Http;
|
||||
using Dalamud.Plugin.Internal;
|
||||
using Dalamud.Utility;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,15 @@ internal sealed class SettingsEntry<T> : SettingsEntry
|
|||
private object? valueBacking;
|
||||
private object? fallbackValue;
|
||||
|
||||
public SettingsEntry(string name, string description, LoadSettingDelegate load, SaveSettingDelegate save, Action<T?>? change = null, Func<T?, string?>? warning = null, Func<T?, string?>? validity = null, Func<bool>? visibility = null,
|
||||
public SettingsEntry(
|
||||
string name,
|
||||
string description,
|
||||
LoadSettingDelegate load,
|
||||
SaveSettingDelegate save,
|
||||
Action<T?>? change = null,
|
||||
Func<T?, string?>? warning = null,
|
||||
Func<T?, string?>? validity = null,
|
||||
Func<bool>? visibility = null,
|
||||
object? fallbackValue = null)
|
||||
{
|
||||
this.load = load;
|
||||
|
|
|
|||
|
|
@ -254,7 +254,6 @@ internal class TitleScreenMenuWindow : Window, IDisposable
|
|||
|
||||
var initialCursor = ImGui.GetCursorPos();
|
||||
|
||||
|
||||
using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, (float)shadeEasing.Value))
|
||||
{
|
||||
ImGui.Image(this.shadeTexture.ImGuiHandle, new Vector2(this.shadeTexture.Width * scale, this.shadeTexture.Height * scale));
|
||||
|
|
|
|||
|
|
@ -31,12 +31,12 @@ public sealed class UiBuilder : IDisposable
|
|||
private readonly InterfaceManager interfaceManager = Service<InterfaceManager>.Get();
|
||||
private readonly GameFontManager gameFontManager = Service<GameFontManager>.Get();
|
||||
|
||||
private bool hasErrorWindow = false;
|
||||
private bool lastFrameUiHideState = false;
|
||||
|
||||
[ServiceManager.ServiceDependency]
|
||||
private readonly DalamudConfiguration configuration = Service<DalamudConfiguration>.Get();
|
||||
|
||||
private bool hasErrorWindow = false;
|
||||
private bool lastFrameUiHideState = false;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UiBuilder"/> class and registers it.
|
||||
/// You do not have to call this manually.
|
||||
|
|
|
|||
|
|
@ -277,6 +277,12 @@ public class PluginLog : IServiceType, IDisposable
|
|||
public static void LogRaw(LogEventLevel level, Exception? exception, string messageTemplate, params object[] values)
|
||||
=> WriteLog(Assembly.GetCallingAssembly().GetName().Name, level, messageTemplate, exception, values);
|
||||
|
||||
/// <inheritdoc/>
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
#region New instanced methods
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -290,12 +296,6 @@ public class PluginLog : IServiceType, IDisposable
|
|||
|
||||
#endregion
|
||||
|
||||
/// <inheritdoc/>
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
private static ILogger GetPluginLogger(string? pluginName)
|
||||
{
|
||||
return Serilog.Log.ForContext("SourceContext", pluginName ?? string.Empty);
|
||||
|
|
|
|||
|
|
@ -1132,6 +1132,7 @@ internal static partial class NativeFunctions
|
|||
/// <summary>
|
||||
/// Native kernel32 functions.
|
||||
/// </summary>
|
||||
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1629:Documentation text should end with a period", Justification = "Stupid rule")]
|
||||
internal static partial class NativeFunctions
|
||||
{
|
||||
/// <summary>
|
||||
|
|
@ -1394,7 +1395,7 @@ internal static partial class NativeFunctions
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// HEAP_* from heapapi
|
||||
/// HEAP_* from heapapi.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum HeapOptions
|
||||
|
|
|
|||
|
|
@ -61,7 +61,6 @@ internal partial class PluginManager : IDisposable, IServiceType
|
|||
|
||||
private readonly object pluginListLock = new();
|
||||
private readonly DirectoryInfo pluginDirectory;
|
||||
private readonly DirectoryInfo devPluginDirectory;
|
||||
private readonly BannedPlugin[]? bannedPlugins;
|
||||
|
||||
private readonly DalamudLinkPayload openInstallerWindowPluginChangelogsLink;
|
||||
|
|
|
|||
|
|
@ -16,18 +16,15 @@ using JetBrains.Annotations;
|
|||
|
||||
namespace Dalamud;
|
||||
|
||||
// TODO:
|
||||
// - Unify dependency walking code(load/unload
|
||||
// - Visualize/output .dot or imgui thing
|
||||
|
||||
/// <summary>
|
||||
/// Class to initialize Service<T>s.
|
||||
/// </summary>
|
||||
internal static class ServiceManager
|
||||
{
|
||||
/**
|
||||
* TODO:
|
||||
* - Unify dependency walking code(load/unload
|
||||
* - Visualize/output .dot or imgui thing
|
||||
*/
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Static log facility for Service{T}, to avoid duplicate instances for different types.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -141,7 +141,6 @@ internal static class Service<T> where T : IServiceType
|
|||
.OfType<InherentDependencyAttribute>()
|
||||
.Select(x => x.GetType().GetGenericArguments().First()));
|
||||
|
||||
|
||||
// HACK: PluginManager needs to depend on ALL plugin exposed services
|
||||
if (typeof(T) == typeof(PluginManager))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Dalamud.Networking.Http;
|
||||
using Dalamud.Plugin.Internal.Types;
|
||||
using Dalamud.Utility;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public static class AsyncUtils
|
|||
/// <param name="tasks">A list of tasks to race.</param>
|
||||
/// <typeparam name="T">The return type of all raced tasks.</typeparam>
|
||||
/// <exception cref="AggregateException">Thrown when all tasks given to this method fail.</exception>
|
||||
/// <returns>Returns the first task that completes, according to <see cref="Task{TResult}.IsCompletedSuccessfully"/>.</returns>
|
||||
/// <returns>Returns the first task that completes, according to <see cref="Task.IsCompletedSuccessfully"/>.</returns>
|
||||
public static Task<T> FirstSuccessfulTask<T>(ICollection<Task<T>> tasks)
|
||||
{
|
||||
var tcs = new TaskCompletionSource<T>();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Numerics;
|
||||
|
||||
using FFXIVClientStructs.FFXIV.Client.Graphics;
|
||||
|
||||
namespace Dalamud.Utility.Numerics;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue