diff options
Diffstat (limited to 'src/SMAPI/Framework/DeprecationWarning.cs')
-rw-r--r-- | src/SMAPI/Framework/DeprecationWarning.cs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/SMAPI/Framework/DeprecationWarning.cs b/src/SMAPI/Framework/DeprecationWarning.cs index f155358b..1e83f679 100644 --- a/src/SMAPI/Framework/DeprecationWarning.cs +++ b/src/SMAPI/Framework/DeprecationWarning.cs @@ -1,4 +1,4 @@ -#nullable disable +using System.Diagnostics; namespace StardewModdingAPI.Framework { @@ -8,8 +8,11 @@ namespace StardewModdingAPI.Framework /********* ** Accessors *********/ - /// <summary>The affected mod's display name.</summary> - public string ModName { get; } + /// <summary>The affected mod.</summary> + public IModMetadata? Mod { get; } + + /// <summary>Get the display name for the affected mod.</summary> + public string ModName => this.Mod?.DisplayName ?? "<unknown mod>"; /// <summary>A noun phrase describing what is deprecated.</summary> public string NounPhrase { get; } @@ -21,21 +24,21 @@ namespace StardewModdingAPI.Framework public DeprecationLevel Level { get; } /// <summary>The stack trace when the deprecation warning was raised.</summary> - public string StackTrace { get; } + public StackTrace StackTrace { get; } /********* ** Public methods *********/ /// <summary>Construct an instance.</summary> - /// <param name="modName">The affected mod's display name.</param> + /// <param name="mod">The affected mod.</param> /// <param name="nounPhrase">A noun phrase describing what is deprecated.</param> /// <param name="version">The SMAPI version which deprecated it.</param> /// <param name="level">The deprecation level for the affected code.</param> /// <param name="stackTrace">The stack trace when the deprecation warning was raised.</param> - public DeprecationWarning(string modName, string nounPhrase, string version, DeprecationLevel level, string stackTrace) + public DeprecationWarning(IModMetadata? mod, string nounPhrase, string version, DeprecationLevel level, StackTrace stackTrace) { - this.ModName = modName; + this.Mod = mod; this.NounPhrase = nounPhrase; this.Version = version; this.Level = level; |