Exemplo n.º 1
0
 /// <summary>
 /// adds a file to the sound board
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void _Bu_SoundBoardSoundAdd_Click(object sender, EventArgs e)
 {
     if (_LB_SoundBoardCatagoryBinder.SelectedIndex != -1 && _TB_SoundBoardSouCat.Text != "" && _TB_SoundBoardSouFil.Text != "")
     {
         SBSound Temp = new SBSound((SBCatagories)_LB_SoundBoardCatagoryBinder.Items[_LB_SoundBoardCatagoryBinder.SelectedIndex], _TB_SoundBoardSouKey.Text, _TB_SoundBoardSouFil.Text);
         if (!_LB_SoundBoardSoundsBinder.Items.Contains(Temp) && File.Exists(PathGetter.GetSoundBoardPath(Temp.File)))
         {
             _LB_SoundBoardSoundsBinder.Items.Add(Temp);
         }
         else
         {
             MessageBox.Show("Can not Duplicate File or File does not exist in _SoundBoard_ folder");
         }
     }
     _Client?.SoundBoardListUpDate.Invoke();
 }
        /// <summary>
        /// Play a set of sounds
        /// </summary>
        /// <param name="Join"></param>
        /// <param name="Args"></param>
        void SoundBoard(ulong ServerLight, Channel Chat, Channel Join, string[] Args)
        {
            if (Args.Count() < 2 || Args.Count() == 2 && Args[1].ToLower() == "list")
            {
                string NList = "";

                foreach (SBCatagories s in SoundBoardBinding)
                {
                    NList += "\n" + s.Key + " -> " + s.Desc;
                }

                Chat.SendMessage("Let me help you with a list!:kissing_heart:\nThere are " + SoundBoardBinding.Count + " tree(s) to pick from." + NList + "\n!@soundboard list [the tree] -> for more");
            }
            else if (Args[1].ToLower() == "list" && SoundBoardBinding[Args[2].ToLower()] != null)
            {
                string NList = "";

                foreach (SBSound s in SoundBoardBinding[Args[2]])
                {
                    NList += "\n" + s.Key;
                }

                Chat.SendMessage("Let me help you with a list!:kissing_heart:\nHere is the list for " + SoundBoardBinding[Args[2].ToLower()].Desc + "." + NList + "\n!@soundboard [the tree] [the key] -> to play");
            }
            else if (Args.Count() == 3)
            {
                if (Join != null)
                {
                    if (SoundBoardBinding[Args[1].ToLower()] != null && SoundBoardBinding[Args[1].ToLower()][Args[2].ToLower()] != null)
                    {
                        SendAudioFile(ServerLight, Join, PathGetter.GetSoundBoardPath(SoundBoardBinding[Args[1].ToLower()][Args[2].ToLower()][Rand.Next(SoundBoardBinding[Args[1].ToLower()][Args[2].ToLower()].Count)]));
                    }
                    else
                    {
                        Chat.SendMessage("Sorry but you may have to double check your tree or sound keys");
                    }
                }
                else
                {
                    Chat.SendMessage("Sorry but you are not in a voice chat");
                }
            }
        }
 async void TestSendAudio(ulong ServerLight, Channel testout)
 {
     await SendAudioFileInternal(ServerLight, testout, PathGetter.GetSoundBoardPath("Recording.m4a"));
 }