private void btnStartBot_Click(object sender, EventArgs e) { try { AwakeningRoutines awakeRoutine = new AwakeningRoutines(this, ItemPosition, AwakeScrollPosition, ReversionPosition, InventoryRectangle, AwakeTypes); if (awakeRoutine.IsStopped()) { if (ItemPosition == Point.Empty || AwakeScrollPosition == Point.Empty || ReversionPosition == Point.Empty) { GeneralUtils.DisplayError("Set all of the item and scroll positions before starting the bot!"); return; } else if (cbConfigs.SelectedIndex == -1) { GeneralUtils.DisplayError("Select a server config before starting the bot!"); return; } else if (lviAwakes.Items.Count <= 0) { GeneralUtils.DisplayError("You need atleast one awake added!"); return; } } awakeRoutine.ToggleBotStatus(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public AwakeningResolver(ServerConfigManager configManager, AwakeningRoutines awakeRoutines) { ConfigManager = configManager; AwakeRoutines = awakeRoutines; // Write the eng.user-words /* * string dictionary = ""; * * foreach (var awake in configManager.AwakeTypes) * { * dictionary += awake.Text + "\n"; * } * * using (StreamWriter sw = new StreamWriter("tessdata\\eng.user-words")) * { * sw.Write(dictionary); * } */ try { string characters = ""; foreach (char c in ConfigManager.WhitelistedCharacters) { characters += c; } var initVars = new Dictionary <string, object>() { { "load_system_dawg", false }, { "load_freq_dawg", false }, // { "user_words_suffix", "user-words" }, // Load custom dictionary from eng.user-words { "tessedit_char_whitelist", "+-%0123456789 " + characters }, }; TessEngine = new TesseractEngine("tessdata", ConfigManager.Language, EngineMode.Default, Enumerable.Empty <string>(), initVars, false) { DefaultPageSegMode = PageSegMode.SingleBlock }; } catch (Exception ex) { GeneralUtils.DisplayError(ex.ToString()); Application.Exit(); } }
public AwakeningResolver(ServerConfigManager configManager, AwakeningRoutines awakeRoutines) { ConfigManager = configManager; AwakeRoutines = awakeRoutines; try { TessEngine = new TesseractEngine("tessdata", ConfigManager.Language); string characters = ""; foreach (char c in ConfigManager.WhitelistedCharacters) { characters += c; } TessEngine.SetVariable("tessedit_char_whitelist", "+-%0123456789 " + characters); TessEngine.DefaultPageSegMode = PageSegMode.SingleBlock; } catch (Exception ex) { GeneralUtils.DisplayError(ex.ToString()); Application.Exit(); } }