Remove runtime serializer hash residue

This commit is contained in:
Meta Vens 2026-06-13 07:36:08 +01:00
commit 23a5241a7d
4 changed files with 80 additions and 37 deletions

View file

@ -1,20 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Threading.Tasks;
public static class CollectionExtensions
{
// https://stackoverflow.com/a/800469
public static string GetHashSHA1(this byte[] data)
{
using (var sha1 = new System.Security.Cryptography.SHA1CryptoServiceProvider())
{
return string.Concat(sha1.ComputeHash(data).Select(x => x.ToString("X2")));
}
}
// https://stackoverflow.com/a/3188835
public static T MaxBy<T, U>(this IEnumerable<T> items, Func<T, U> selector)
{
@ -73,4 +63,4 @@ public static class AsyncAwaitExtensions
{
await task;
}
}
}

View file

@ -106,20 +106,6 @@ public class StoryProcessor : IZoneResolver, IFactionResolver
// If the story has already been read / compiled, return it directly
if (_processedStories.ContainsKey(fileName)) return _processedStories[fileName];
// var compiledFileName = Path.Combine(inkFile.Directory.FullName, $"{fileName}.json");
//
// // Calculate a hash of the ink file
// var hash = File.ReadAllBytes(inkFile.FullName).GetHashSHA1();
//
// if (File.Exists(compiledFileName) && // If a compiled version of the ink file exists
// Settings.HashedStoryFiles.ContainsKey(fileName) && // And its hash has been saved
// hash == Settings.HashedStoryFiles[fileName]) // And the saved hash matches the current hash
// {
// // Load the story from the existing compiled JSON representation
// return new Story(File.ReadAllText(compiledFileName));
// }
//
// Settings.HashedStoryFiles[fileName] = hash;
var compiler = new Compiler(File.ReadAllText(inkFile.FullName), new Compiler.Options
{
countAllVisits = true,
@ -255,4 +241,4 @@ public class StoryProcessor : IZoneResolver, IFactionResolver
return contentTags;
}
}
}