diff --git a/ExternalProjects/BizHawk.SrcGen.ReflectionCache/ReflectionCacheGenerator.cs b/ExternalProjects/BizHawk.SrcGen.ReflectionCache/ReflectionCacheGenerator.cs index c07bda0797..6eac7ebaf7 100644 --- a/ExternalProjects/BizHawk.SrcGen.ReflectionCache/ReflectionCacheGenerator.cs +++ b/ExternalProjects/BizHawk.SrcGen.ReflectionCache/ReflectionCacheGenerator.cs @@ -64,15 +64,19 @@ namespace BizHawk.SrcGen.ReflectionCache var src = $@"#nullable enable using System; +using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; {(nSpace == "BizHawk.Common" ? string.Empty : "\nusing BizHawk.Common;")} +using BizHawk.Common.StringExtensions; namespace {nSpace} {{ public static class ReflectionCache {{ + private const string EMBED_PREFIX = ""{nSpace}.""; + private static Type[]? _types = null; private static readonly Assembly Asm = typeof({nSpace}.ReflectionCache).Assembly; @@ -81,11 +85,19 @@ namespace {nSpace} public static Type[] Types => _types ??= Asm.GetTypesWithoutLoadErrors().ToArray(); + public static IEnumerable EmbeddedResourceList(string extraPrefix) + {{ + var fullPrefix = EMBED_PREFIX + extraPrefix; + return Asm.GetManifestResourceNames().Where(s => s.StartsWith(fullPrefix)).Select(s => s.RemovePrefix(fullPrefix)); + }} + + public static IEnumerable EmbeddedResourceList() + => EmbeddedResourceList(string.Empty); /// not found public static Stream EmbeddedResourceStream(string embedPath) {{ - var fullPath = $""{nSpace}.{{embedPath}}""; + var fullPath = EMBED_PREFIX + embedPath; return Asm.GetManifestResourceStream(fullPath) ?? throw new ArgumentException($""resource at {{fullPath}} not found"", nameof(embedPath)); }} }} diff --git a/References/BizHawk.SrcGen.ReflectionCache.dll b/References/BizHawk.SrcGen.ReflectionCache.dll index eec0b87e34..961d13f4c7 100644 Binary files a/References/BizHawk.SrcGen.ReflectionCache.dll and b/References/BizHawk.SrcGen.ReflectionCache.dll differ