using System; using System.IO; using System.Reflection; using System.Text; namespace TrajectoryPlanningVisualization; public static class EmbeddedWebAssets { private const string ResourcePrefix = "TrajectoryPlanningVisualization.Web."; public static string ReadText(string fileName) { if (string.IsNullOrEmpty(fileName)) { throw new ArgumentException("A web asset file name is required.", nameof(fileName)); } Assembly assembly = typeof(EmbeddedWebAssets).Assembly; using Stream stream = assembly.GetManifestResourceStream(ResourcePrefix + fileName) ?? throw new InvalidOperationException("Embedded web asset was not found: " + fileName); using var reader = new StreamReader(stream, new UTF8Encoding(false), true); return reader.ReadToEnd(); } }