Fix some resource issues

This commit is contained in:
Andrew Cooper
2022-07-06 07:52:59 +10:00
parent ffc0b99fa3
commit f35bbb0224
4 changed files with 5 additions and 3 deletions

View File

@@ -15,11 +15,11 @@ internal class Game
public void Play() public void Play()
{ {
_io.WriteLine(Resource.Streams.Introduction); _io.Write(Resource.Streams.Introduction);
var response = _io.ReadString("Do you want instructions"); var response = _io.ReadString("Do you want instructions");
if (!response.Equals("no", StringComparison.InvariantCultureIgnoreCase)) if (!response.Equals("no", StringComparison.InvariantCultureIgnoreCase))
{ {
_io.WriteLine(Resource.Streams.Instructions); _io.Write(Resource.Streams.Instructions);
} }
} }
} }

View File

@@ -5,3 +5,4 @@
The Game Bug The Game Bug
I hope you enjoy this game. I hope you enjoy this game.

View File

@@ -19,6 +19,7 @@ internal static class Resource
} }
private static Stream GetStream([CallerMemberName] string? name = null) => private static Stream GetStream([CallerMemberName] string? name = null) =>
Assembly.GetExecutingAssembly().GetManifestResourceStream($"Basketball.Resources.{name}.txt") Assembly.GetExecutingAssembly()
.GetManifestResourceStream($"{typeof(Resource).Namespace}.{name}.txt")
?? throw new Exception($"Could not find embedded resource stream '{name}'."); ?? throw new Exception($"Could not find embedded resource stream '{name}'.");
} }