I download the Musical Console Sample recently, and it ran successfully in my system, it's funny, I think.
But when I delve into the code, I think maybe I can make some enhancement, because the code sample use a user-defined function LoadFile() to parse the content of musical data, I think I can embed the musical data into the assembly, and then retrieve them at runtime, here is my code:
public class MusicData
{
public Stream GetData()
{
Assembly asm = this.GetType().Assembly;
return asm.GetManifestResourceStream();
}
}
Now in the Main method, I can use MusicData class to retrieve the stream of musical data, like this
Stream stream = new MusicData().GetData();
But how can I parse the instance of Stream class to its original data? (The musical data is comma-separated file, like this:
262, 100, 294, 100, 330, 100,)