Example #1
0
        public override string ToString()
        {
            var lrc = new LrcParser.Lyric();

            int i = -1;

            if (lyric.AddtionalInfo != null)
            {
                var item = Find(a => a.Value.StartsWith(lyric.AddtionalInfo.First().Key));

                Sort((a, b) => a.Key.CompareTo(b.Key));
                i = IndexOf(item);

                lrc.AddtionalInfo = lyric.AddtionalInfo;
            }
            else
            {
                Sort((a, b) => a.Key.CompareTo(b.Key));
            }
            lrc.Slices = new List <LrcParser.Slice>();
            for (int j = 0; j < Count; j++)
            {
                if (i == j)
                {
                    continue;
                }
                lrc.Slices.Add(new LrcParser.Slice()
                {
                    Content = this[j].Value,
                    Offset  = this[j].Key
                });
            }
            lrc.Offset = Offset;
            return(LrcParser.Parser.Create(lrc));
        }
Example #2
0
 public Lyric(LrcParser.Lyric l)
 {
     if (l == null)
     {
         return;
     }
     lyric = l;
     if (l.AddtionalInfo != null)
     {
         Add(new KeyValuePair <TimeSpan, string>(TimeSpan.Zero, string.Join(Environment.NewLine, l.AddtionalInfo.Select(x => $"{x.Key}: {x.Value}"))));
     }
     AddRange(l.Slices.Select(x => new KeyValuePair <TimeSpan, string>(x.Offset, x.Content)));
 }