Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.Net;
- using shadowAPI2;
- using System.Collections;
- using System.IO;
- using System.Net.NetworkInformation;
- using Utilities;
- using Ini;
- namespace MainForm
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- if (File.Exists(@"C:\Keybinder\NR-Keybinder\Texte.ini"))
- {
- IniFile ini = new IniFile(@"C:\Keybinder\NR-Keybinder\Texte.ini");
- try { textBox1.Text = ini.IniReadValue("Hotkeys", "Text1"); }
- catch (NullReferenceException) { }
- try { textBox2.Text = ini.IniReadValue("Hotkeys", "Text2"); }
- catch (NullReferenceException) { }
- try { textBox3.Text = ini.IniReadValue("Hotkeys", "Text3"); }
- catch (NullReferenceException) { }
- try { textBox4.Text = ini.IniReadValue("Hotkeys", "Text4"); }
- catch (NullReferenceException) { }
- try { textBox5.Text = ini.IniReadValue("Hotkeys", "Text5"); }
- catch (NullReferenceException) { }
- try { textBox6.Text = ini.IniReadValue("Hotkeys", "Text6"); }
- catch (NullReferenceException) { }
- try { textBox7.Text = ini.IniReadValue("Hotkeys", "Text7"); }
- catch (NullReferenceException) { }
- try { textBox8.Text = ini.IniReadValue("Hotkeys", "Text8"); }
- catch (NullReferenceException) { }
- try { textBox9.Text = ini.IniReadValue("Hotkeys", "Text9"); }
- catch (NullReferenceException) { }
- try { textBox10.Text = ini.IniReadValue("Hotkeys", "Text10"); }
- catch (NullReferenceException) { }
- }
- else
- {
- textBox1.Text = "";
- textBox2.Text = "";
- textBox3.Text = "";
- textBox4.Text = "";
- textBox5.Text = "";
- textBox6.Text = "";
- textBox7.Text = "";
- textBox8.Text = "";
- textBox9.Text = "";
- textBox10.Text = "";
- }
- InitializeComponent();
- globalKeyboardHook gkh = new globalKeyboardHook();
- gkh.HookedKeys.Add(Keys.NumPad0);
- gkh.HookedKeys.Add(Keys.NumPad1);
- gkh.HookedKeys.Add(Keys.NumPad2);
- gkh.HookedKeys.Add(Keys.NumPad3);
- gkh.HookedKeys.Add(Keys.NumPad4);
- gkh.HookedKeys.Add(Keys.NumPad5);
- gkh.HookedKeys.Add(Keys.NumPad6);
- gkh.HookedKeys.Add(Keys.NumPad7);
- gkh.HookedKeys.Add(Keys.NumPad8);
- gkh.HookedKeys.Add(Keys.NumPad9);
- gkh.KeyDown += new KeyEventHandler(gkh_KeyDown);
- }
- public void gkh_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.NumPad1)
- {
- if (textBox1.TextLength != 0)
- {
- Chat.GetInstance().Send(textBox1.Text);
- }
- e.Handled = true;
- }
- if (e.KeyCode == Keys.NumPad2)
- {
- if (textBox2.TextLength != 0)
- {
- Chat.GetInstance().Send(textBox2.Text);
- }
- e.Handled = true;
- }
- if (e.KeyCode == Keys.NumPad3)
- {
- if (textBox3.TextLength != 0)
- {
- Chat.GetInstance().Send(textBox3.Text);
- }
- e.Handled = true;
- }
- if (e.KeyCode == Keys.NumPad4)
- {
- if (textBox4.TextLength != 0)
- {
- Chat.GetInstance().Send(textBox4.Text);
- }
- e.Handled = true;
- }
- if (e.KeyCode == Keys.NumPad5)
- {
- if (textBox5.TextLength != 0)
- {
- Chat.GetInstance().Send(textBox5.Text);
- }
- e.Handled = true;
- }
- if (e.KeyCode == Keys.NumPad6)
- {
- if (textBox6.TextLength != 0)
- {
- Chat.GetInstance().Send(textBox6.Text);
- }
- e.Handled = true;
- }
- if (e.KeyCode == Keys.NumPad7)
- {
- if (textBox7.TextLength != 0)
- {
- Chat.GetInstance().Send(textBox7.Text);
- }
- e.Handled = true;
- }
- if (e.KeyCode == Keys.NumPad8)
- {
- if (textBox8.TextLength != 0)
- {
- Chat.GetInstance().Send(textBox8.Text);
- }
- e.Handled = true;
- }
- if (e.KeyCode == Keys.NumPad9)
- {
- if (textBox9.TextLength != 0)
- {
- Chat.GetInstance().Send(textBox9.Text);
- }
- e.Handled = true;
- }
- if (e.KeyCode == Keys.NumPad0)
- {
- if (textBox10.TextLength != 0)
- {
- Chat.GetInstance().Send(textBox10.Text);
- }
- e.Handled = true;
- }
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- private void button1_Click(object sender, EventArgs e)
- {
- if (!System.IO.Directory.Exists(@"C:\Kebinder\NR-Keybinder"))
- {
- System.IO.Directory.CreateDirectory(@"C:\Keybinder\NR-Keybinder");
- }
- if (!System.IO.File.Exists(@"C:\Keybinder\NR-Keybinder\Texte.ini"))
- {
- System.IO.File.Create(@"C:\Keybinder\NR-Keybinder\Texte.ini");
- }
- IniFile ini = new IniFile(@"C:\Keybinder\NR-Keybinder\Texte.ini");
- string text1 = textBox1.Text;
- string text2 = textBox2.Text;
- string text3 = textBox3.Text;
- string text4 = textBox4.Text;
- string text5 = textBox5.Text;
- string text6 = textBox6.Text;
- string text7 = textBox7.Text;
- string text8 = textBox8.Text;
- string text9 = textBox9.Text;
- string text10 = textBox10.Text;
- try { ini.IniWriteValue("Hotkeys", "Text1", text1); ini.IniWriteValue("Hotkeys", "Text2", text2); ini.IniWriteValue("Hotkeys", "Text3", text3); ini.IniWriteValue("Hotkeys", "Text4", text4); ini.IniWriteValue("Hotkeys", "Text5", text5); ini.IniWriteValue("Hotkeys", "Text6", text6); ini.IniWriteValue("Hotkeys", "Text7", text7); ini.IniWriteValue("Hotkeys", "Text8", text8); ini.IniWriteValue("Hotkeys", "Text9", text9); ini.IniWriteValue("Hotkeys", "Text10", text10); }
- catch { MessageBox.Show(@"Fehler...\nDie Texte konnten nicht gespeichert werden!", "NR-Keybinder"); }
- MessageBox.Show("Die Texte wurden erfolgreich gespeichert!", "NR-Keybinder");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement