From c4c67e15a23ff0a281795422d41b07dec0effae5 Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Sat, 16 Apr 2022 22:34:08 +1000 Subject: [PATCH] Add resources --- 13_Bounce/csharp/Bounce.csproj | 8 ++++++++ 13_Bounce/csharp/Resources/Instructions.txt | 8 ++++++++ 13_Bounce/csharp/Resources/Resource.cs | 17 +++++++++++++++++ 13_Bounce/csharp/Resources/Title.txt | 5 +++++ 4 files changed, 38 insertions(+) create mode 100644 13_Bounce/csharp/Resources/Instructions.txt create mode 100644 13_Bounce/csharp/Resources/Resource.cs create mode 100644 13_Bounce/csharp/Resources/Title.txt diff --git a/13_Bounce/csharp/Bounce.csproj b/13_Bounce/csharp/Bounce.csproj index d3fe4757..e377b904 100644 --- a/13_Bounce/csharp/Bounce.csproj +++ b/13_Bounce/csharp/Bounce.csproj @@ -6,4 +6,12 @@ enable enable + + + + + + + + diff --git a/13_Bounce/csharp/Resources/Instructions.txt b/13_Bounce/csharp/Resources/Instructions.txt new file mode 100644 index 00000000..d2901d6e --- /dev/null +++ b/13_Bounce/csharp/Resources/Instructions.txt @@ -0,0 +1,8 @@ +This simulation lets you specify the initial velocity +of a ball thrown straight up, and the coefficient of +elasticity of the ball. Please use a decimal fraction +coefficiency (less than 1). + +You also specify the time increment to be used in +'strobing' the ball's flight (try .1 initially). + diff --git a/13_Bounce/csharp/Resources/Resource.cs b/13_Bounce/csharp/Resources/Resource.cs new file mode 100644 index 00000000..68bebee0 --- /dev/null +++ b/13_Bounce/csharp/Resources/Resource.cs @@ -0,0 +1,17 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +namespace Bounce.Resources; + +internal static class Resource +{ + internal static class Streams + { + public static Stream Instructions => GetStream(); + public static Stream Title => GetStream(); + } + + private static Stream GetStream([CallerMemberName] string? name = null) + => Assembly.GetExecutingAssembly().GetManifestResourceStream($"Bounce.Resources.{name}.txt") + ?? throw new ArgumentException($"Resource stream {name} does not exist", nameof(name)); +} \ No newline at end of file diff --git a/13_Bounce/csharp/Resources/Title.txt b/13_Bounce/csharp/Resources/Title.txt new file mode 100644 index 00000000..5bcd0496 --- /dev/null +++ b/13_Bounce/csharp/Resources/Title.txt @@ -0,0 +1,5 @@ + Bounce + Creative Computing Morristown, New Jersey + + +