using System; using System.IO; using System.Reflection; namespace gaemstone.Client; public static class Resources { public static Assembly ResourceAssembly { get; set; } = null!; public static Stream GetStream(string name) => ResourceAssembly.GetManifestResourceStream( ResourceAssembly.GetName().Name + ".Resources." + name) ?? throw new ArgumentException($"Could not find embedded resource '{name}'"); public static string GetString(string name) { using var stream = GetStream(name); using var reader = new StreamReader(stream); return reader.ReadToEnd(); } public static byte[] GetBytes(string name) { using var stream = GetStream(name); using var memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); return memoryStream.ToArray(); } }