Created
July 27, 2021 10:58
-
-
Save IT-Delinquent/99ae1fb24a9ad5bc9e60fffd7239201f to your computer and use it in GitHub Desktop.
saveMusicToDiskWPF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void SaveMusicToDisk(){ | |
| //This sets up a new temporary file in the %temp% location called "backgroundmusic.wav" | |
| using (FileStream fileStream = File.Create(Path.GetTempPath() + "backgroundmusic.wav")){ | |
| //This them looks into the assembly and finds the embedded resource | |
| //inside the WPF project, under the assets folder | |
| //under the sounds folder called backgroundmusic.wav | |
| //PLEASE NOTE: this will be different to you | |
| Assembly.GetExecutingAssembly().GetManifestResourceStream("WPF.Assets.Sounds.backgroundmusic.wav").CopyTo(fileStream); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment