Beispiel #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();
 }
Beispiel #2
0
            public static SBSound XMLRead(XmlReader XReader, SBCatagories Cat)
            {
                try
                {
                    SBSound Sound = null;
                    string  Key   = null;
                    string  File  = null;
                    while (XReader.Read())
                    {
                        switch (XReader.NodeType)
                        {
                        case XmlNodeType.Element:
                            switch (XReader.Name)
                            {
                            case "Key":
                                Key = XReader.ReadContentAsString();
                                break;

                            case "File":
                                File = XReader.ReadContentAsString();
                                break;
                            }
                            break;

                        case XmlNodeType.EndElement:
                            if (XReader.Name == "MemberSound")
                            {
                                if (Key != null && File != null)
                                {
                                    return(new SBSound(Cat, Key, File));
                                }
                                else
                                {
                                    throw new XmlException("Unexpected close of MemberSound. MemberSound is not complete!");
                                }
                            }
                            break;
                        }
                    }
                }
                catch (XmlException e)
                {
                    throw new XmlException(e.Message, e.InnerException, e.LineNumber, e.LinePosition);
                }
                throw new XmlException("Unexpected end of file. Before end of Soundboard");
            }
Beispiel #3
0
        /// <summary>
        /// removes a cat and its branches
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _Bu_SoundBoardCatagoryRemove_Click(object sender, EventArgs e)
        {
            if (_LB_SoundBoardCatagoryBinder.SelectedIndex == -1)
            {
                return;
            }

            for (int i = 0; i < _LB_SoundBoardSoundsBinder.Items.Count; i++)
            {
                SBSound temp = (SBSound)_LB_SoundBoardSoundsBinder.Items[i];
                if (temp.Cat.Equals(_LB_SoundBoardCatagoryBinder.Items[_LB_SoundBoardCatagoryBinder.SelectedIndex]))
                {
                    _LB_SoundBoardSoundsBinder.Items.RemoveAt(i);
                }
            }

            _LB_SoundBoardCatagoryBinder.Items.RemoveAt(_LB_SoundBoardCatagoryBinder.SelectedIndex);
            _Client?.SoundBoardListUpDate.Invoke();
        }