Beispiel #1
0
        private void MainFormOnLoad(object sender, EventArgs e)
        {
            try
            {
                if (Others.ExistFile(Application.StartupPath + "\\Settings\\.login"))
                {
                    var strReader = new StreamReader(Application.StartupPath + "\\Settings\\.login", Encoding.Default);
                    try
                    {
                        string   text  = Others.DecryptString(strReader.ReadLine());
                        string[] text2 = text.Split('#');
                        Identifier.Text      = text2[0];
                        Password.Text        = text2[1];
                        Identifier.ForeColor = Color.FromArgb(118, 118, 118);
                        Password.ForeColor   = Color.FromArgb(118, 118, 118);
                        if (Identifier.Text != "")
                        {
                            Remember.Checked = true;
                            if (Password.Text == "Password")
                            {
                                UseKey.Checked = true;
                                Password.Hide();
                            }
                        }
                    }
                    catch
                    {
                        Identifier.Text  = "";
                        Password.Text    = "";
                        Remember.Checked = false;
                    }
                    strReader.Close();
                }

                LoginButton.Enabled   = false;
                RefreshButton.Enabled = false;
                LoginServer.CheckServerIsOnline();
                while (!LoginServer.IsOnlineserver)
                {
                    Thread.Sleep(30);
                    Application.DoEvents();
                }
                LoginServer.CheckUpdate();
                LoginButton.Enabled   = true;
                RefreshButton.Enabled = true;

                RefreshProcessList();

                /* Begin AutoStart code */
                bool sIdFound = false;
                if (_autoStarted > 0)
                {
                    for (int i = 0; i < SessionList.Items.Count; i++)
                    {
                        Application.DoEvents();
                        object item = SessionList.Items[i];
                        if (item.ToString().Contains(_autoStarted + " -"))
                        {
                            SessionList.SelectedIndex = i;
                            sIdFound = true;
                            break;
                        }
                    }
                    if (sIdFound)
                    {
                        nManagerSetting.ActivateProductTipOff = false;
                        LoginButton_Click(new object(), new EventArgs());
                    }
                }
                /*Process.Start("https://goo.gl/TtMsEh");*/
                //else
                //    MessageBox.Show(@"Blizzard is currently very active in the Anti-Bot fight and it may not be wise to use the bot at that very moment in time.", @"WARNING / ATTENTION / ARTUNG / внимание / 注意");
                /* End AutoStart code */
            }
            catch (Exception ex)
            {
                Logging.WriteError("MainFormOnLoad(object sender, EventArgs e): " + ex);
            }
        }