using System.Diagnostics.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using StardewModdingAPI.AssemblyRewriters.Framework; using StardewValley; namespace StardewModdingAPI.AssemblyRewriters.Finders { /// Finds CIL instructions that reference the former Game1.borderFont field, which was removed in Stardew Valley 1.2.3–1.2.6. [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "This class is not meant to be used directly, and is deliberately named to make it easier to know what it changes at a glance.")] public class Game1_borderFont_FieldFinder : BaseFieldFinder { /********* ** Accessors *********/ /// A brief noun phrase indicating what the instruction finder matches. public override string NounPhrase { get; } = $"obsolete {nameof(Game1)}.borderFont field"; /********* ** Protected methods *********/ /// Get whether a field reference should be rewritten. /// The IL instruction. /// The field reference. /// Whether the mod was compiled on a different platform. protected override bool IsMatch(Instruction instruction, FieldReference fieldRef, bool platformChanged) { return this.IsStaticField(instruction) && fieldRef.DeclaringType.FullName == typeof(Game1).FullName && fieldRef.Name == "borderFont"; } } }