mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-23 15:37:51 -08:00
28 lines
743 B
C#
28 lines
743 B
C#
using System.IO;
|
|
using System.Reflection;
|
|
using System.Runtime.CompilerServices;
|
|
|
|
namespace Stars.Resources;
|
|
|
|
internal static class Resource
|
|
{
|
|
internal static class Streams
|
|
{
|
|
public static Stream Title => GetStream();
|
|
}
|
|
|
|
internal static class Formats
|
|
{
|
|
public static string Instructions => GetString();
|
|
}
|
|
|
|
private static string GetString([CallerMemberName] string name = null)
|
|
{
|
|
using var stream = GetStream(name);
|
|
using var reader = new StreamReader(stream);
|
|
return reader.ReadToEnd();
|
|
}
|
|
|
|
private static Stream GetStream([CallerMemberName] string name = null)
|
|
=> Assembly.GetExecutingAssembly().GetManifestResourceStream($"Stars.Resources.{name}.txt");
|
|
} |