Exemple #1
0
 /// <summary>
 /// 反向初始化插件
 /// </summary>
 public override void DeInit()
 {
     PlayControl.Next();
     Config.Save();
     OutputControl.DeInit();
     try
     { Directory.Delete(Config.SongsCachePath, true); }
     catch (Exception)
     { }
 }
Exemple #2
0
        internal static void DGJ_AdminComment(string msg)
        {
            if (string.IsNullOrWhiteSpace(msg) || !Config.DanmakuControl)
            {
                return;
            }           // 如果弹幕msg没有内容或者不允许弹幕控制

            string[] msgs = msg.Split(new string[] { " " }, System.StringSplitOptions.RemoveEmptyEntries);
            switch (msgs[0])
            {
            case "暫停":
            case "暂停":
                if (PlayControl.Pause())
                {
                    Log("歌曲已经暂停");
                }
                return;

            case "播放":
                if (PlayControl.Play())
                {
                    Log("歌曲继续播放");
                }
                return;

            case "切歌":
                if (PlayControl.Next())
                {
                    Log("已经切掉正在播放的歌曲");
                }
                return;

            case "刪歌":
            case "删歌":
                int num;
                if (msgs.Length >= 2 && int.TryParse(msgs[1], out num))
                {
                    num--;
                    if (num >= 0 && num < Center.Songs.Count)
                    {
                        SongItem item = Center.Songs[num];
                        Log($"切掉了 {item.User} 点的 {item.SongName}", true);
                        switch (item.Status)
                        {
                        case SongItem.SongStatus.WaitingDownload:
                            Center.RemoveSong(item);
                            return;

                        case SongItem.SongStatus.Downloading:
                            DownloadControl.CancelDownload();
                            return;

                        default:
                        case SongItem.SongStatus.WaitingPlay:
                            if (item.FilePath != null && item.FilePath != "")
                            {
                                new Thread((object o) =>
                                {
                                    try
                                    {
                                        File.Delete(o.ToString());
                                    }
                                    catch (Exception) { }
                                })
                                {
                                    IsBackground = true,
                                    Name         = "切歌后删除文件"
                                }
                            }
                            .Start(item.FilePath);
                            Center.RemoveSong(item);
                            return;

                        case SongItem.SongStatus.Playing:
                            PlayControl.Next();
                            return;
                        }
                    }
Exemple #3
0
 /// <summary>
 /// 切歌,按钮事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void NextSong_Click(object sender, RoutedEventArgs e)
 {
     PlayControl.Next();
 }
Exemple #4
0
 public void MusicNext()
 {
     PlayControl.Next();
 }