/// <summary>
/// Used to initialize the routine asynchronously
/// </summary>
/// <param name="languageId">Language ID</param>
/// <returns>IEnumerator</returns>
private IEnumerator InitializeRoutine(string languageId)
{
// Copies all tess data to persistent directory
yield return CoroutineRunner.RunCoroutine(InitializeTessdataRoutine());
string[] languageSplit = languageId.Split('+');
// Check whether we have stored the correct tesseract language data
for(int i = 0; i < languageSplit.Length; i++)
{
if(!m_AvailableDataSet.Contains(languageSplit[i]))
{
Debug.LogWarning(string.Format("Tesseract language id is not available. Please check your settings for the correct data import. [{0}]", languageSplit[i]));
}
}
if(m_Handle != IntPtr.Zero)
{
// Perform initialization from the native library
if(TesseractOCRBridge.Initialize(m_Handle, GetTessdataPersistentPath(), languageId) == 0)
{
// Copies the configuration file to persistent directory and sets the config file to use
yield return CoroutineRunner.RunCoroutine(InitializeConfigFileRoutine(true));
Debug.Log("Initialize TesseractOCR Success!");
}
else
{
Debug.Log("Initialize TesseractOCR Failed!");
}
}
}