summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Program.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-03-14 18:16:44 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-03-14 18:16:44 -0400
commit307304a03edb82f3a1f5cfa6c47cb17687560ccb (patch)
treefdd46e84bac0d05e4eafdbb4f05d8c5c70507a7b /src/StardewModdingAPI/Program.cs
parent06871a0603fa59ca6734fd913e118a4fe4a4c64c (diff)
downloadSMAPI-307304a03edb82f3a1f5cfa6c47cb17687560ccb.tar.gz
SMAPI-307304a03edb82f3a1f5cfa6c47cb17687560ccb.tar.bz2
SMAPI-307304a03edb82f3a1f5cfa6c47cb17687560ccb.zip
revert all projects except installer to .NET Framework 4.5
This caused obscure invalid-IL crashes when compiled through MonoDevelop on Linux.
Diffstat (limited to 'src/StardewModdingAPI/Program.cs')
-rw-r--r--src/StardewModdingAPI/Program.cs24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs
index 81e6518e..db7a3df6 100644
--- a/src/StardewModdingAPI/Program.cs
+++ b/src/StardewModdingAPI/Program.cs
@@ -187,7 +187,7 @@ namespace StardewModdingAPI
{
try
{
- GitRelease release = UpdateHelper.GetLatestVersion(Constants.GitHubRepository);
+ GitRelease release = UpdateHelper.GetLatestVersionAsync(Constants.GitHubRepository).Result;
ISemanticVersion latestVersion = new SemanticVersion(release.Tag);
if (latestVersion.IsNewerThan(Constants.ApiVersion))
this.Monitor.Log($"You can update SMAPI from version {Constants.ApiVersion} to {latestVersion}", LogLevel.Alert);
@@ -446,18 +446,26 @@ namespace StardewModdingAPI
continue;
}
- // initialise mod
+ // validate assembly
try
{
- // get mod entry type
- Type modEntryType = modAssembly.GetExportedTypes().FirstOrDefault(x => x.BaseType == typeof(Mod));
- if(modEntryType == null)
+ if (modAssembly.DefinedTypes.Count(x => x.BaseType == typeof(Mod)) == 0)
{
- this.Monitor.Log($"{skippedPrefix} because its DLL has no {typeof(Mod).FullName} entry class.", LogLevel.Error);
+ this.Monitor.Log($"{skippedPrefix} because its DLL has no 'Mod' subclass.", LogLevel.Error);
continue;
}
-
- // get mod class
+ }
+ catch (Exception ex)
+ {
+ this.Monitor.Log($"{skippedPrefix} because its DLL couldn't be loaded.\n{ex.GetLogSummary()}", LogLevel.Error);
+ continue;
+ }
+
+ // initialise mod
+ try
+ {
+ // get implementation
+ TypeInfo modEntryType = modAssembly.DefinedTypes.First(x => x.BaseType == typeof(Mod));
Mod mod = (Mod)modAssembly.CreateInstance(modEntryType.ToString());
if (mod == null)
{