Example #1
0
        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);
            }
        }
Example #2
0
        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);
            }
        }
Example #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            frmLogin.RemoveToken();

            Program.Closing = true;
            notifyIcon1.Visible = false;
            if (Sniffer.Instance != null)
            {
                Sniffer.Instance.Stop();
            }

            if (ServerConnection.Instance != null)
            {
                ServerConnection.Instance.Dispose();
            }

            if (_keyboardHook != null)
            {
                _keyboardHook.Dispose();
                _keyboardHook = null;
            }

            if (new frmLogin().ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                this.Close();
                return;
            }

            Form1_Load(null, null);
            this.Show();
        }