private bool ViewMusicSong() { bool validate = qsParams.HasParameter("id"); string songID = qsParams["id"]; validate &= (!(string.IsNullOrWhiteSpace(songID))); if (!validate) { txtPageTitle = "Invalid Song"; txtResponse += "An invalid or incorrect song ID was specified."; return true; } // Decode string decodedSongID = Functions.DecodeFromBase64(HttpUtility.UrlDecode(songID)); using (WMPManager manager = new WMPManager()) { string FN = manager.FileNameForWMPItem(decodedSongID); txtPageTitle = Path.GetFileNameWithoutExtension(FN); } StringBuilder sbOutput = new StringBuilder(500); string href = "streamsong64.mp3?id=" + HttpUtility.UrlEncode(songID); // Already base64 encoded sbOutput.Append(Functions.LinkTagOpen(href)); sbOutput.Append("Stream song</a>"); // Commit to form txtResponse += sbOutput.ToString(); return true; }
private bool SendSongToBrowser(ref BrowserSender browserSender, bool isBase64Encoded, bool sendChunked, bool isDownload) { if (! (qsParams.HasParameter("id"))) return false; string songID = HttpUtility.UrlDecode(qsParams["id"]); if (isBase64Encoded) songID = Functions.DecodeFromBase64(songID); string FN; using (WMPManager manager = new WMPManager()) { FN = manager.FileNameForWMPItem(songID); if (string.IsNullOrEmpty(FN)) return false; } // Send CHUNKED (not implemented) browserSender.SendFileToBrowser(FN, false, sendChunked, isDownload); return true; }