Exemple #1
0
 public MusicLib(LyricView LV, string id)
 {
     if (!Directory.Exists(Settings.USettings.DownloadPath))
     {
         Directory.CreateDirectory(Settings.USettings.DownloadPath);
     }
     if (!Directory.Exists(Settings.USettings.CachePath))
     {
         Directory.CreateDirectory(Settings.USettings.CachePath);
     }
     if (!Directory.Exists(Settings.USettings.CachePath + "Music\\"))
     {
         Directory.CreateDirectory(Settings.USettings.CachePath + "Music\\");
     }
     if (!Directory.Exists(Settings.USettings.CachePath + "Lyric\\"))
     {
         Directory.CreateDirectory(Settings.USettings.CachePath + "Lyric\\");
     }
     if (!Directory.Exists(Settings.USettings.CachePath + "Image\\"))
     {
         Directory.CreateDirectory(Settings.USettings.CachePath + "Image\\");
     }
     lv = LV;
     qq = id;
 }
Exemple #2
0
        public string PushLyric(string t, string x, string file)
        {
            List <string> datatime             = new List <string>();
            List <string> datatext             = new List <string>();
            Dictionary <string, string> gcdata = new Dictionary <string, string>();

            string[] dta = t.Split('\n');
            foreach (var dt in dta)
            {
                LyricView.parserLine(dt, datatime, datatext, gcdata);
            }
            List <String> dataatimes           = new List <String>();
            List <String> dataatexs            = new List <String>();
            Dictionary <String, String> fydata = new Dictionary <String, String>();

            String[] dtaa = x.Split('\n');
            foreach (var dt in dtaa)
            {
                LyricView.parserLine(dt, dataatimes, dataatexs, fydata);
            }
            List <String> KEY = new List <String>();
            Dictionary <String, String> gcfydata = new Dictionary <String, String>();
            Dictionary <String, String> list     = new Dictionary <String, String>();

            foreach (var dt in datatime)
            {
                KEY.Add(dt);
                gcfydata.Add(dt, "");
            }
            for (int i = 0; i != gcfydata.Count; i++)
            {
                if (fydata.ContainsKey(KEY[i]))
                {
                    gcfydata[KEY[i]] = (gcdata[KEY[i]] + "^" + fydata[KEY[i]]).Replace("\n", "").Replace("\r", "");
                }
                else
                {
                    string dt = LyricView.YwY(KEY[i], 1);
                    if (fydata.ContainsKey(dt))
                    {
                        gcfydata[KEY[i]] = (gcdata[KEY[i]] + "^" + fydata[dt]).Replace("\n", "").Replace("\r", "");
                    }
                    else
                    {
                        gcfydata[KEY[i]] = (gcdata[KEY[i]] + "^").Replace("\n", "").Replace("\r", "");
                    }
                }
            }
            string LyricData = "";

            for (int i = 0; i != KEY.Count; i++)
            {
                String value = gcfydata[KEY[i]].Replace("[", "").Replace("]", "");
                String key   = KEY[i];
                LyricData += $"[{key}]{value}\r\n";
            }
            File.WriteAllText(file, LyricData);
            return(LyricData);
        }