/// <summary> /// splits a song up into song elements /// </summary> /// <param name="song"></param> /// <returns></returns> public static List <SongVerse> getSongVerses(Song song, bool displayEachSongSectionOnce) { string[] splitParameters2 = { " " }; string[] presentationOrder = song.presentation.Split(splitParameters2, StringSplitOptions.RemoveEmptyEntries); // Remove duplicate song sections (tipically choruses and interludes) if (displayEachSongSectionOnce) { presentationOrder = new HashSet <string>(presentationOrder).ToArray(); } List <SongVerse> elementsInOrder = new List <SongVerse>(); //split lyrics lines on pipe character var splitLyics = splitLyricsOnPipeCharacter(song.lyrics); //split the song lyrics up var newLyrics = splitLyricsIntoPieces(splitLyics); //split the notes up var newNotes = splitNotesIntoPieces(song.notes); //put all the elements in order of the song presentation for (int i = 0; i < presentationOrder.Count(); i++) { var header = presentationOrder[i]; //if the notes dont match up add blanks if needed if (newNotes.Count() - 1 < i) { newNotes.Add(""); } //if lyrics dont match up... make them if (!newLyrics.ContainsKey(header)) { newLyrics[header] = ""; } var lyrics = newLyrics[header]; var notes = newNotes[i]; var newElement = new SongVerse(header, lyrics, notes, i + 1); elementsInOrder.Add(newElement); } return(elementsInOrder); }
public static List <SongVerse> getSongVersesNoOrder(Song song) { List <SongVerse> songElements = new List <SongVerse>(); //split lyrics lines on pipe character var splitLyics = splitLyricsOnPipeCharacter(song.lyrics); //split the song lyrics up List <Tuple <string, string> > songSegments = splitLyricsIntoSegmentsNoOrder(splitLyics); //put all the elements in order of the song presentation foreach (Tuple <string, string> songSegment in songSegments) { var header = songSegment.Item1; var lyrics = songSegment.Item2; var newElement = new SongVerse(header, lyrics, "", songElements.Count() + 1); songElements.Add(newElement); } return(songElements); }
public List <SongVerse> getSongVerses(bool displayEachSongSectionOnce) { return(SongVerse.getSongVerses(this, displayEachSongSectionOnce)); }
public List <SongVerse> getSongVerses() { return(SongVerse.getSongVerses(this)); }