private void LoadNRC(NRCModel nrc) { NRCSList.Clear(); SP.Children.Clear(); foreach (NRCSentenceModel nrcsm in nrc.NRCS) { NRCSentence nrcs = new NRCSentence(); nrcs.Data = nrcsm; nrcs.Index = NRCSList.Count; nrcs.Event += NRCSEvent; nrcs.StartTime = nrcsm.StartTime; SP.Children.Add(nrcs); NRCSList.Add(nrcs); } }
public Lyric(string str) { NRC = new NRCModel(); NRC.NRCS = new List <NRCSentenceModel>(); LyricType lt = GetLyricType(str); NRC.LyricType = lt; if (lt == LyricType.LRC) { LoadLRC(str); Export(); } else { LoadNRC(str); } }
/// <summary> /// 保存NRC歌词 /// </summary> /// <param name="savepath"></param> public void ExportNRCFile(string savepath) { NRCModel nm = new NRCModel(); nm.LyricType = LyricType.NRC; nm.NRCS = new List <NRCSentenceModel>(); foreach (NRCSentence nrcs in NRCSList) { NRCSentenceModel nrcsm = new NRCSentenceModel(); nrcsm.StartTime = nrcs.StartTime; Debug.WriteLine(nrcs.ToString() + "->" + nrcs.StartTime); nrcsm.NRCWord = new List <NRCWordModel>(); foreach (NRCWord nrcw in nrcs.NWList) { nrcsm.NRCWord.Add(nrcw.Data); } nm.NRCS.Add(nrcsm); } File.WriteAllText(savepath, JsonConvert.SerializeObject(nm)); }
/// <summary> /// 加载NRC格式歌词 /// </summary> /// <param name="nrc"></param> public void LoadNRC(NRCModel nrc) { NRCSList.Clear(); StackPanel.Children.Clear(); foreach (NRCSentenceModel nrcsm in nrc.NRCS) { NRCSentence nrcs = new NRCSentence(); nrcs.StartTime = nrcsm.StartTime; //nrcs.LyricType = LyricType.NRC;//测试逐字 nrcs.LyricType = nrc.LyricType; //正常调用 nrcs.Margin = new Thickness(0, 10, 0, 0); nrcs.Loaded += (e, c) => { nrcs.LoadNRCWord(nrcsm.NRCWord); }; StackPanel.Children.Add(nrcs); NRCSList.Add(nrcs); } }
private void LoadNRC(string nrc) { NRC = JsonConvert.DeserializeObject <NRCModel>(nrc); }