Now the OCR applies and only crashes sometimes. But its complete trash and the images cant change for whatever reason

This commit is contained in:
2023-05-10 16:00:01 +02:00
parent df9231aed6
commit 2c1340780e
7 changed files with 138 additions and 18 deletions
+31 -8
View File
@@ -161,15 +161,38 @@ namespace Test_Merge
//ss:ms
result = (Convert.ToInt32(rawNumbers[0]) * 1000) + Convert.ToInt32(rawNumbers[1]);
if (result > 999999)
if (result > (60000 + 999))
{
//We know that we have way too much seconds to make a minut
//Its usually because the ":" have been interpreted as a number
int minuts = (int)(rawNumbers[0][0] - '0');
// rawNumbers[0][1] should contain the : that has been mistaken
int seconds = Convert.ToInt32(rawNumbers[0][2].ToString() + rawNumbers[0][3].ToString());
int ms = Convert.ToInt32(rawNumbers[1]);
result = (Convert.ToInt32(minuts) * 1000 * 60) + (Convert.ToInt32(seconds) * 1000) + Convert.ToInt32(ms);
if (windowType == OcrImage.WindowType.LapTime)
{
result = 0;
if (rawNumbers[0].Length == 4)
{
result += Convert.ToInt32(rawNumbers[0][0]) * 60000;
result += Convert.ToInt32(rawNumbers[0][2].ToString() + rawNumbers[0][3].ToString()) * 1000;
result += Convert.ToInt32(rawNumbers[1]);
}
else
{
//Fuck it
result = 0;
}
}
if (windowType == OcrImage.WindowType.Sector)
{
int seconds = 0;
if (rawNumbers[0].Length == 3)
{
//We have one char that we need to delete
//For no apparent reason im going to delete the first
seconds = Convert.ToInt32(rawNumbers[0][1].ToString() + rawNumbers[0][2].ToString());
}
if (rawNumbers[0].Length == 2) {
seconds = Convert.ToInt32(rawNumbers[0][0].ToString() + rawNumbers[0][1].ToString());
}
int ms = Convert.ToInt32(rawNumbers[1][0].ToString() + rawNumbers[1][1].ToString() + rawNumbers[1][2].ToString());
result = seconds * 1000 + ms;
}
}
}
else