private void button2_Click(object sender, EventArgs e) { if (File.Exists("OCR.png")) { var img = BotCore.Compress(Image.FromFile("OCR.png") as Bitmap); MessageBox.Show(OCR.OcrImage(img, "eng")); } }
private void MainScreen_Load(object sender, EventArgs e) { Thread load = new Thread(Loading); load.SetApartmentState(ApartmentState.STA); load.Start(); if (!IsRunAsAdministrator()) { var processInfo = new ProcessStartInfo(Assembly.GetExecutingAssembly().CodeBase) { // The following properties run the new process as administrator UseShellExecute = true, Verb = "runas" }; // Start the new process try { Process.Start(processInfo); } catch (Exception) { // The user did not allow the application to run as administrator MessageBox.Show("挂机需要权限才能运行!"); } // Shut down the current process Application.Exit(); } CheckVersion.CheckUpdate(); if (!Directory.Exists("Img")) { File.WriteAllBytes("Img.zip", Img.Images); ZipFile.ExtractToDirectory("Img.zip", Environment.CurrentDirectory); File.Delete("Img.zip"); } comboBox1.Items.Clear(); OCR.PrepairOcr(whitelist: "$0123456789", blacklist: "!?@#$%&*()<>_-+=/:;'\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"); Variables.EmulatorPath(); if (File.Exists("bot.ini")) { if (File.Exists(Environment.CurrentDirectory + "\\Profiles\\" + BotCore.profilePath + "\\bot.ini")) { File.Delete(Environment.CurrentDirectory + "\\Profiles\\" + BotCore.profilePath + "\\bot.ini"); } try { File.Copy("bot.ini", Environment.CurrentDirectory + "\\Profiles\\" + BotCore.profilePath + "\\bot.ini", true); File.Delete("bot.ini"); } catch { } } Variables.ReadConfig(); string _NET = Get45PlusFromRegistry(); if (!Directory.Exists("Language")) { MessageBox.Show("Lost files, please reinstall the bot!"); Environment.Exit(0); } foreach (var lang in Directory.GetFiles("Language")) { comboBox1.Items.Add(lang.Replace("Language\\", "").Replace(".ini", "")); } if (Variables.FindConfig("General", "Lang", out string output)) { int index = comboBox1.Items.IndexOf(output); if (index < 0) { comboBox1.SelectedIndex = 0; } else { comboBox1.SelectedIndex = index; } } else { comboBox1.SelectedIndex = 0; } label3.Text = Variables.VBoxManagerPath; label4.Text = Variables.SharedPath; if (Variables.FindConfig("General", "Level", out output)) { switch (output) { case "0": chk_begin.Checked = true; break; case "1": chk_inter.Checked = true; break; case "2": chk_advan.Checked = true; break; case "3": chk_extre.Checked = true; break; case "4": chk_ultim.Checked = true; break; } } else { Variables.ModifyConfig("General", "Level", "0"); } if (Variables.FindConfig("General", "Double_Event", out output)) { if (output == "true") { chk_twoE.Checked = true; } } if (Variables.FindConfig("General", "Manual_Rune", out output)) { if (output == "true") { chk_manuRT.Checked = true; } } if (Variables.FindConfig("General", "Suspend_PC", out output)) { if (output == "true") { Suspend_Chk.Checked = true; } } if (Variables.FindConfig("General", "biubiu", out output)) { if (output == "true") { Biubiu.Checked = true; } } if (Variables.FindConfig("General", "ArWiEv", out output)) { if (output == "true") { Chk_Archwitch.Checked = true; } } if (Variables.FindConfig("General", "SoWeEv", out output)) { if (output == "true") { Chk_SoulWeapon.Checked = true; } } if (Variables.FindConfig("General", "ArWiSt", out output)) { string temp = output.Replace(".", "-"); Combo_Archwitch.SelectedItem = temp; } else { Combo_Archwitch.SelectedIndex = 0; } if (Variables.FindConfig("General", "SoWeSt", out output)) { string temp = output.Replace(".", "-"); Combo_Weapon.SelectedItem = temp; } else { Combo_Weapon.SelectedIndex = 0; } if (Variables.ForceWinApiCapt) { WinAPi.Checked = true; WinAPi.Enabled = false; } else { if (Variables.FindConfig("General", "WinApi", out output)) { if (output == "true") { WinAPi.Checked = true; } } } if (Variables.FindConfig("GuildWar", "Manual", out output)) { if (output == "true") { chk_GWW.Checked = true; } } if (Variables.FindConfig("Version", "Version", out output)) { if (output != CheckVersion.currentVersion) { CheckVersion.UpdateText = "# Thanks for supporting VCBot! \n" + CheckVersion.BufferUpdateText; Variables.ModifyConfig("Version", "Version", CheckVersion.currentVersion); } } else { CheckVersion.UpdateText = "# Thanks for supporting VCBot! \n" + CheckVersion.BufferUpdateText; Variables.ModifyConfig("Version", "Version", CheckVersion.currentVersion); } webBrowser1.ScriptErrorsSuppressed = true; webBrowser3.ScriptErrorsSuppressed = true; PrivateVariable.nospam = DateTime.Now; string ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36"; DllImport.UrlMkSetSessionOption(DllImport.URLMON_OPTION_USERAGENT, ua, ua.Length, 0); webBrowser3.Navigating += OnNavigating; webBrowser3.Navigated += WebBrowser3_Navigated; GetEventXML.LoadXMLEvent(); webBrowser3.Navigate(new Uri("http://www-valkyriecrusade.nubee.com/" + GetEventXML.Eventlink.Replace("/en/", "/" + comboBox1.SelectedItem.ToString() + "/") + ".html")); VCBotScript.Read_Plugins(); foreach (var s in PrivateVariable.BattleScript) { tabControl2.TabPages.Add(s.ScriptName()); tabControl2.TabPages[tabControl2.TabPages.Count - 1].BackColor = Color.Black; tabControl2.TabPages[tabControl2.TabPages.Count - 1].ForeColor = Color.White; CheckBox chk = new CheckBox { Text = "使用脚本", Checked = false }; chk.CheckedChanged += Chk_CheckedChanged; chk.Location = new Point(10, 250); chk.AutoSize = true; tabControl2.TabPages[tabControl2.TabPages.Count - 1].Controls.Add(chk); customScriptEnable.Add(chk); foreach (var c in s.CreateUI()) { tabControl2.TabPages[tabControl2.TabPages.Count - 1].Controls.Add(c); } } if (Variables.FindConfig("General", "Selected_Script", out string n)) { try { int i = Convert.ToInt32(n); if (i > customScriptEnable.Count) { i = 0; } customScriptEnable[i].Checked = true; } catch { customScriptEnable[0].Checked = true; } } else { customScriptEnable[0].Checked = true; } if (GetEventXML.RandomImage != null) { var request = WebRequest.Create("http://www-valkyriecrusade.nubee.com/" + GetEventXML.RandomImage); using (var response = request.GetResponse()) using (var stream = response.GetResponseStream()) { pictureBox4.Image = Image.FromStream(stream); } } foreach (Control box in ED_Box.Controls) { foreach (Control control in box.Controls) { control.MouseDown += Tp_MouseDown; } box.MouseDown += Tp_MouseDown; } ED_Box.MouseDown += Tp_MouseDown; metroTabControl1.SelectedIndex = 0; chk_item.Enabled = chk_autoRT.Checked; Login.LoadCompleted = true; PrivateVariable.VCevent = PrivateVariable.EventType.Unknown; timer2.Start(); }