diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-01-16 16:10:57 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-01-16 16:10:57 -0500 |
commit | 6adf199987a506f8a65f6c1ddfad5aa9fa2a6a9f (patch) | |
tree | faa9155fae99533110853567003325486f208937 /src/StardewModdingAPI/Framework/ModAssemblyLoader.cs | |
parent | e8825947ca82c8f28ad9bc8a225fb4fb749814cb (diff) | |
parent | 1f3d3c8c93c7a427486b60cf649b86cef140e88b (diff) | |
download | SMAPI-6adf199987a506f8a65f6c1ddfad5aa9fa2a6a9f.tar.gz SMAPI-6adf199987a506f8a65f6c1ddfad5aa9fa2a6a9f.tar.bz2 SMAPI-6adf199987a506f8a65f6c1ddfad5aa9fa2a6a9f.zip |
Merge branch 'develop' into stable
Diffstat (limited to 'src/StardewModdingAPI/Framework/ModAssemblyLoader.cs')
-rw-r--r-- | src/StardewModdingAPI/Framework/ModAssemblyLoader.cs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/StardewModdingAPI/Framework/ModAssemblyLoader.cs b/src/StardewModdingAPI/Framework/ModAssemblyLoader.cs index a2c4ac23..e4760398 100644 --- a/src/StardewModdingAPI/Framework/ModAssemblyLoader.cs +++ b/src/StardewModdingAPI/Framework/ModAssemblyLoader.cs @@ -29,6 +29,8 @@ namespace StardewModdingAPI.Framework /// <summary>Encapsulates monitoring and logging.</summary> private readonly IMonitor Monitor; + /// <summary>The current game platform.</summary> + private readonly Platform TargetPlatform; /********* ** Public methods @@ -40,6 +42,7 @@ namespace StardewModdingAPI.Framework public ModAssemblyLoader(string cacheDirName, Platform targetPlatform, IMonitor monitor) { this.CacheDirName = cacheDirName; + this.TargetPlatform = targetPlatform; this.Monitor = monitor; this.AssemblyMap = Constants.GetAssemblyMap(targetPlatform); this.AssemblyTypeRewriter = new AssemblyTypeRewriter(this.AssemblyMap, monitor); @@ -58,7 +61,7 @@ namespace StardewModdingAPI.Framework CachePaths cachePaths = this.GetCachePaths(assemblyPath); { CacheEntry cacheEntry = File.Exists(cachePaths.Metadata) ? JsonConvert.DeserializeObject<CacheEntry>(File.ReadAllText(cachePaths.Metadata)) : null; - if (cacheEntry != null && cacheEntry.IsUpToDate(cachePaths, hash, Constants.ApiVersion)) + if (cacheEntry != null && cacheEntry.IsUpToDate(cachePaths, hash, Constants.ApiVersion, this.TargetPlatform, Environment.MachineName)) return new RewriteResult(assemblyPath, cachePaths, assemblyBytes, cacheEntry.Hash, cacheEntry.UseCachedAssembly, isNewerThanCache: false); // no rewrite needed } this.Monitor.Log($"Preprocessing {Path.GetFileName(assemblyPath)} for compatibility...", LogLevel.Trace); @@ -99,7 +102,7 @@ namespace StardewModdingAPI.Framework // cache all results foreach (RewriteResult result in results) { - CacheEntry cacheEntry = new CacheEntry(result.Hash, Constants.ApiVersion.ToString(), forceCacheAssemblies || result.UseCachedAssembly); + CacheEntry cacheEntry = new CacheEntry(result.Hash, Constants.ApiVersion.ToString(), this.TargetPlatform, Environment.MachineName, forceCacheAssemblies || result.UseCachedAssembly); File.WriteAllText(result.CachePaths.Metadata, JsonConvert.SerializeObject(cacheEntry)); if (forceCacheAssemblies || result.UseCachedAssembly) File.WriteAllBytes(result.CachePaths.Assembly, result.AssemblyBytes); |