From 6451102075874e6eb3b347867e0f9d33ad975973 Mon Sep 17 00:00:00 2001 From: ZaneYork Date: Mon, 16 Mar 2020 21:12:29 +0800 Subject: [PATCH] Mods location switch setting --- src/SMAPI/Constants.cs | 2 +- src/SMAPI/Framework/Models/SConfig.cs | 4 +++- src/SMAPI/SMainActivity.cs | 14 ++++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs index 7967ea43..0f19908e 100644 --- a/src/SMAPI/Constants.cs +++ b/src/SMAPI/Constants.cs @@ -20,7 +20,7 @@ namespace StardewModdingAPI ** Public ****/ /// SMAPI's current semantic version. - public static ISemanticVersion ApiVersion { get; } = new Toolkit.SemanticVersion("3.3.2.2", allowNonStandard: true); + public static ISemanticVersion ApiVersion { get; } = new Toolkit.SemanticVersion("3.3.2.3", allowNonStandard: true); /// The minimum supported version of Stardew Valley. public static ISemanticVersion MinimumGameVersion { get; } = new GameVersion("1.4.5"); diff --git a/src/SMAPI/Framework/Models/SConfig.cs b/src/SMAPI/Framework/Models/SConfig.cs index ae9a3fd4..5c3b34c6 100644 --- a/src/SMAPI/Framework/Models/SConfig.cs +++ b/src/SMAPI/Framework/Models/SConfig.cs @@ -25,7 +25,8 @@ namespace StardewModdingAPI.Framework.Models [nameof(GitHubProjectName)] = "MartyrPher/SMAPI-Android-Installer", [nameof(WebApiBaseUrl)] = "https://smapi.io/api/", [nameof(VerboseLogging)] = false, - [nameof(LogNetworkTraffic)] = false + [nameof(LogNetworkTraffic)] = false, + [nameof(ModsPath)] = "StardewValley/Mods" }; /// The default values for , to log changes if different. @@ -69,6 +70,7 @@ namespace StardewModdingAPI.Framework.Models /// The mod IDs SMAPI should ignore when performing update checks or validating update keys. public string[] SuppressUpdateChecks { get; set; } + public string ModsPath { get; set; } /******** ** Public methods diff --git a/src/SMAPI/SMainActivity.cs b/src/SMAPI/SMainActivity.cs index 55c1eba9..30dee912 100644 --- a/src/SMAPI/SMainActivity.cs +++ b/src/SMAPI/SMainActivity.cs @@ -20,6 +20,7 @@ using System.Linq; using System.IO; using File = Java.IO.File; using Microsoft.AppCenter; +using Newtonsoft.Json; namespace StardewModdingAPI { @@ -112,8 +113,17 @@ namespace StardewModdingAPI new SGameConsole(); Program.Main(null); - - this.core = new SCore(System.IO.Path.Combine(Android.OS.Environment.ExternalStorageDirectory.Path, "StardewValley/Mods"), false); + string modPath = null; + if (System.IO.File.Exists(Constants.ApiUserConfigPath)) + { + var Settings = JsonConvert.DeserializeObject(System.IO.File.ReadAllText(Constants.ApiUserConfigPath)); + modPath = Settings.ModsPath; + } + if (string.IsNullOrWhiteSpace(modPath)) + { + modPath = "StardewValley/Mods"; + } + this.core = new SCore(System.IO.Path.Combine(Android.OS.Environment.ExternalStorageDirectory.Path, modPath), false); this.core.RunInteractively(); typeof(MainActivity).GetField("_game1", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(this, this.core.GameInstance);