Mods location switch setting

This commit is contained in:
ZaneYork 2020-03-16 21:12:29 +08:00
parent eeb960a0b8
commit 6451102075
3 changed files with 16 additions and 4 deletions

View File

@ -20,7 +20,7 @@ namespace StardewModdingAPI
** Public
****/
/// <summary>SMAPI's current semantic version.</summary>
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);
/// <summary>The minimum supported version of Stardew Valley.</summary>
public static ISemanticVersion MinimumGameVersion { get; } = new GameVersion("1.4.5");

View File

@ -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"
};
/// <summary>The default values for <see cref="SuppressUpdateChecks"/>, to log changes if different.</summary>
@ -69,6 +70,7 @@ namespace StardewModdingAPI.Framework.Models
/// <summary>The mod IDs SMAPI should ignore when performing update checks or validating update keys.</summary>
public string[] SuppressUpdateChecks { get; set; }
public string ModsPath { get; set; }
/********
** Public methods

View File

@ -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<Framework.Models.SConfig>(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);