Exemple #1
0
        private void PlayBtn_Click(object sender, EventArgs e)
        {
            Button button = (Button)sender;

            String index_s = button.Name.Substring("PlayBtn".Length);
            int    index   = int.Parse(index_s);

            SoundClass.Play(index - 1);
        }
Exemple #2
0
        // Data decoding
        private static void DataReceived(byte[] data)
        {
            int index = -1;

            if (data.Length >= 2)
            {
                String[] sData    = Encoding.ASCII.GetString(data).Split(';');
                String   playType = sData[0];               // Normal / Hard

                index = int.Parse(sData[1]);                // should be a number

                if (index >= 0 && index < SoundClass.SoundsCount)
                {
                    if (String.Compare(playType, "Normal") == 0)
                    {
                        SoundClass.Play(index);
                    }
                    else if (String.Compare(playType, "Hard") == 0)
                    {
                        SoundClass.HardPlay(index);
                    }
                }
            }
        }
Exemple #3
0
        public static void PushedButtons(int keyCode)
        {
            if (Program.debugmode)
            {
                String realPressed = "";
                realPressed += "vkCode: " + keyCode + " \n";
                realPressed += "Key: " + (Keys)keyCode + " \n";
                realPressed += "ModifierKeys: " + Control.ModifierKeys + " \n";
                Console.WriteLine(realPressed);
            }

            Keys   key         = (Keys)keyCode;
            Hotkey pressedKeys = new Hotkey();

            if (Control.ModifierKeys.ToString().Contains(Keys.Control.ToString()))
            {
                pressedKeys.Add(Keys.Control);
            }
            if (Control.ModifierKeys.ToString().Contains(Keys.Shift.ToString()))
            {
                pressedKeys.Add(Keys.Shift);
            }
            if (Control.ModifierKeys.ToString().Contains(Keys.Alt.ToString()))
            {
                pressedKeys.Add(Keys.Alt);
            }

            bool doNotAdd = false;

            if (key.ToString().Contains(Keys.Control.ToString()))
            {
                doNotAdd = true;
            }
            if (key.ToString().Contains(Keys.Shift.ToString()))
            {
                doNotAdd = true;
            }
            if (key.ToString().Contains(Keys.Alt.ToString()))
            {
                doNotAdd = true;
            }

            if (!doNotAdd)
            {
                pressedKeys.Add(key);
            }

            /* HARD CODED EXIT COMBO */
            Hotkey exitCombo = new Hotkey("Control + Shift + Alt + Delete");

            if (pressedKeys.Equals(exitCombo))
            {
                SettingsForm.forceClose = true;
                Application.Exit();
            }
            /* HARD CODED EXIT COMBO */

            ButtonPushed(pressedKeys);

            for (int i = 0; i < SoundClass.HotkeyCount; i++)
            {
                if (pressedKeys.Equals(SoundClass.GetHotkey(i)))
                {
                    if (SettingsForm.ToNetwork)
                    {
                        NetworkClass.Send(i.ToString());
                    }
                    else
                    {
                        if (NetworkClass.hardPlay && Program.godmode)
                        {
                            SoundClass.HardPlay(i);
                        }
                        else
                        {
                            SoundClass.Play(i);
                        }
                    }
                }
            }

            if (Program.debugmode)
            {
                Console.WriteLine(pressedKeys.ToString());
            }
        }