mirror of
https://github.com/BepInEx/BepInEx.git
synced 2026-10-20 01:46:13 +00:00
Add versioning to CachedAssembly
This commit is contained in:
1 parent
be1beb5e13
commit
d389ed8067
1 file changed
+8
-1
@@ -70,6 +70,11 @@ public interface ICacheable
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class CachedAssembly<T> where T : ICacheable
|
||||
{
|
||||
/// <summary>
|
||||
/// The version of the cache which increments on each format changes
|
||||
/// </summary>
|
||||
public static int Version => 0;
|
||||
|
||||
/// <summary>
|
||||
/// List of cached items inside the assembly.
|
||||
/// </summary>
|
||||
@@ -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<T>.Version)
|
||||
{
|
||||
var entriesCount = br.ReadInt32();
|
||||
|
||||
|
||||
Reference in new issue
Block a user