示例#1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // Output information about all of the installed voices.
            foreach (InstalledVoice voice in speaker.GetInstalledVoices())
            {
                VoiceInfo info = voice.VoiceInfo;
                comboBox1.Items.Add(info.Name);
            }
            comboBox1.SelectedIndex = 0;

            //init  buff array
            hookBuff = new Dictionary <int, object>();

            //load file
            if (!System.IO.File.Exists("settings.txt"))
            {
                MessageBox.Show("Setting file not found!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string[] lines = System.IO.File.ReadAllLines("settings.txt");

            foreach (string line in lines)
            {
                string[] data = line.Split('|');
                if ((line.ToCharArray())[0].Equals('#'))
                {
                    continue;
                }
                hookBuff.Add(Convert.ToInt32(data[0]), new Buff(data[1], Convert.ToInt32(data[2])));
            }

            hookBuff.Add(192, this);

            gHook = new GlobalKeyboardHook();

            gHook.KeyDown += new KeyEventHandler(gHook_KeyDown);

            foreach (Keys key in Enum.GetValues(typeof(Keys)))
            {
                if (hookBuff.ContainsKey((int)key))
                {
                    gHook.HookedKeys.Add(key);
                }
            }

            gHook.hook();
        }
示例#2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // Output information about all of the installed voices.
            foreach (InstalledVoice voice in speaker.GetInstalledVoices())
            {
                VoiceInfo info = voice.VoiceInfo;
                comboBox1.Items.Add(info.Name);
            }
            comboBox1.SelectedIndex = 0;

            //init  buff array
            hookBuff = new Dictionary<int, object>();

            //load file
            if (!System.IO.File.Exists("settings.txt"))
            {
                MessageBox.Show("Setting file not found!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string[] lines = System.IO.File.ReadAllLines("settings.txt");

            foreach (string line in lines)
            {
                string[] data = line.Split('|');
                if ((line.ToCharArray())[0].Equals('#')) continue;
                hookBuff.Add(Convert.ToInt32(data[0]), new Buff(data[1], Convert.ToInt32(data[2])));
            }

            hookBuff.Add(192, this);

            gHook = new GlobalKeyboardHook();

            gHook.KeyDown += new KeyEventHandler(gHook_KeyDown);

            foreach (Keys key in Enum.GetValues(typeof(Keys)))
                if (hookBuff.ContainsKey((int)key))
                    gHook.HookedKeys.Add(key);

            gHook.hook();
        }