summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Framework/AssemblyRewriting/RewriteResult.cs
blob: 8f34bb202438b1ff6a93427fc90f866401267cd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
namespace StardewModdingAPI.Framework.AssemblyRewriting
{
    /// <summary>Metadata about a preprocessed assembly.</summary>
    internal class RewriteResult
    {
        /*********
        ** Accessors
        *********/
        /// <summary>The original assembly path.</summary>
        public readonly string OriginalAssemblyPath;

        /// <summary>The cache paths.</summary>
        public readonly CachePaths CachePaths;

        /// <summary>The rewritten assembly bytes.</summary>
        public readonly byte[] AssemblyBytes;

        /// <summary>The MD5 hash for the original assembly.</summary>
        public readonly string Hash;

        /// <summary>Whether to use the cached assembly instead of the original assembly.</summary>
        public readonly bool UseCachedAssembly;

        /// <summary>Whether this data is newer than the cache.</summary>
        public readonly bool IsNewerThanCache;



        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="originalAssemblyPath"></param>
        /// <param name="cachePaths">The cache paths.</param>
        /// <param name="assemblyBytes">The rewritten assembly bytes.</param>
        /// <param name="hash">The MD5 hash for the original assembly.</param>
        /// <param name="useCachedAssembly">Whether to use the cached assembly instead of the original assembly.</param>
        /// <param name="isNewerThanCache">Whether this data is newer than the cache.</param>
        public RewriteResult(string originalAssemblyPath, CachePaths cachePaths, byte[] assemblyBytes, string hash, bool useCachedAssembly, bool isNewerThanCache)
        {
            this.OriginalAssemblyPath = originalAssemblyPath;
            this.CachePaths = cachePaths;
            this.Hash = hash;
            this.AssemblyBytes = assemblyBytes;
            this.UseCachedAssembly = useCachedAssembly;
            this.IsNewerThanCache = isNewerThanCache;
        }
    }
}