Add string resources

This commit is contained in:
Andrew Cooper
2021-10-30 22:33:49 +11:00
parent 6b194366fb
commit ee8322dcaf
21 changed files with 100 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
Congratulations

View File

@@ -0,0 +1 @@
How many disks do you want to move (7 is max)

View File

@@ -0,0 +1,2 @@
All right, wise guy, if you can't play the game right, I'll
just take my puzzle and go home. So long.

View File

@@ -0,0 +1 @@
Sorry, but i can't do that job for you.

View File

@@ -0,0 +1 @@
Which disk would you like to move

View File

@@ -0,0 +1 @@
Stop wasting my time. Go bother someone else.

View File

@@ -0,0 +1 @@
Illegal entry... You may only type 3, 5, 7, 9, 11, 13, or 15.

View File

@@ -0,0 +1 @@
That disk is below another one. Make another choice.

View File

@@ -0,0 +1,3 @@
You can't place a larger disk on top of a smaller one,
it might crush it!
Now then,

View File

@@ -0,0 +1,10 @@
In this program, we shall refer to disks by numerical code.
3 will represent the smallest disk, 5 the next size,
7 the next, and so on, up to 15. If you do the puzzle with
2 disks, their code names would be 13 and 15. With 3 disks
the code names would be 11, 13 and 15, etc. The needles
are numbered from left to right, 1 to 3. We will
startup with the disks on needle 1, and attempt to move them
to needle 3.
Good luck!

View File

@@ -0,0 +1,11 @@
Towers
Creative Computing Morristown, New Jersey
Towers of Hanoi puzzle.
You must transfer the disks from the left to the right
tower, one at a time, never putting a larger dish on a
smaller disk.

View File

@@ -0,0 +1 @@
Place disk on which needle

View File

@@ -0,0 +1,2 @@
I tried to warn you, but you wouldn't listen,
Bye bye, big shot.

View File

@@ -0,0 +1,2 @@
I'll assume you hit the wrong key this time. But watch it,
I only allow one mistake

View File

@@ -0,0 +1,2 @@
Try again (Yes or No)

View File

@@ -0,0 +1,38 @@
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
namespace Tower.Resources
{
internal static class Strings
{
internal static string Congratulations => GetResource();
internal static string DiskCountPrompt => GetResource();
internal static string DiskCountQuit => GetResource();
internal static string DiskCountRetry => GetResource();
internal static string DiskPrompt => GetResource();
internal static string DiskQuit => GetResource();
internal static string DiskRetry => GetResource();
internal static string DiskUnavailable => GetResource();
internal static string IllegalMove => GetResource();
internal static string Instructions => GetResource();
internal static string Intro => GetResource();
internal static string NeedlePrompt => GetResource();
internal static string NeedleQuit => GetResource();
internal static string NeedleRetry => GetResource();
internal static string PlayAgainPrompt => GetResource();
internal static string Thanks => GetResource();
internal static string Title => GetResource();
internal static string TooManyMoves => GetResource();
internal static string YesNoPrompt => GetResource();
private static string GetResource([CallerMemberName] string name = "")
{
var streamName = $"Tower.Resources.{name}.txt";
using var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(streamName);
using var reader = new StreamReader(stream);
return reader.ReadToEnd();
}
}
}

View File

@@ -0,0 +1,2 @@
Thanks for the game!

View File

@@ -0,0 +1,11 @@
Towers
Creative Computing Morristown, New Jersey
Towers of Hanoi puzzle.
You must transfer the disks from the left to the right
tower, one at a time, never putting a larger dish on a
smaller disk.

View File

@@ -0,0 +1,2 @@
Sorry, but i have orders to stop is you make more than
128 moves.

View File

@@ -0,0 +1,2 @@
'Yes' or 'No' please

View File

@@ -5,4 +5,8 @@
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\*.txt" />
</ItemGroup>
</Project>