/// <summary> /// This method sends all the tracks to the specified connection. /// </summary> /// <param name="connection">The connection to send the tracks to.</param> public static void SendTracks(Connection connection, bool sendAll) { if (volInfo != null) { if (sendAll) { int totalFiles = DirectoryEx.GetTotalFiles(volInfo.RootDirectory); Debug.Print("BlueConePlayer: Sending " + totalFiles + " tracks to link " + connection.Link); connection.SendMessage("LISTSTART#" + totalFiles); FileStream fs = new FileStream("\\SD\\fileinfo.txt", FileMode.Open, FileAccess.Read, FileShare.None, 512); StreamReader sr = new StreamReader(fs); string file; //while ((file = sr.ReadLine()) != null) while ((file = ReadLineEx(sr)) != null) { connection.SendMessage("LIST#" + file); } sr.Close(); } if (currentTrackPath != null) { connection.SendMessage("PLAYING#" + currentTrackPath); } if (playlist.Count > 0) { Debug.Print("BlueConePlayer: Sending queue to link " + connection.Link); string[] playQueue = playlist.GetPlaylist(); for (int pos = 0; pos < playQueue.Length; pos++) { connection.SendMessage("QUEUE#" + pos + "|" + playQueue[pos]); } } } }