Code cleanup/add suppressions

mnk-heavensward
Liza 2024-07-16 10:54:47 +02:00
parent 985fb7f4c1
commit e239edb22c
Signed by: liza
GPG Key ID: 7199F8D727D55F67
6 changed files with 20 additions and 17 deletions

View File

@ -1,8 +1,10 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Questionable.Model.V1;
namespace Questionable.QuestPaths;
[SuppressMessage("ReSharper", "PartialTypeWithSinglePart", Justification = "Required for RELEASE")]
public static partial class AssemblyQuestLoader
{
public static IReadOnlyDictionary<ushort, QuestRoot> GetQuests() =>

View File

@ -8,12 +8,12 @@ public sealed class ExcelRefConverter : JsonConverter<ExcelRef>
{
public override ExcelRef? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType == JsonTokenType.String)
return new ExcelRef(reader.GetString()!);
else if (reader.TokenType == JsonTokenType.Number)
return new ExcelRef(reader.GetUInt32());
else
return null;
return reader.TokenType switch
{
JsonTokenType.String => ExcelRef.FromKey(reader.GetString()!),
JsonTokenType.Number => ExcelRef.FromRowId(reader.GetUInt32()),
_ => null
};
}
public override void Write(Utf8JsonWriter writer, ExcelRef? value, JsonSerializerOptions options)

View File

@ -21,20 +21,16 @@ public class ExcelRef
Type = EType.RowId;
}
/// <summary>
/// Only used internally (not serialized) with specific values that have been read from the sheets already.
/// </summary>
private ExcelRef(string value, bool v)
private ExcelRef(string? stringValue, uint? rowIdValue, EType type)
{
if (!v)
throw new ArgumentException(nameof(v));
_stringValue = value;
_rowIdValue = null;
Type = EType.RawString;
_stringValue = stringValue;
_rowIdValue = rowIdValue;
Type = type;
}
public static ExcelRef FromSheetValue(string value) => new(value, true);
public static ExcelRef FromKey(string value) => new(value, null, EType.Key);
public static ExcelRef FromRowId(uint rowId) => new(null, rowId, EType.RowId);
public static ExcelRef FromSheetValue(string value) => new(value, null, EType.RawString);
public EType Type { get; }

View File

@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Game.ClientState.Objects;
@ -104,6 +105,7 @@ internal sealed class CombatController
return _condition[ConditionFlag.InCombat];
}
[SuppressMessage("ReSharper", "RedundantJumpStatement")]
private IGameObject? FindNextTarget()
{
if (_currentFight == null)

View File

@ -146,6 +146,7 @@ internal sealed class GameUiController : IDisposable
SelectIconStringPostSetup(addonSelectIconString, false);
}
[SuppressMessage("ReSharper", "RedundantJumpStatement")]
private unsafe void SelectIconStringPostSetup(AddonSelectIconString* addonSelectIconString, bool checkAllSteps)
{
string? actualPrompt = addonSelectIconString->AtkUnitBase.AtkValues[3].ReadAtkString();

View File

@ -274,6 +274,7 @@ internal sealed class QuestSelectionWindow : LWindow
{
var qInfo = _questData.GetQuestInfo(q);
var (iconColor, icon, _) = GetQuestStyle(q);
// ReSharper disable once UnusedVariable
using (var font = _pluginInterface.UiBuilder.IconFontFixedWidthHandle.Push())
{
if (_questRegistry.IsKnownQuest(qInfo.QuestId))
@ -305,6 +306,7 @@ internal sealed class QuestSelectionWindow : LWindow
{
var qInfo = _questData.GetQuestInfo(q);
var (iconColor, icon, _) = GetQuestStyle(q);
// ReSharper disable once UnusedVariable
using (var font = _pluginInterface.UiBuilder.IconFontFixedWidthHandle.Push())
{
if (_questRegistry.IsKnownQuest(qInfo.QuestId))