improve error when installer is pointed at a SDV 1.5.4 folder
This commit is contained in:
parent
0f37c0f92d
commit
cb9d6ae5ad
|
@ -4,7 +4,8 @@
|
|||
## Upcoming version
|
||||
* For players:
|
||||
* You no longer need .NET 5 installed to run SMAPI or the installer.
|
||||
* Updated for the Stardew Valley 1.5.5 hotfix on 2021-12-03.
|
||||
* The installer now detects when the game folder contains an incompatible older game version.
|
||||
* Updated for the latest Stardew Valley 1.5.5 hotfix.
|
||||
|
||||
* For SMAPI maintainers:
|
||||
* Added a new [scripted release package process](technical/smapi.md), which removes the need to compile SMAPI on multiple platforms and manually combine them.
|
||||
|
|
|
@ -54,5 +54,12 @@ namespace StardewModdingAPI.Installer.Framework
|
|||
{
|
||||
return this.GameScanner.LooksLikeGameFolder(dir);
|
||||
}
|
||||
|
||||
/// <summary>Get whether a folder seems to contain Stardew Valley 1.5.4 or earlier.</summary>
|
||||
/// <param name="dir">The folder to check.</param>
|
||||
public bool LooksLikeStardewValley154(DirectoryInfo dir)
|
||||
{
|
||||
return this.GameScanner.LooksLikeStardewValley154(dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -704,7 +704,15 @@ namespace StardewModdingApi.Installer
|
|||
}
|
||||
if (!context.LooksLikeGameFolder(directory))
|
||||
{
|
||||
this.PrintWarning("That directory doesn't contain a Stardew Valley executable.");
|
||||
if (context.LooksLikeStardewValley154(directory))
|
||||
{
|
||||
this.PrintWarning("That directory seems to have Stardew Valley 1.5.4 or earlier.");
|
||||
this.PrintWarning("Please update your game to the latest version to use SMAPI.");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.PrintWarning("That directory doesn't contain a Stardew Valley executable.");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.Linq;
|
|||
using System.Xml.Linq;
|
||||
using System.Xml.XPath;
|
||||
using StardewModdingAPI.Toolkit.Utilities;
|
||||
using System.Reflection;
|
||||
#if SMAPI_FOR_WINDOWS
|
||||
using Microsoft.Win32;
|
||||
#endif
|
||||
|
@ -59,6 +60,32 @@ namespace StardewModdingAPI.Toolkit.Framework.GameScanning
|
|||
&& dir.EnumerateFiles("Stardew Valley.dll").Any();
|
||||
}
|
||||
|
||||
/// <summary>Get whether a folder seems to contain Stardew Valley 1.5.4 or earlier.</summary>
|
||||
/// <param name="dir">The folder to check.</param>
|
||||
public bool LooksLikeStardewValley154(DirectoryInfo dir)
|
||||
{
|
||||
if (!dir.Exists || this.LooksLikeGameFolder(dir))
|
||||
return false;
|
||||
|
||||
// get legacy executable
|
||||
FileInfo executable = new FileInfo(Path.Combine(dir.FullName, "Stardew Valley.exe"));
|
||||
if (!executable.Exists)
|
||||
executable = new FileInfo(Path.Combine(dir.FullName, "StardewValley.exe"));
|
||||
if (!executable.Exists)
|
||||
return false;
|
||||
|
||||
// check if it's a standard .NET assembly
|
||||
// This will fail in Stardew Valley 1.5.5+, where it's a binary wrapper around Stardew Valley.dll.
|
||||
try
|
||||
{
|
||||
Version version = AssemblyName.GetAssemblyName(executable.FullName).Version;
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*********
|
||||
** Private methods
|
||||
|
|
Loading…
Reference in New Issue