From 6ee14ecfbfd4abcb78b2c8db6ac220981e019f32 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 2 Feb 2017 23:22:54 -0500 Subject: rewrite mod assembly loading (#229) This greatly simplifies mod loading, eliminates the .cache folders by loading assemblies in memory, ensures DLLs are loaded in leaf-to-root order, and reduces log verbosity. These changes should address a range of issues, notably #221 and #226. --- .../Framework/AssemblyRewriting/CacheEntry.cs | 61 ---------------------- 1 file changed, 61 deletions(-) delete mode 100644 src/StardewModdingAPI/Framework/AssemblyRewriting/CacheEntry.cs (limited to 'src/StardewModdingAPI/Framework/AssemblyRewriting/CacheEntry.cs') diff --git a/src/StardewModdingAPI/Framework/AssemblyRewriting/CacheEntry.cs b/src/StardewModdingAPI/Framework/AssemblyRewriting/CacheEntry.cs deleted file mode 100644 index 4c3b86fe..00000000 --- a/src/StardewModdingAPI/Framework/AssemblyRewriting/CacheEntry.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System.IO; -using StardewModdingAPI.AssemblyRewriters; - -namespace StardewModdingAPI.Framework.AssemblyRewriting -{ - /// Represents cached metadata for a rewritten assembly. - internal class CacheEntry - { - /********* - ** Accessors - *********/ - /// The MD5 hash for the original assembly. - public readonly string Hash; - - /// The SMAPI version used to rewrite the assembly. - public readonly string ApiVersion; - - /// The target platform. - public readonly Platform Platform; - - /// The value for the machine used to rewrite the assembly. - public readonly string MachineName; - - /// Whether to use the cached assembly instead of the original assembly. - public readonly bool UseCachedAssembly; - - - /********* - ** Public methods - *********/ - /// Construct an instance. - /// The MD5 hash for the original assembly. - /// The SMAPI version used to rewrite the assembly. - /// The target platform. - /// The value for the machine used to rewrite the assembly. - /// Whether to use the cached assembly instead of the original assembly. - public CacheEntry(string hash, string apiVersion, Platform platform, string machineName, bool useCachedAssembly) - { - this.Hash = hash; - this.ApiVersion = apiVersion; - this.Platform = platform; - this.MachineName = machineName; - this.UseCachedAssembly = useCachedAssembly; - } - - /// Get whether the cache entry is up-to-date for the given assembly hash. - /// The paths for the cached assembly. - /// The MD5 hash of the original assembly. - /// The current SMAPI version. - /// The target platform. - /// The value for the machine reading the assembly. - public bool IsUpToDate(CachePaths paths, string hash, ISemanticVersion currentVersion, Platform platform, string machineName) - { - return hash == this.Hash - && this.ApiVersion == currentVersion.ToString() - && this.Platform == platform - && this.MachineName == machineName - && (!this.UseCachedAssembly || File.Exists(paths.Assembly)); - } - } -} \ No newline at end of file -- cgit