Deactivated all the OCR methods to rework them
This commit is contained in:
Generated
+1
@@ -68,6 +68,7 @@
|
|||||||
this.pbxResult.Location = new System.Drawing.Point(328, 71);
|
this.pbxResult.Location = new System.Drawing.Point(328, 71);
|
||||||
this.pbxResult.Name = "pbxResult";
|
this.pbxResult.Name = "pbxResult";
|
||||||
this.pbxResult.Size = new System.Drawing.Size(460, 249);
|
this.pbxResult.Size = new System.Drawing.Size(460, 249);
|
||||||
|
this.pbxResult.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||||
this.pbxResult.TabIndex = 3;
|
this.pbxResult.TabIndex = 3;
|
||||||
this.pbxResult.TabStop = false;
|
this.pbxResult.TabStop = false;
|
||||||
//
|
//
|
||||||
|
|||||||
+3
-3
@@ -59,9 +59,9 @@ namespace Test_Merge
|
|||||||
string configFile = "./Presets/Clean_4K_2023.json";
|
string configFile = "./Presets/Clean_4K_2023.json";
|
||||||
string gpUrl = "https://f1tv.formula1.com/detail/1000006688/2023-azerbaijan-grand-prix?action=play";
|
string gpUrl = "https://f1tv.formula1.com/detail/1000006688/2023-azerbaijan-grand-prix?action=play";
|
||||||
|
|
||||||
//Emulator = new F1TVEmulator(gpUrl);
|
Emulator = new F1TVEmulator(gpUrl);
|
||||||
//await Emulator.Start();
|
await Emulator.Start();
|
||||||
//Reader = new Reader(configFile,Emulator.Screenshot(),true);
|
Reader = new Reader(configFile,Emulator.Screenshot(),true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnUpdate_Click(object sender, EventArgs e)
|
private void btnUpdate_Click(object sender, EventArgs e)
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ namespace Test_Merge
|
|||||||
driverID++;
|
driverID++;
|
||||||
if (driverID == 9)
|
if (driverID == 9)
|
||||||
Console.WriteLine("AAAAA");
|
Console.WriteLine("AAAAA");
|
||||||
z.ZoneImage.Save("PUTAIN_DE_PILOTE_N" + driverID + ".png");
|
z.ZoneImage.Save("Driver" + driverID + ".png");
|
||||||
mainResults.Add(await z.Decode(drivers));
|
mainResults.Add(await z.Decode(drivers));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -207,9 +207,65 @@ namespace Test_Merge
|
|||||||
{
|
{
|
||||||
if (rawNumbers.Count == 1)
|
if (rawNumbers.Count == 1)
|
||||||
{
|
{
|
||||||
|
//If this code is used it means that its bad ...
|
||||||
|
//The methods that comes are really not that great and are juste quick fixes
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
result = Convert.ToInt32(rawNumbers[0]);
|
result = Convert.ToInt32(rawNumbers[0]);
|
||||||
|
|
||||||
|
switch (windowType)
|
||||||
|
{
|
||||||
|
case OcrImage.WindowType.Sector:
|
||||||
|
//The usual sector is in this form : 33.456
|
||||||
|
if (rawNumbers[0].Length == 6)
|
||||||
|
{
|
||||||
|
//The '.' has been understood like a number
|
||||||
|
result = 0;
|
||||||
|
result += Convert.ToInt32(rawNumbers[0][0] + rawNumbers[0][1]) * 1000;
|
||||||
|
result += Convert.ToInt32(rawNumbers[0][3] + rawNumbers[0][4] + rawNumbers[0][5]);
|
||||||
|
}
|
||||||
|
if (rawNumbers[0].Length == 5)
|
||||||
|
{
|
||||||
|
//The '.' has been overlooked
|
||||||
|
result = 0;
|
||||||
|
result += Convert.ToInt32(rawNumbers[0][0] + rawNumbers[0][1]) * 1000;
|
||||||
|
result += Convert.ToInt32(rawNumbers[0][2] + rawNumbers[0][3] + rawNumbers[0][4]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OcrImage.WindowType.LapTime:
|
||||||
|
//The usual Lap time is in this form : 1:45:345
|
||||||
|
result = 0;
|
||||||
|
if (rawNumbers[0].Length == 6)
|
||||||
|
{
|
||||||
|
//The '.' and ':' have been overlooked
|
||||||
|
//I Know Im skipping the cases where there are more than 9 minuts but it happens so rarely that... we dont care
|
||||||
|
result += Convert.ToInt32(rawNumbers[0][0]) * 60000;
|
||||||
|
result += Convert.ToInt32(rawNumbers[0][1] + rawNumbers[0][2]) * 1000;
|
||||||
|
result += Convert.ToInt32(rawNumbers[0][3] + rawNumbers[0][4] + rawNumbers[0][5]);
|
||||||
|
}
|
||||||
|
if (rawNumbers[0].Length == 7)
|
||||||
|
{
|
||||||
|
//There is two possibilities
|
||||||
|
//Either 1:45.140 has been interpreted as 1145.10 or 1:451140. We will assume its the first one
|
||||||
|
result += Convert.ToInt32(rawNumbers[0][0]) * 60000;
|
||||||
|
result += Convert.ToInt32(rawNumbers[0][2] + rawNumbers[0][3]) * 1000;
|
||||||
|
result += Convert.ToInt32(rawNumbers[0][4] + rawNumbers[0][5] + rawNumbers[0][6]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OcrImage.WindowType.Gap:
|
||||||
|
//The usual Gap is in this form : + 34.567
|
||||||
|
if (rawNumbers[0].Length == 5)
|
||||||
|
{
|
||||||
|
//The '.' has been overlooked
|
||||||
|
result += Convert.ToInt32(rawNumbers[0][0] + rawNumbers[0][1]) * 1000;
|
||||||
|
result += Convert.ToInt32(rawNumbers[0][2] + rawNumbers[0][3] + rawNumbers[0][4]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (rawNumbers[0].Length > 6)
|
||||||
|
{
|
||||||
|
//The number definitely has been interpreted wrong
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|||||||
+18
-9
@@ -94,27 +94,36 @@ namespace Test_Merge
|
|||||||
{
|
{
|
||||||
// A switch would be prettier but I dont think its supported in this C# version
|
// A switch would be prettier but I dont think its supported in this C# version
|
||||||
if (w is DriverNameWindow)
|
if (w is DriverNameWindow)
|
||||||
result.Name = (string)await (w as DriverNameWindow).DecodePng(driverList);
|
//result.Name = (string)await (w as DriverNameWindow).DecodePng(driverList);
|
||||||
|
result.Name = "Unknown";
|
||||||
if (w is DriverDrsWindow)
|
if (w is DriverDrsWindow)
|
||||||
result.DRS = (bool)await (w as DriverDrsWindow).DecodePng();
|
//result.DRS = (bool)await (w as DriverDrsWindow).DecodePng();
|
||||||
|
result.DRS = false;
|
||||||
if (w is DriverGapToLeaderWindow)
|
if (w is DriverGapToLeaderWindow)
|
||||||
result.GapToLeader = (int)await (w as DriverGapToLeaderWindow).DecodePng();
|
//result.GapToLeader = (int)await (w as DriverGapToLeaderWindow).DecodePng();
|
||||||
|
result.GapToLeader = 0;
|
||||||
if (w is DriverLapTimeWindow)
|
if (w is DriverLapTimeWindow)
|
||||||
result.LapTime = (int)await (w as DriverLapTimeWindow).DecodePng();
|
//result.LapTime = (int)await (w as DriverLapTimeWindow).DecodePng();
|
||||||
|
result.LapTime = 0;
|
||||||
if (w is DriverPositionWindow)
|
if (w is DriverPositionWindow)
|
||||||
result.Position = (int)await (w as DriverPositionWindow).DecodePng();
|
//result.Position = (int)await (w as DriverPositionWindow).DecodePng();
|
||||||
|
result.Position = 0;
|
||||||
if (w is DriverSectorWindow)
|
if (w is DriverSectorWindow)
|
||||||
{
|
{
|
||||||
sectorCount++;
|
sectorCount++;
|
||||||
if (sectorCount == 1)
|
if (sectorCount == 1)
|
||||||
result.Sector1 = (int)await (w as DriverSectorWindow).DecodePng();
|
//result.Sector1 = (int)await (w as DriverSectorWindow).DecodePng();
|
||||||
|
result.Sector1 = 0;
|
||||||
if (sectorCount == 2)
|
if (sectorCount == 2)
|
||||||
result.Sector2 = (int)await (w as DriverSectorWindow).DecodePng();
|
//result.Sector2 = (int)await (w as DriverSectorWindow).DecodePng();
|
||||||
|
result.Sector2 = 0;
|
||||||
if (sectorCount == 3)
|
if (sectorCount == 3)
|
||||||
result.Sector3 = (int)await (w as DriverSectorWindow).DecodePng();
|
//result.Sector3 = (int)await (w as DriverSectorWindow).DecodePng();
|
||||||
|
result.Sector3 = 0;
|
||||||
}
|
}
|
||||||
if (w is DriverTyresWindow)
|
if (w is DriverTyresWindow)
|
||||||
result.CurrentTyre = (Tyre)await (w as DriverTyresWindow).DecodePng();
|
//result.CurrentTyre = (Tyre)await (w as DriverTyresWindow).DecodePng();
|
||||||
|
result.CurrentTyre = new Tyre(Tyre.Type.Undefined,0);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user