public Tesseractor(string language = "eng") { string productVersion = Application.ProductVersion; string tempPath = Utility.GetTempPath(); string text = tempPath + "tessdata"; if (!Directory.Exists(text)) { Console.WriteLine("Extracting tessdata"); Tesseractor.ExtractFiles(text); Tesseractor.CreateVersionFile(text, productVersion); } else { int num = Convert.ToInt32(productVersion.Replace(".", "")); string text2 = File.ReadAllText(text + "\\version"); int num2 = Convert.ToInt32(text2.Replace(".", "")); if (num2 < num) { Console.WriteLine("Migrating tessdata"); Tesseractor.ExtractFiles(text); Tesseractor.CreateVersionFile(text, productVersion); } } //this.Engine = new TesseractEngine(@"./tessdata", language, EngineMode.Default); this.Engine = new TesseractEngine(text, language, EngineMode.Default); }
public SevenKnightsCore(AIProfiles profile) { this.AIProfiles = profile; this.Pushbullet = new SlimPushbullet("SpD0cXpZzSFuLlNBVO6Zo2wKK0jVEkZK"); this.OneSecTimer = new System.Timers.Timer(1000.0); this.OneSecTimer.Elapsed += new ElapsedEventHandler(this.OnOneSecEvent); try { this.Tesseractor = new Tesseractor("eng"); } catch (TesseractException) { MessageBox.Show("Tesseract engine could not be initialized", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Tesseractor = null; } }