summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/Deprecations/DeprecationWarning.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-05-01 18:16:09 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-05-01 18:16:09 -0400
commitc8ad50dad1d706a1901798f9396f6becfea36c0e (patch)
tree28bd818a5db39ec5ece1bd141a28de955950463b /src/SMAPI/Framework/Deprecations/DeprecationWarning.cs
parent451b70953ff4c0b1b27ae0de203ad99379b45b2a (diff)
parentf78093bdb58d477b400cde3f19b70ffd6ddf833d (diff)
downloadSMAPI-c8ad50dad1d706a1901798f9396f6becfea36c0e.tar.gz
SMAPI-c8ad50dad1d706a1901798f9396f6becfea36c0e.tar.bz2
SMAPI-c8ad50dad1d706a1901798f9396f6becfea36c0e.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Framework/Deprecations/DeprecationWarning.cs')
-rw-r--r--src/SMAPI/Framework/Deprecations/DeprecationWarning.cs51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/SMAPI/Framework/Deprecations/DeprecationWarning.cs b/src/SMAPI/Framework/Deprecations/DeprecationWarning.cs
new file mode 100644
index 00000000..5936517b
--- /dev/null
+++ b/src/SMAPI/Framework/Deprecations/DeprecationWarning.cs
@@ -0,0 +1,51 @@
+namespace StardewModdingAPI.Framework.Deprecations
+{
+ /// <summary>A deprecation warning for a mod.</summary>
+ internal class DeprecationWarning
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <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; }
+
+ /// <summary>The SMAPI version which deprecated it.</summary>
+ public string Version { get; }
+
+ /// <summary>The deprecation level for the affected code.</summary>
+ public DeprecationLevel Level { get; }
+
+ /// <summary>The stack trace when the deprecation warning was raised.</summary>
+ public ImmutableStackTrace StackTrace { get; }
+
+ /// <summary>Whether to log a stack trace showing where the deprecated code is in the mod.</summary>
+ public bool LogStackTrace { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <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>
+ /// <param name="logStackTrace">Whether to log a stack trace showing where the deprecated code is in the mod.</param>
+ public DeprecationWarning(IModMetadata? mod, string nounPhrase, string version, DeprecationLevel level, ImmutableStackTrace stackTrace, bool logStackTrace)
+ {
+ this.Mod = mod;
+ this.NounPhrase = nounPhrase;
+ this.Version = version;
+ this.Level = level;
+ this.StackTrace = stackTrace;
+ this.LogStackTrace = logStackTrace;
+ }
+ }
+}