Exemplo n.º 1
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;
                        }
                    }
Exemplo n.º 2
0
 /// <summary>
 /// 更新播放设备列表,按钮事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void RefreshPlayDevice(object sender, RoutedEventArgs e)
 {
     Center.LoadPlayDevices();
 }