Now the images are correctly loaded but the OCR is still Fucked
This commit is contained in:
Generated
+14
-1
@@ -31,6 +31,8 @@
|
||||
this.btnSettings = new System.Windows.Forms.Button();
|
||||
this.tbxResult = new System.Windows.Forms.TextBox();
|
||||
this.btnUpdate = new System.Windows.Forms.Button();
|
||||
this.pbxResult = new System.Windows.Forms.PictureBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbxResult)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btnSettings
|
||||
@@ -61,17 +63,27 @@
|
||||
this.btnUpdate.UseVisualStyleBackColor = true;
|
||||
this.btnUpdate.Click += new System.EventHandler(this.btnUpdate_Click);
|
||||
//
|
||||
// pbxResult
|
||||
//
|
||||
this.pbxResult.Location = new System.Drawing.Point(328, 71);
|
||||
this.pbxResult.Name = "pbxResult";
|
||||
this.pbxResult.Size = new System.Drawing.Size(460, 249);
|
||||
this.pbxResult.TabIndex = 3;
|
||||
this.pbxResult.TabStop = false;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.ClientSize = new System.Drawing.Size(800, 335);
|
||||
this.Controls.Add(this.pbxResult);
|
||||
this.Controls.Add(this.btnUpdate);
|
||||
this.Controls.Add(this.tbxResult);
|
||||
this.Controls.Add(this.btnSettings);
|
||||
this.Name = "Form1";
|
||||
this.Text = "Form1";
|
||||
this.Load += new System.EventHandler(this.Form1_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbxResult)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@@ -82,6 +94,7 @@
|
||||
private System.Windows.Forms.Button btnSettings;
|
||||
private System.Windows.Forms.TextBox tbxResult;
|
||||
private System.Windows.Forms.Button btnUpdate;
|
||||
private System.Windows.Forms.PictureBox pbxResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+22
-3
@@ -22,22 +22,41 @@ namespace Test_Merge
|
||||
{
|
||||
if(Emulator != null && Reader != null)
|
||||
{
|
||||
btnSettings.Enabled = false;
|
||||
btnUpdate.Enabled = false;
|
||||
|
||||
Bitmap screen = Emulator.Screenshot();
|
||||
screen.Save("SCREEEEEEEEN.png");
|
||||
Reader.ChangeImage(screen);
|
||||
pbxResult.Image = screen;
|
||||
tbxResult.Text = await Reader.Decode(Reader.MainZones,Reader.Drivers);
|
||||
|
||||
btnSettings.Enabled = true;
|
||||
btnUpdate.Enabled = true;
|
||||
}
|
||||
}
|
||||
private void btnSettings_Click(object sender, EventArgs e)
|
||||
private async void btnSettings_Click(object sender, EventArgs e)
|
||||
{
|
||||
Settings settingsForm = new Settings();
|
||||
settingsForm.ShowDialog();
|
||||
MessageBox.Show(settingsForm.GrandPrixUrl + Environment.NewLine + settingsForm.GrandPrixName + Environment.NewLine + settingsForm.GrandPrixYear);
|
||||
//MessageBox.Show(settingsForm.GrandPrixUrl + Environment.NewLine + settingsForm.GrandPrixName + Environment.NewLine + settingsForm.GrandPrixYear);
|
||||
Emulator = new F1TVEmulator(settingsForm.GrandPrixUrl);
|
||||
try
|
||||
{
|
||||
await Emulator.Start();
|
||||
Reader = new Reader(settingsForm.SelectedConfigFile,Emulator.Screenshot(),true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//Could not start the driver even with the new config
|
||||
MessageBox.Show("The config is wrong or incomplete please try again");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private async void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
string configFile = "./Presets/Clean_2023.json";
|
||||
string configFile = "./Presets/Clean_4K_2023.json";
|
||||
string gpUrl = "https://f1tv.formula1.com/detail/1000006688/2023-azerbaijan-grand-prix?action=play";
|
||||
|
||||
//Emulator = new F1TVEmulator(gpUrl);
|
||||
|
||||
+16
-8
@@ -166,17 +166,25 @@ namespace Test_Merge
|
||||
if (windowType == OcrImage.WindowType.LapTime)
|
||||
{
|
||||
result = 0;
|
||||
if (rawNumbers[0].Length == 4)
|
||||
try
|
||||
{
|
||||
result += Convert.ToInt32(rawNumbers[0][0]) * 60000;
|
||||
result += Convert.ToInt32(rawNumbers[0][2].ToString() + rawNumbers[0][3].ToString()) * 1000;
|
||||
result += Convert.ToInt32(rawNumbers[1]);
|
||||
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;
|
||||
}
|
||||
}
|
||||
else
|
||||
catch
|
||||
{
|
||||
//Fuck it
|
||||
result = 0;
|
||||
}
|
||||
//A lap time is fucked
|
||||
Console.Write("Fuck");
|
||||
}
|
||||
}
|
||||
if (windowType == OcrImage.WindowType.Sector)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user