Пример #1
0
        public void Run()
        {
            if (reportUnknownChar)
            {
                // If we find a character that we can't scan, we should report this to the UI thread so it can ask the user for an identification
                for (int i = startingSubtitle; i < nSubtitles; i++)
                {
                    if (AppOptions.forcedOnly && !parentForm.IsSubtitleForced(i))
                    {
                        continue;
                    }

                    if (stopEvent.WaitOne(0, true))
                    {
                        break;
                    }

                    try
                    {
                        parentForm.ImageOCR(i, true);
                        parentForm.Invoke(parentForm.updateProgressDelegate, new Object[] { i });
                    }
                    catch (UnknownCharacterException)
                    {
                        foundNum = i;
                        break;
                    }
                }
            }
            else
            {
                // Just scan the whole movie, leaving unidentifiable characters alone
                for (int i = 0; i < nSubtitles; i++)
                {
                    if (AppOptions.forcedOnly && !parentForm.IsSubtitleForced(i))
                    {
                        continue;
                    }

                    if (stopEvent.WaitOne(0, true))
                    {
                        break;
                    }

                    parentForm.ImageOCR(i, false);
                    parentForm.Invoke(parentForm.updateProgressDelegate, new Object[] { i });
                }
            }

            finishedEvent.Set();
        }
Пример #2
0
        public void Run()
        {
            for (int i = 0; i < nSubtitles; i++)
            {
                if (stopEvent.WaitOne(0, true))
                {
                    break;
                }

                parentForm.ImageOCR(i, false);
                parentForm.Invoke(parentForm.updateProgressDelegate, new Object[] { i * 100 / nSubtitles });
            }

            finishedEvent.Set();
        }