private void frmMain_Shown(object sender, EventArgs e) { this.Refresh(); try { // Get executable path if (Registry.LocalMachine.OpenSubKey("SOFTWARE").OpenSubKey("Wizet") != null && Registry.LocalMachine.OpenSubKey("SOFTWARE").OpenSubKey("Wizet").OpenSubKey("MapleStory") != null && Registry.LocalMachine.OpenSubKey("SOFTWARE").OpenSubKey("Wizet").OpenSubKey("MapleStory").GetValue("Executable") != null) { _mapleEXE = (string)Registry.LocalMachine.OpenSubKey("SOFTWARE").OpenSubKey("Wizet").OpenSubKey("MapleStory").GetValue("Executable"); } _keyboardHook = new KeyboardHook(); _keyboardHook.KeyPressed += _keyboardHook_KeyPressed; _keyboardHook.RegisterHotKey(Mapler_Client.ModifierKeys.Alt, Keys.R); ServerConnection.Initialize(frmGateway.GatewayHostname, frmGateway.GatewayPort); lblConnecting.Text = "Initializing main routine..."; Sniffer.Init(); lblConnecting.Visible = false; } catch (Exception ex) { if (ex.ToString().Contains("Unable to connect")) { MessageBox.Show("It looks like Mapler.me has a server check or update ongoing! Please check the website for more information.\r\n\r\nThe program will now exit.", "Mapler.me connection error!", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(string.Format("An error occurred while initializing everything!\r\nContact us at [email protected] if you want more information about this error.\r\n{0}\r\n\r\nThe program will now exit.", ex.ToString()), "ERROR"); } Program.Closing = true; Environment.Exit(1); } }
public static void Init() { Instance = new Sniffer(); Instance.SetUp(); }