Exemple #1
0
 /// <summary>
 /// 在List的某一位置添加新行
 /// </summary>
 /// <param name="index"></param>
 /// <param name="line"></param>
 public void AddLineAt(int index, Lrc line)
 {
     if (index < 0 || index > lrcList.Count)
     {
         return;
     }
     lrcList.Insert(index, line);
 }
Exemple #2
0
 /// <summary>
 /// 将全部歌词文本逐行分析,解析为多个Lrc元素
 /// 歌词文本中不包含时间信息,只有多行的歌词
 /// </summary>
 /// <param name="content"></param>
 public void LoadFromStringWithoutTime(string content)
 {
     Clear();
     string[] list = content.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
     foreach (string temp in list)
     {
         Lrc l = new Lrc("[00:00.000]" + temp);
         lrcList.Add(l);
     }
 }
Exemple #3
0
        // 根据LrcListBox的选择,更新下方两个文本框的内容
        private void ShowCurrentLineInfo()
        {
            if (Index == -1)
            {
                return;
            }
            Lrc lrc = lrcManager.GetLineAt(Index);

            TimeBox.Text = lrc.ActualTime.Info;
            LrcBox.Text  = lrc.LrcContent;
        }
Exemple #4
0
        /// <summary>
        /// 将某一行与其前一行互换
        /// 如果index小于第一元素位置,或大于最后一元素位置,则无变化
        /// </summary>
        /// <param name="index"></param>
        public void MoveLineUp(int index)
        {
            if (index <= 0 || index >= lrcList.Count)
            {
                return;
            }
            Lrc temp = GetLineAt(index);

            RemoveLineAt(index);
            AddLineAt(index - 1, temp);
        }
Exemple #5
0
        /// <summary>
        /// 将某一行与其后一行互换
        /// 如果index小于第一元素位置,或大于等于最后一元素位置,则无变化
        /// </summary>
        /// <param name="index"></param>
        public void MoveLineDown(int index)
        {
            if (index < 0 || index >= lrcList.Count - 1)
            {
                return;
            }
            Lrc temp = GetLineAt(index);

            RemoveLineAt(index);
            AddLineAt(index + 1, temp);
        }
Exemple #6
0
        /// <summary>
        /// 用于按时间排列的参考依据
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public int CompareTo(object obj)
        {
            Lrc o = (Lrc)obj;

            if (ActualTime > o.ActualTime)
            {
                return(1);
            }
            else if (ActualTime.TotalSeconds == o.ActualTime.TotalSeconds)
            {
                return(0);
            }
            else
            {
                return(-1);
            }
        }
Exemple #7
0
 /// <summary>
 /// 在List的末尾添加新行
 /// </summary>
 /// <param name="line"></param>
 public void AddLine(Lrc line)
 {
     lrcList.Add(line);
 }