diff --git a/BepInEx.Core/Bootstrap/TypeLoader.cs b/BepInEx.Core/Bootstrap/TypeLoader.cs index 0c8e256..eab5723 100644 --- a/BepInEx.Core/Bootstrap/TypeLoader.cs +++ b/BepInEx.Core/Bootstrap/TypeLoader.cs @@ -70,6 +70,11 @@ public interface ICacheable /// public class CachedAssembly where T : ICacheable { + /// + /// The version of the cache which increments on each format changes + /// + public static int Version => 0; + /// /// List of cached items inside the assembly. /// @@ -305,7 +310,9 @@ public static class TypeLoader if (!File.Exists(path)) return null; - using (var br = new BinaryReader(File.OpenRead(path))) + using var br = new BinaryReader(File.OpenRead(path)); + var version = br.ReadInt32(); + if (version == CachedAssembly.Version) { var entriesCount = br.ReadInt32();