Example #1
0
 public static void UpdateSize(float size)
 {
     if (((defaultFont.Size + size) >= 12f) && ((defaultFont.Size + size) <= 48f))
     {
         defaultFont = new Font(defaultFont.FontFamily, defaultFont.Size + size, FontStyle.Bold, GraphicsUnit.Pixel);
     }
     if (!string.IsNullOrEmpty(lyric.fileName))
     {
         lock (lyric)
         {
             lyric = new Lrc(lyric.fileName);
         }
     }
     lrcWindow.Update();
 }
Example #2
0
        public async static void SearchLrc(Song song)
        {
            bool isExist = false;

            lyric.Clear();
            string fileName = Common.getTitleFromPath(song.FileUrl);

            try
            {
                if (lrcWindowStatue)
                {
                    lrcWindow.Init(fileName);
                }
                foreach (string str in LrcTypes)
                {
                    FileInfo[] files = new DirectoryInfo(song.FileUrl).Parent.GetFiles(str, SearchOption.TopDirectoryOnly);
                    if (files != null)
                    {
                        foreach (FileInfo info2 in files)
                        {
                            string fullName = info2.FullName;
                            if (Regex.IsMatch(fullName, fileName))
                            {
                                lyric   = new Lrc(fullName);
                                isExist = true;
                                break;
                            }
                        }
                    }
                }
                if (!isExist && await PopupTip.CheckNetWork())
                {
                    string lrcPath = await DownLrc.DownloadLrcAsync(song);

                    if (string.IsNullOrEmpty(lrcPath))
                    {
                        lrcPath = await DownLrc.DownloadLrcAsyncFromQian(song);
                    }
                    if (!string.IsNullOrEmpty(lrcPath) && lrcWindowStatue)
                    {
                        lyric = new Lrc(lrcPath);
                    }
                }
            }
            catch (Exception ex) { Console.WriteLine(ex.ToString()); }
        }