Beispiel #1
0
 public void updateProgressBar(ProgressValue data, int maxProcess)
 {
     if (0 <= data.count)  // 楽曲転送用
     {
         ProgressBarControl.Value = (int)(data.count * 100 / (float)maxProcess);
         lbl_Detail.Text          = string.Format("{0} / {1} を転送中…", data.artist, data.songname);
         lbl_Count.Text           = string.Format("{0} / {1}", data.count + 1, maxProcess);
     }
     else  // その他用途
     {
         ProgressBarControl.Value = 0;
         lbl_Detail.Text          = data.message;
         lbl_Count.Text           = "";
     }
 }
Beispiel #2
0
        private async Task <ProgressValue> MakePlaylist(ListViewItem playlist)
        {
            ProgressValue values = new ProgressValue();

            await Task.Run(() =>
            {
                var plId = playLists.Where(pl => pl.name == playlist.Text)
                           .FirstOrDefault()
                           .id;
                var songIDs          = xml.GetPlayListDetails(plId);
                var transferPlaylist = new List <Dictionary <string, string> >();

                foreach (var songID in songIDs)
                {
                    var song = songList.Where(s => s["Track ID"] == songID)
                               .FirstOrDefault();
                    var src = Tools.MakeValidPath(song["Location"]);
                    if (File.Exists(src))
                    {
                        transferPlaylist.Add(song);
                    }
                    else
                    {
                        errorLog += string.Format("エラー:{0}が見つかりません。\r\n", src);
                    }
                }

                var m3u = new M3UPlayList(transferPlaylist);
                transferSongList.AddRange(m3u.MakePlayList(Path.Combine(savePath,
                                                                        Tools.RemoveInvalidChars(playlist.Text, ' ') + ".m3u")));
            });

            values.count   = -1;
            values.message = playlist.Text + " プレイリストの作成中…";

            return(values);
        }