コード例 #1
0
 /// <summary>
 /// Gets all the lines of the given translation (see <see cref="TranslationID"/>).
 /// </summary>
 /// <returns>A sequence of the lyrics' lines.</returns>
 public IEnumerable <ILyricsLine> GetAllLines()
 {
     return(from LineNode in this.doc.Descendants("Line")
            let Text = LineNode.Elements().Where(x => x.Attribute("ID").Value == this.translationID).First().Value
                       let Start = this.TimestampToSeconds(LineNode.Attribute("Start").Value)
                                   let End = this.TimestampToSeconds(LineNode.Attribute("End").Value)
                                             select new LyricsLine(Start, End, Text));
 }
コード例 #2
0
 /// <summary>
 /// Gets the lyrics line(s) at the given playback position. Multiple lines may be returned eg. when
 /// there are more than one singers. The translation defined in the <see cref="TranslationID"/> property will be used.
 /// </summary>
 /// <param name="Seconds">The playback position in seconds.</param>
 /// <returns>The lyrics line(s)</returns>
 public IEnumerable <string> GetLyricsLine(double Seconds)
 {
     return(from LineNode in this.doc.Descendants("Line")
            let Text = LineNode.Elements().Where(x => x.Attribute("ID").Value == this.translationID).First().Value
                       let Start = this.TimestampToSeconds(LineNode.Attribute("Start").Value)
                                   let End = this.TimestampToSeconds(LineNode.Attribute("End").Value)
                                             where Start <= Seconds && Seconds <= End
                                             select Text);
 }