diff --git a/41_Guess/csharp/Guess.csproj b/41_Guess/csharp/Guess.csproj index d3fe4757..3870320c 100644 --- a/41_Guess/csharp/Guess.csproj +++ b/41_Guess/csharp/Guess.csproj @@ -6,4 +6,12 @@ enable enable + + + + + + + + diff --git a/41_Guess/csharp/Resources/Good.txt b/41_Guess/csharp/Resources/Good.txt new file mode 100644 index 00000000..989dfa38 --- /dev/null +++ b/41_Guess/csharp/Resources/Good.txt @@ -0,0 +1 @@ +Good. \ No newline at end of file diff --git a/41_Guess/csharp/Resources/Introduction.txt b/41_Guess/csharp/Resources/Introduction.txt new file mode 100644 index 00000000..7a1521e1 --- /dev/null +++ b/41_Guess/csharp/Resources/Introduction.txt @@ -0,0 +1,9 @@ + Guezs + Creative Computing Morristown, New Jersey + + + +This is a number guessing game. I'll think +of a number between 1 and any limit you want. +The you have to guess what it is. + diff --git a/41_Guess/csharp/Resources/Limit.txt b/41_Guess/csharp/Resources/Limit.txt new file mode 100644 index 00000000..62e698a6 --- /dev/null +++ b/41_Guess/csharp/Resources/Limit.txt @@ -0,0 +1 @@ +What limit do you want \ No newline at end of file diff --git a/41_Guess/csharp/Resources/Resource.cs b/41_Guess/csharp/Resources/Resource.cs new file mode 100644 index 00000000..6ba21657 --- /dev/null +++ b/41_Guess/csharp/Resources/Resource.cs @@ -0,0 +1,39 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +namespace Guess.Resources; + +internal static class Resource +{ + internal static class Streams + { + public static Stream Introduction => GetStream(); + public static Stream TooLow => GetStream(); + public static Stream TooHigh => GetStream(); + public static Stream Good => GetStream(); + public static Stream VeryGood => GetStream(); + } + + internal static class Formats + { + public static string Thinking => GetString(); + public static string ThatsIt => GetString(); + public static string ShouldHave => GetString(); + } + + internal static class Prompts + { + public static string Limit => 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($"{typeof(Resource).Namespace}.{name}.txt") + ?? throw new Exception($"Could not find embedded resource stream '{name}'."); +} \ No newline at end of file diff --git a/41_Guess/csharp/Resources/ShouldHave.txt b/41_Guess/csharp/Resources/ShouldHave.txt new file mode 100644 index 00000000..84803588 --- /dev/null +++ b/41_Guess/csharp/Resources/ShouldHave.txt @@ -0,0 +1 @@ +You should have been able to get it in only {0} \ No newline at end of file diff --git a/41_Guess/csharp/Resources/ThatsIt.txt b/41_Guess/csharp/Resources/ThatsIt.txt new file mode 100644 index 00000000..61f78c43 --- /dev/null +++ b/41_Guess/csharp/Resources/ThatsIt.txt @@ -0,0 +1 @@ +That's it! You got it in {0} tries. \ No newline at end of file diff --git a/41_Guess/csharp/Resources/Thinking.txt b/41_Guess/csharp/Resources/Thinking.txt new file mode 100644 index 00000000..8f1bbac7 --- /dev/null +++ b/41_Guess/csharp/Resources/Thinking.txt @@ -0,0 +1,2 @@ +I'm thinking of a number between 1 and {0} +Now you try to guess what it is. \ No newline at end of file diff --git a/41_Guess/csharp/Resources/TooHigh.txt b/41_Guess/csharp/Resources/TooHigh.txt new file mode 100644 index 00000000..bb4ee4ed --- /dev/null +++ b/41_Guess/csharp/Resources/TooHigh.txt @@ -0,0 +1 @@ +Too high. Try a smaller answer. \ No newline at end of file diff --git a/41_Guess/csharp/Resources/TooLow.txt b/41_Guess/csharp/Resources/TooLow.txt new file mode 100644 index 00000000..4bc1776f --- /dev/null +++ b/41_Guess/csharp/Resources/TooLow.txt @@ -0,0 +1 @@ +Too low. Try a bigger answer. \ No newline at end of file diff --git a/41_Guess/csharp/Resources/VeryGood.txt b/41_Guess/csharp/Resources/VeryGood.txt new file mode 100644 index 00000000..606150c7 --- /dev/null +++ b/41_Guess/csharp/Resources/VeryGood.txt @@ -0,0 +1 @@ +Very good. \ No newline at end of file