Add versioning to CachedAssembly

This commit is contained in:
aldelaro5 committed 2024-09-03 21:09:52 -04:00
1 parent be1beb5e13
commit d389ed8067
1 file changed
+8 -1
+8 -1
View File
@@ -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();