From c1a9dc7f7e21660db50fd6d1b892f7c3c3dbd673 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Tue, 26 Sep 2017 01:55:26 -0400 Subject: minor cleanup after 1.x removal --- src/StardewModdingAPI/Framework/CommandManager.cs | 9 ++++----- src/StardewModdingAPI/Framework/DeprecationManager.cs | 18 +----------------- src/StardewModdingAPI/Framework/Models/Manifest.cs | 2 +- 3 files changed, 6 insertions(+), 23 deletions(-) (limited to 'src/StardewModdingAPI/Framework') diff --git a/src/StardewModdingAPI/Framework/CommandManager.cs b/src/StardewModdingAPI/Framework/CommandManager.cs index 9af3d27a..79a23d03 100644 --- a/src/StardewModdingAPI/Framework/CommandManager.cs +++ b/src/StardewModdingAPI/Framework/CommandManager.cs @@ -52,8 +52,7 @@ namespace StardewModdingAPI.Framework public Command Get(string name) { name = this.GetNormalisedName(name); - Command command; - this.Commands.TryGetValue(name, out command); + this.Commands.TryGetValue(name, out Command command); return command; } @@ -92,8 +91,7 @@ namespace StardewModdingAPI.Framework return false; // get command - Command command; - if (this.Commands.TryGetValue(name, out command)) + if (this.Commands.TryGetValue(name, out Command command)) { command.Callback.Invoke(name, arguments); return true; @@ -101,6 +99,7 @@ namespace StardewModdingAPI.Framework return false; } + /********* ** Private methods *********/ @@ -114,4 +113,4 @@ namespace StardewModdingAPI.Framework : null; } } -} \ No newline at end of file +} diff --git a/src/StardewModdingAPI/Framework/DeprecationManager.cs b/src/StardewModdingAPI/Framework/DeprecationManager.cs index 43e82d74..b07c6c7d 100644 --- a/src/StardewModdingAPI/Framework/DeprecationManager.cs +++ b/src/StardewModdingAPI/Framework/DeprecationManager.cs @@ -1,6 +1,5 @@ -using System; +using System; using System.Collections.Generic; -using System.Reflection; namespace StardewModdingAPI.Framework { @@ -52,10 +51,6 @@ namespace StardewModdingAPI.Framework if (!this.MarkWarned(source ?? "", nounPhrase, version)) return; - // show SMAPI 2.0 meta-warning - if(this.MarkWarned("SMAPI", "SMAPI 2.0 meta-warning", "2.0")) - this.Monitor.Log("Some mods may stop working in SMAPI 2.0 (but they'll work fine for now). Try updating mods with 'deprecated code' warnings; if that doesn't remove the warnings, let the mod authors know about this message or see http://stardewvalleywiki.com/Modding:SMAPI_2.0 for details.", LogLevel.Warn); - // build message string message = $"{source ?? "An unknown mod"} uses deprecated code ({nounPhrase})."; if (source == null) @@ -106,16 +101,5 @@ namespace StardewModdingAPI.Framework this.LoggedDeprecations.Add(key); return true; } - - /// Get whether a type implements the given virtual method. - /// The type to check. - /// The base type which declares the virtual method. - /// The method name. - /// The expected argument types. - internal bool IsVirtualMethodImplemented(Type subtype, Type baseType, string name, Type[] argumentTypes) - { - MethodInfo method = subtype.GetMethod(nameof(Mod.Entry), argumentTypes); - return method.DeclaringType != baseType; - } } } diff --git a/src/StardewModdingAPI/Framework/Models/Manifest.cs b/src/StardewModdingAPI/Framework/Models/Manifest.cs index a051354c..b85787e5 100644 --- a/src/StardewModdingAPI/Framework/Models/Manifest.cs +++ b/src/StardewModdingAPI/Framework/Models/Manifest.cs @@ -27,7 +27,7 @@ namespace StardewModdingAPI.Framework.Models [JsonConverter(typeof(SFieldConverter))] public ISemanticVersion MinimumApiVersion { get; set; } - /// The name of the DLL in the directory that has the method. + /// The name of the DLL in the directory that has the method. public string EntryDll { get; set; } /// The other mods that must be loaded before this mod. -- cgit