public void RandomLyric() { anim.SetTrigger("PopIn"); change = false; Invoke("Change", 1f); selectedLyric = lyrics[Random.Range(0, lyrics.Count)]; lyrics.Remove(selectedLyric); usedLyrics.Add(selectedLyric); if (lyrics.Count <= 0) { RefillList(); } }
public override void DoDisplay(Lyric lyric) { Console.ForegroundColor = ConsoleColor.Cyan; Console.Write(lyric.OriginalMetadata.Title); Console.ForegroundColor = ConsoleColor.Blue; Console.Write(" by "); Console.ForegroundColor = ConsoleColor.Cyan; Console.Write(lyric.OriginalMetadata.Artist); Console.ForegroundColor = ConsoleColor.Blue; Console.Write(" from "); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine(lyric.OriginalMetadata.Album); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(lyric.Text); Console.WriteLine(); }
public abstract void DoDisplay(Lyric lyric);
public bool Generatable(Lyric lyric) => Generator.Keys.Any(k => k.Equals(lyric.Language));
public Issue Create(Lyric lyric, TimeInvalid[] invalidTime) => new LyricTimeIssue(lyric, this, invalidTime);
private void initialLyricLine(Lyric lyricLine) => layoutArea.Child = drawableLyricLine = new TestDrawableLyricLine(this, lyricLine);
private static void WriteCache(string title, string artist, int duration, Lyric lyric) { throw new NotImplementedException(); }
private bool ImportHymnalFromJson(string rawJson) { var hymnDict = new Dictionary <Guid, Hymn>(); var lyricDict = new Dictionary <Guid, List <Lyric> >(); var songbook = JObject.Parse(rawJson); songbook.TryGetValue("Title", out JToken title); var sb = new Songbook() { Title = title?.Value <string>() ?? "You should really title this" }; _connection.InsertOrReplaceAsync(sb).Wait(); // This sets the Id property var hymns = songbook["Hymns"]; var tasks = new List <Task>(); // Load it all into memory foreach (var h in hymns) { var insertGuid = Guid.NewGuid(); var hm = new Hymn() { SongbookId = sb.Id.GetValueOrDefault(), HymnNumber = h["hymnNumber"].Value <int>() }; hymnDict.Add(insertGuid, hm); List <Lyric> lyrics = new List <Lyric>(); for (int i = 0; i < h["lyrics"].Count(); i++) { var l = h["lyrics"][i]; var ly = new Lyric() { IsChorus = l["isChorus"].Value <bool>(), Verse = l["text"].Value <string>(), Order = i + 1 }; lyrics.Add(ly); } lyricDict.Add(insertGuid, lyrics); } _connection.InsertAllAsync(hymnDict.Values).Wait(); var masterLyricsList = new List <Lyric>(); foreach (var hymn in hymnDict) { var guid = hymn.Key; var hymnId = hymn.Value.Id.Value; var lyrics = lyricDict[guid]; if (lyrics != null) { foreach (var lyric in lyrics) { lyric.HymnId = hymnId; } masterLyricsList.AddRange(lyrics); } } _connection.InsertAllAsync(masterLyricsList); return(true); }
public DrawableLyric([CanBeNull] Lyric hitObject) : base(hitObject) { }
public EditNoteBlueprintContainer(Lyric lyric) { this.lyric = lyric; }
public LockInfo(Lyric lyric) { this.lyric = lyric; Size = new Vector2(12); }
private void sortingTimeTag(Lyric lyric) => lyric.TimeTags = TimeTagsUtils.Sort(lyric.TimeTags);
public TimeTagIndexCaretPosition(Lyric lyric, TextIndex index) { Lyric = lyric; Index = index; }
public void UnlockLyric(Lyric lyric) => UnlockLyrics(new List <Lyric> { lyric });
public virtual void LockLyric(Lyric lyric, LockState lockState) => LockLyrics(new List <Lyric> { lyric }, lockState);
public void RemoveSingerToLyric(Singer singer, Lyric lyric) => RemoveSingersToLyrics(new List <Singer> { singer }, new List <Lyric> { lyric });
public void AddSingerToLyric(Singer singer, Lyric lyric) => AddSingersToLyrics(new List <Singer> { singer }, new List <Lyric> { lyric });
/// <summary> /// 解析函数 /// </summary> /// <param name="content">文件绝对路径</param> internal static LyricInfo ParseLyricFunc(string content) { if (string.IsNullOrEmpty(content)) { return(null); } string[] lyricsTemp = ParseLyric.SplitString(content); string singerNameTemp = string.Empty; string songNameTemp = string.Empty; string albumTemp = string.Empty; List <Lyric> lyrics = new List <Lyric>(); Lyric lyricTemp = new Lyric(); int leftTag; int rightTag; string timeTemp; string[] arrayTime; float temp; bool isResult; for (int i = 0; i < lyricsTemp.Length; i++) { //歌手 if (lyricsTemp[i].Contains(AR)) { singerNameTemp = lyricsTemp[i].Substring(4, lyricsTemp[i].Length - 5); } //歌名 else if (lyricsTemp[i].Contains(TI)) { songNameTemp = lyricsTemp[i].Substring(4, lyricsTemp[i].Length - 5); } //专辑 else if (lyricsTemp[i].Contains(AL)) { albumTemp = lyricsTemp[i].Substring(4, lyricsTemp[i].Length - 5); } //歌词 else if (lyricsTemp[i].Contains(LEFTSQUAREBRZCKETS)) { leftTag = lyricsTemp[i].IndexOf(LEFTSQUAREBRZCKETS); rightTag = lyricsTemp[i].IndexOf(RIGHTSQUAREBRZCKETS); if (lyricsTemp[i].Length - 1 <= rightTag) { continue; } timeTemp = lyricsTemp[i].Substring(leftTag + 1, rightTag - (leftTag + 1)); arrayTime = new string[3]; arrayTime[0] = timeTemp.Substring(0, 2); arrayTime[1] = timeTemp.Substring(3, 2); arrayTime[2] = timeTemp.Substring(6, 2); lyricTemp = new Lyric(); //分 isResult = float.TryParse(arrayTime[0], out temp); lyricTemp.lyricTime += isResult ? temp * 60f : 0f; //秒 isResult = float.TryParse(arrayTime[1], out temp); lyricTemp.lyricTime += isResult ? temp : 0f; //毫秒 isResult = float.TryParse(arrayTime[2], out temp); lyricTemp.lyricTime += isResult ? temp * 0.01f : 0f; if (lyricsTemp[i].Length <= rightTag + 1) { lyricTemp.lyricContent = string.Empty; } else { lyricTemp.lyricContent = lyricsTemp[i].Substring(rightTag + 1, lyricsTemp[i].Length - (rightTag + 1)); } lyrics.Add(lyricTemp); } } LyricInfo lyricInfo = new LyricInfo(singerNameTemp, songNameTemp, albumTemp, lyrics); return(lyricInfo); }
//Read the note public static NoteProperties ReadNote(int notenumber, ScorePartwise.Part.Measure measure) { if (getnoteindex(notenumber, measure) != -1) { Note note = (Note)measure.getNoteOrBackupOrForward().get(getnoteindex(notenumber, measure)); NoteProperties noteprop = new NoteProperties(); noteprop.chord = note.getChord() == new Empty() ? true : false; if (note.getRest() != null) { //MessageBox.Show("Rest Read!"); noteprop.rest = true; try { noteprop.NoteType = note.getType().getValue(); } catch (System.Exception) { noteprop.NoteType = ""; } } else if (note.getPitch() is Pitch) { noteprop.NoteType = note.getType().getValue(); // get the notetype only if it is not a rest noteprop.PitchStep = note.getPitch().getStep().value(); noteprop.Pitchoctave = note.getPitch().getOctave(); if (note.getPitch().getAlter() != null) { noteprop.PitchAlter = note.getPitch().getAlter().floatValue(); } } noteprop.duration = note.getDuration().intValue(); if (note.getTie().size() != 0) { Tie tie = (Tie)note.getTie().get(0); noteprop.TieType = tie.getType().toString(); } noteprop.dot = note.getDot().size() == 0? false:true; noteprop.AccidentalType = note.getAccidental() == null? "":note.getAccidental().getValue().value(); if (note.getTimeModification() != null) { noteprop.TimeModactualnotes = note.getTimeModification().getActualNotes().intValue().ToString(); noteprop.TimeModnormalnotes = note.getTimeModification().getNormalNotes().intValue().ToString(); noteprop.TimeModnormaltype = note.getTimeModification().getNormalType() == null ? "" : note.getTimeModification().getNormalType(); } ///////////////////////////////////COMPLETE ME Beam beam; for (int i = 0; i < note.getBeam().size(); i++) { beam = (Beam)note.getBeam().get(i); noteprop.beamvalue.Add(beam.getValue().value()); noteprop.beamnumber.Add(beam.getNumber()); } if (note.getNotations().size() != 0) { Notations notations = (Notations)note.getNotations().get(0); for (int i = 0; i < notations.getTiedOrSlurOrTuplet().size(); i++) { if (notations.getTiedOrSlurOrTuplet().get(i) is Tied) { Tied tied = (Tied)notations.getTiedOrSlurOrTuplet().get(i); //if(tied.getNumber().intValue()==1) noteprop.TiedType = tied.getType().value(); } if (notations.getTiedOrSlurOrTuplet().get(i) is Slur) { Slur slur = (Slur)notations.getTiedOrSlurOrTuplet().get(i); if (slur.getNumber() == 1) { noteprop.SlurType = slur.getType().value(); } } if (notations.getTiedOrSlurOrTuplet().get(i) is Tuplet) { Tuplet tuplet = (Tuplet)notations.getTiedOrSlurOrTuplet().get(i); noteprop.TupletType = tuplet.getType().value(); //noteprop.TupletNumber = tuplet.getNumber().intValue(); } if (notations.getTiedOrSlurOrTuplet().get(i) is Dynamics) { Dynamics dynamics = (Dynamics)notations.getTiedOrSlurOrTuplet().get(i); javax.xml.bind.JAXBElement x = (javax.xml.bind.JAXBElement)dynamics.getPOrPpOrPpp().get(0); noteprop.dynamic = x.getName().ToString(); } } } if (note.getLyric().size() != 0) { Lyric lyric = (Lyric)note.getLyric().get(0); for (int i = 0; i < lyric.getElisionAndSyllabicAndText().size(); i++) { if (lyric.getElisionAndSyllabicAndText().get(i) is Syllabic) { Syllabic syllabic = (Syllabic)lyric.getElisionAndSyllabicAndText().get(i); noteprop.LyricSyllabic = syllabic.value(); } if (lyric.getElisionAndSyllabicAndText().get(i) is TextElementData) { TextElementData text = (TextElementData)lyric.getElisionAndSyllabicAndText().get(i); noteprop.LyricText = text.getValue(); } } noteprop.LyricEndline = lyric.getEndLine() == null?false:true; } return(noteprop); } return(null); }
/// <summary> /// Encode /// </summary> /// <param name="lyric"></param> /// <returns></returns> public abstract string Encode(Lyric lyric);
public async Task Can_create_OneToOne_relationship_from_principal_side() { // Arrange MusicTrack existingTrack = _fakers.MusicTrack.Generate(); await _testContext.RunOnDatabaseAsync(async dbContext => { dbContext.MusicTracks.Add(existingTrack); await dbContext.SaveChangesAsync(); }); var requestBody = new { atomic__operations = new[] { new { op = "add", data = new { type = "lyrics", relationships = new { track = new { data = new { type = "musicTracks", id = existingTrack.StringId } } } } } } }; const string route = "/operations"; // Act (HttpResponseMessage httpResponse, AtomicOperationsDocument responseDocument) = await _testContext.ExecutePostAtomicAsync <AtomicOperationsDocument>(route, requestBody); // Assert httpResponse.Should().HaveStatusCode(HttpStatusCode.OK); responseDocument.Results.Should().HaveCount(1); responseDocument.Results[0].SingleData.Should().NotBeNull(); responseDocument.Results[0].SingleData.Type.Should().Be("lyrics"); responseDocument.Results[0].SingleData.Attributes.Should().NotBeEmpty(); responseDocument.Results[0].SingleData.Relationships.Should().NotBeEmpty(); long newLyricId = long.Parse(responseDocument.Results[0].SingleData.Id); await _testContext.RunOnDatabaseAsync(async dbContext => { Lyric lyricInDatabase = await dbContext.Lyrics.Include(lyric => lyric.Track).FirstWithIdAsync(newLyricId); lyricInDatabase.Track.Should().NotBeNull(); lyricInDatabase.Track.Id.Should().Be(existingTrack.Id); }); }
public PreviewDrawableLyricLine(Lyric hitObject) : base(hitObject) { }
public async Task Can_create_OneToOne_relationship_from_dependent_side() { // Arrange Lyric existingLyric = _fakers.Lyric.Generate(); string newTrackTitle = _fakers.MusicTrack.Generate().Title; await _testContext.RunOnDatabaseAsync(async dbContext => { dbContext.Lyrics.Add(existingLyric); await dbContext.SaveChangesAsync(); }); var requestBody = new { atomic__operations = new[] { new { op = "add", data = new { type = "musicTracks", attributes = new { title = newTrackTitle }, relationships = new { lyric = new { data = new { type = "lyrics", id = existingLyric.StringId } } } } } } }; const string route = "/operations"; // Act (HttpResponseMessage httpResponse, AtomicOperationsDocument responseDocument) = await _testContext.ExecutePostAtomicAsync <AtomicOperationsDocument>(route, requestBody); // Assert httpResponse.Should().HaveStatusCode(HttpStatusCode.OK); responseDocument.Results.Should().HaveCount(1); responseDocument.Results[0].SingleData.Should().NotBeNull(); responseDocument.Results[0].SingleData.Type.Should().Be("musicTracks"); responseDocument.Results[0].SingleData.Attributes.Should().NotBeEmpty(); responseDocument.Results[0].SingleData.Relationships.Should().NotBeEmpty(); Guid newTrackId = Guid.Parse(responseDocument.Results[0].SingleData.Id); await _testContext.RunOnDatabaseAsync(async dbContext => { MusicTrack trackInDatabase = await dbContext.MusicTracks.Include(musicTrack => musicTrack.Lyric).FirstWithIdAsync(newTrackId); trackInDatabase.Lyric.Should().NotBeNull(); trackInDatabase.Lyric.Id.Should().Be(existingLyric.Id); }); }
private static bool TryGetCache(string title, string artist, int duration, bool useTranslated, out Lyric lyric) { throw new NotImplementedException(); }
protected override ClickableLyric CreateLyricContainer(Lyric lyric) => new SaitenResultClickableLyric(lyric);
private bool checkMissingEndTimeTag(Lyric lyric) => !TimeTagsUtils.HasEndTimeTagInLyric(lyric.TimeTags, lyric.Text);
public SaitenResultClickableLyric(Lyric lyric) : base(lyric) { }
public Issue Create(Lyric lyric, Dictionary <TimeTagInvalid, TimeTag[]> invalidTimeTags, bool missingStartTimeTag, bool missingEndTimeTag) => new TimeTagIssue(lyric, this, invalidTimeTags, missingStartTimeTag, missingEndTimeTag);
public async Task CreateAsync(Lyric entity) { _dbContext.Lyrics.Add(entity); await _dbContext.SaveChangesAsync(); }
public TestDrawableLyricLine(TestSceneLyricLineStyle testCase, Lyric hitObject) : base(hitObject) { testScene = testCase; }
public async Task DeleteAsync(Lyric entity) { _dbContext.Entry(entity).State = EntityState.Deleted; await _dbContext.SaveChangesAsync(); }
public async Task UpdateAsync(Lyric entity) { // _dbContext.Entry(entity).State = EntityState.Modified; await _dbContext.SaveChangesAsync(); }
public async Task Can_replace_OneToOne_relationship_from_dependent_side() { // Arrange MusicTrack existingTrack = _fakers.MusicTrack.Generate(); existingTrack.Lyric = _fakers.Lyric.Generate(); Lyric existingLyric = _fakers.Lyric.Generate(); await _testContext.RunOnDatabaseAsync(async dbContext => { await dbContext.ClearTableAsync <Lyric>(); dbContext.AddRange(existingTrack, existingLyric); await dbContext.SaveChangesAsync(); }); var requestBody = new { atomic__operations = new[] { new { op = "update", data = new { type = "musicTracks", id = existingTrack.StringId, relationships = new { lyric = new { data = new { type = "lyrics", id = existingLyric.StringId } } } } } } }; const string route = "/operations"; // Act (HttpResponseMessage httpResponse, string responseDocument) = await _testContext.ExecutePostAtomicAsync <string>(route, requestBody); // Assert httpResponse.Should().HaveStatusCode(HttpStatusCode.NoContent); responseDocument.Should().BeEmpty(); await _testContext.RunOnDatabaseAsync(async dbContext => { MusicTrack trackInDatabase = await dbContext.MusicTracks.Include(musicTrack => musicTrack.Lyric).FirstWithIdAsync(existingTrack.Id); trackInDatabase.Lyric.Id.Should().Be(existingLyric.Id); List <Lyric> lyricsInDatabase = await dbContext.Lyrics.ToListAsync(); lyricsInDatabase.Should().HaveCount(2); }); }
public override void DoDisplay(Lyric lyric) { }
private static Lyric GetLyric(XmlNode noteNode) { var lyric = new Lyric(); var lyricNode = noteNode.SelectSingleNode("lyric"); if (lyricNode != null) { var syllabicNode = lyricNode.SelectSingleNode("syllabic"); var syllabicText = string.Empty; if (syllabicNode != null) syllabicText = syllabicNode.InnerText; switch (syllabicText) { case "": lyric.Syllabic = Syllabic.None; break; case "begin": lyric.Syllabic = Syllabic.Begin; break; case "single": lyric.Syllabic = Syllabic.Single; break; case "end": lyric.Syllabic = Syllabic.End; break; case "middle": lyric.Syllabic = Syllabic.Middle; break; } var textNode = lyricNode.SelectSingleNode("text"); if (textNode != null) lyric.Text = textNode.InnerText; } return lyric; }