From 0a00c70397d85777499dcf7877cef08727a2dbae Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 20 Dec 2019 20:27:21 -0500 Subject: add console warning in paranoid mode --- src/SMAPI/Framework/ModLoading/AssemblyLoader.cs | 5 +++++ src/SMAPI/Framework/ModLoading/InstructionHandleResult.cs | 3 +++ 2 files changed, 8 insertions(+) (limited to 'src/SMAPI/Framework/ModLoading') diff --git a/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs b/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs index 7670eb3a..b5533335 100644 --- a/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs +++ b/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs @@ -356,6 +356,11 @@ namespace StardewModdingAPI.Framework.ModLoading mod.SetWarning(ModWarning.UsesDynamic); break; + case InstructionHandleResult.DetectedConsoleAccess: + this.Monitor.LogOnce(loggedMessages, $"{logPrefix}Detected direct console access ({handler.NounPhrase}) in assembly {filename}."); + mod.SetWarning(ModWarning.AccessesConsole); + break; + case InstructionHandleResult.DetectedFilesystemAccess: this.Monitor.LogOnce(loggedMessages, $"{logPrefix}Detected filesystem access ({handler.NounPhrase}) in assembly {filename}."); mod.SetWarning(ModWarning.AccessesFilesystem); diff --git a/src/SMAPI/Framework/ModLoading/InstructionHandleResult.cs b/src/SMAPI/Framework/ModLoading/InstructionHandleResult.cs index d93b603d..a948213b 100644 --- a/src/SMAPI/Framework/ModLoading/InstructionHandleResult.cs +++ b/src/SMAPI/Framework/ModLoading/InstructionHandleResult.cs @@ -26,6 +26,9 @@ namespace StardewModdingAPI.Framework.ModLoading /// The instruction is compatible, but references or which may impact stability. DetectedUnvalidatedUpdateTick, + /// The instruction accesses the SMAPI console directly. + DetectedConsoleAccess, + /// The instruction accesses the filesystem directly. DetectedFilesystemAccess, -- cgit