mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
Trying to make nOCR work better with corrupted files - thx k7Up :)
This commit is contained in:
parent
6f64d3f373
commit
bec59649e2
@ -97,6 +97,10 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
|
||||
stream.Read(buffer, 0, buffer.Length);
|
||||
Text = System.Text.Encoding.UTF8.GetString(buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
Text = string.Empty;
|
||||
}
|
||||
|
||||
if (isShort)
|
||||
{
|
||||
@ -109,9 +113,16 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
|
||||
LinesBackground = ReadPoints(stream);
|
||||
}
|
||||
|
||||
if (Width >= 0 && Height >= 0 && Width <= 1920 && Height <= 1080 && Text.IndexOf('\0') < 0)
|
||||
{
|
||||
LoadedOk = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadedOk = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var buffer = new byte[9];
|
||||
int read = stream.Read(buffer, 0, buffer.Length);
|
||||
@ -137,11 +148,23 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
|
||||
stream.Read(buffer, 0, buffer.Length);
|
||||
Text = System.Text.Encoding.UTF8.GetString(buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
Text = string.Empty;
|
||||
}
|
||||
|
||||
LinesForeground = ReadPoints(stream);
|
||||
LinesBackground = ReadPoints(stream);
|
||||
|
||||
if (Width >= 0 && Height >= 0 && Width <= 1920 && Height <= 1080 && Text.IndexOf('\0') < 0)
|
||||
{
|
||||
LoadedOk = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadedOk = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user