AspNetCore.Docs.Samples/fundamentals/streaming/SynchronousWithNewtonsoftJson/Model/LyricsSource.cs

67 lines
2.0 KiB
C#
Raw Normal View History

Import samples from external repository (#86) * Replaced stub.txt with the samples from git@github.com:logiclrd/ASPNetCoreStreamingExample.git. * Reformatted to match .editorconfig. * Added an exclusion for Properties folder in .gitignore, since this is where launchSettings.json lives. Added launchSettings.json files. * Added root menus to AsynchronousWithSystemTextJson and SynchronousWithNewtonsoftJson. Updated launchSettings.json in each project correspondingly. Updated Startup.cs to output instructions for the user, since it appears `dotnet run` doesn't actually start a browser. * Added sample DynamicBinaryStream. * Added RootNamespace properties to AsynchronousWithSystemTextJson.csproj and SynchronousWithNewtonsoftJson.csproj. * Corrected folder structure. Removed LICENSE file imported from external repository. * Added comment explaining why we create a separate JsonTextWriter for each line in SongLyricsMiddleware.cs. * Removed unnecessary .gitignore files. * Apparently, Visual Studio was still doing implicit using statements even though it was turned off in the project file. Now it's not doing them, so this commit adds the using statements that were implicit. * Converted projects to use so-called "minimal hosting" with all initialization inside Program.cs instead of using a Startup class. * Updated Microsoft.AspNetCore.Mvc.NewtonsoftJson reference to the latest 7.0.0 prerelease version. * Delete .gitignore * Enabled implicit usings in all projects. Removed unnecessary using statements. Converted all C# source files to file-scoped namespaces. Corrected cases where namespaces including the solution file name (not committed to the repository) were accidentally used. Enabled Nullable annotation in SynchronousWithNewtonsoftJson.csproj. * Lumped all using statements into single blocks. Co-authored-by: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com>
2022-10-14 03:34:38 +08:00
namespace SynchronousWithNewtonsoftJson.Model;
public class LyricsSource : ILyricsSource
{
public IEnumerable<string> GetSongLyrics() => Lyrics;
const string Song =
@"We're no strangers to love
You know the rules and so do I
A full commitment's what I'm thinking of
You wouldn't get this from any other guy
I just wanna tell you how I'm feeling
Gotta make you understand
Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you
We've known each other for so long
Your heart's been aching but you're too shy to say it
Inside we both know what's been going on
We know the game and we're gonna play it
And if you ask me how I'm feeling
Don't tell me you're too blind to see
Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you
Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you
Never gonna give, never gonna give
(Give you up)
(Ooh) Never gonna give, never gonna give
(Give you up)
We've known each other for so long
Your heart's been aching but you're too shy to say it
Inside we both know what's been going on
We know the game and we're gonna play it
I just wanna tell you how I'm feeling
Gotta make you understand
Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you
Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you
Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry";
readonly string[] Lyrics = Song.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).ToArray();
}