Updated the code to show on the documentation

This commit is contained in:
2023-06-08 14:30:18 +02:00
parent ac5641125a
commit a7c6ad610c
18 changed files with 321 additions and 619 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
/// Author : Maxime Rohmer /// Author : Maxime Rohmer
/// Date : 30/05/2023 /// Date : 09/06/2023
/// File : DataWrapper.cs /// File : DataWrapper.cs
/// Brief : Class that is used to interface between the main Form (vue) and the Storage (wich is a class that wraps the sqlite database, so the model) its almost MVC :D /// Brief : Class that is used to interface between the main Form (vue) and the Storage (wich is a class that wraps the sqlite database, so the model) its almost MVC :D
/// Version : Alpha 1.0 /// Version : Beta 1.0
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
+2 -2
View File
@@ -1,8 +1,8 @@
/// Author : Maxime Rohmer /// Author : Maxime Rohmer
/// Date : 30/05/2023 /// Date : 09/06/2023
/// File : DriverData.cs /// File : DriverData.cs
/// Brief : File containing classes that behave just like structures to store data about drivers /// Brief : File containing classes that behave just like structures to store data about drivers
/// Version : Alpha 1.0 /// Version : Beta 1.0
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
+2 -2
View File
@@ -1,8 +1,8 @@
/// Author : Maxime Rohmer /// Author : Maxime Rohmer
/// Date : 30/05/2023 /// Date : 09/06/2023
/// File : DriverDrsWindow.cs /// File : DriverDrsWindow.cs
/// Brief : Window containing DRS related method and infos /// Brief : Window containing DRS related method and infos
/// Version : Alpha 1.0 /// Version : Beta 1.0
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
+2 -2
View File
@@ -1,8 +1,8 @@
/// Author : Maxime Rohmer /// Author : Maxime Rohmer
/// Date : 30/05/2023 /// Date : 09/06/2023
/// File : DriverLapTimeWindow /// File : DriverLapTimeWindow
/// Brief : Window containing infos about the lap time of a driver /// Brief : Window containing infos about the lap time of a driver
/// Version : Alpha 1.0 /// Version : Beta 1.0
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
+2 -2
View File
@@ -1,8 +1,8 @@
/// Author : Maxime Rohmer /// Author : Maxime Rohmer
/// Date : 30/05/2023 /// Date : 09/06/2023
/// File : DriverNameWindow /// File : DriverNameWindow
/// Brief : Window containing infos about the name of the driver /// Brief : Window containing infos about the name of the driver
/// Version : Alpha 1.0 /// Version : Beta 1.0
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
+2 -2
View File
@@ -1,8 +1,8 @@
/// Author : Maxime Rohmer /// Author : Maxime Rohmer
/// Date : 30/05/2023 /// Date : 09/06/2023
/// File : DriverPositionWindow.cs /// File : DriverPositionWindow.cs
/// Brief : Window containing infos about the position of a driver. /// Brief : Window containing infos about the position of a driver.
/// Version : Alpha 1.0 /// Version : Beta 1.0
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
+2 -2
View File
@@ -1,8 +1,8 @@
/// Author : Maxime Rohmer /// Author : Maxime Rohmer
/// Date : 30/05/2023 /// Date : 09/06/2023
/// File : DriverSectorWindow.cs /// File : DriverSectorWindow.cs
/// Brief : Window containing infos about a driver sector time. Can be the first second or third, does not matter. /// Brief : Window containing infos about a driver sector time. Can be the first second or third, does not matter.
/// Version : Alpha 1.0 /// Version : Beta 1.0
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
+2 -2
View File
@@ -1,8 +1,8 @@
/// Author : Maxime Rohmer /// Author : Maxime Rohmer
/// Date : 30/05/2023 /// Date : 09/06/2023
/// File : DriverTyresWindow.cs /// File : DriverTyresWindow.cs
/// Brief : Window containing infos about a driver's tyre /// Brief : Window containing infos about a driver's tyre
/// Version : Alpha 1.0 /// Version : Beta 1.0
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
+14 -2
View File
@@ -1,8 +1,8 @@
/// Author : Maxime Rohmer /// Author : Maxime Rohmer
/// Date : 30/05/2023 /// Date : 09/06/2023
/// File : F1TVEmulator.cs /// File : F1TVEmulator.cs
/// Brief : Class that contains methods to emulate a browser and navigate the F1TV website /// Brief : Class that contains methods to emulate a browser and navigate the F1TV website
/// Version : Alpha 1.0 /// Version : Beta 1.0
using OpenQA.Selenium; using OpenQA.Selenium;
using OpenQA.Selenium.Firefox; using OpenQA.Selenium.Firefox;
@@ -187,6 +187,18 @@ namespace TrackTrends
return 104; return 104;
} }
try
{
IWebElement LiveButton = Driver.FindElement(By.ClassName("btn-manage-account"));
//By.ClassName("btn btn-controls btn-main btn-manage-account no-redirect")
LiveButton.Click();
}
catch
{
Console.Write("Going for a rediff");
}
//Again waits for the page to fully load (when you accept cookies it takes a little time for the page to load) //Again waits for the page to fully load (when you accept cookies it takes a little time for the page to load)
//Cannot use The timeout because the feed loading is not really loading so there is not event or anything //Cannot use The timeout because the feed loading is not really loading so there is not event or anything
Thread.Sleep(5000); Thread.Sleep(5000);
+90 -8
View File
@@ -1,4 +1,10 @@
using System; /// Author : Maxime Rohmer
/// Date : 09/06/2023
/// File : Form1.cs
/// Brief : Class that controls the main view of the app
/// Version : Beta 1.0
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
@@ -15,7 +21,6 @@ namespace TrackTrends
{ {
public partial class Main : Form public partial class Main : Form
{ {
//private Reader Reader = null;
private F1TVEmulator Emulator = null; private F1TVEmulator Emulator = null;
private DataWrapper Wrapper = null; private DataWrapper Wrapper = null;
private bool cancelRequested = false; private bool cancelRequested = false;
@@ -47,7 +52,10 @@ namespace TrackTrends
{ {
InitializeComponent(); InitializeComponent();
} }
public async void RefreshUI() /// <summary>
/// Will update everything that is not data related
/// </summary>
public void RefreshUI()
{ {
if (Directory.Exists(ConfigurationTool.CONFIGS_FOLDER_NAME)) if (Directory.Exists(ConfigurationTool.CONFIGS_FOLDER_NAME))
{ {
@@ -55,7 +63,12 @@ namespace TrackTrends
lsbPresets.DataSource = Directory.GetFiles(ConfigurationTool.CONFIGS_FOLDER_NAME); lsbPresets.DataSource = Directory.GetFiles(ConfigurationTool.CONFIGS_FOLDER_NAME);
} }
} }
private async void btnSettings_Click(object sender, EventArgs e) /// <summary>
/// Opens the settings page. Also disposes of the browser if there is one opened and all thos things
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnSettings_Click(object sender, EventArgs e)
{ {
if (Emulator != null) if (Emulator != null)
Emulator.ResetDriver(); Emulator.ResetDriver();
@@ -88,6 +101,7 @@ namespace TrackTrends
} }
else else
{ {
//Should technically never show up but we never know
MessageBox.Show("The config file has not been found please return to the config and change it"); MessageBox.Show("The config file has not been found please return to the config and change it");
} }
} }
@@ -97,7 +111,11 @@ namespace TrackTrends
//MessageBox.Show("There is no URL for the Grand Prix you want to decode. Please return to the config and add a valid one"); //MessageBox.Show("There is no URL for the Grand Prix you want to decode. Please return to the config and add a valid one");
} }
} }
/// <summary>
/// Will do everything that needs to be done at the first start of the app
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private async void Form1_Load(object sender, EventArgs e) private async void Form1_Load(object sender, EventArgs e)
{ {
//Those are the default values but they will need to be changed later when the configuration has been done //Those are the default values but they will need to be changed later when the configuration has been done
@@ -106,6 +124,8 @@ namespace TrackTrends
tbxGpUrl.Text = GpUrl; tbxGpUrl.Text = GpUrl;
this.DoubleBuffered = true;
oldSize = this.Size; oldSize = this.Size;
oldRankingSize = gpbxRanking.Size; oldRankingSize = gpbxRanking.Size;
oldLapTimesSize = gpbxLapTimes.Size; oldLapTimesSize = gpbxLapTimes.Size;
@@ -134,7 +154,11 @@ namespace TrackTrends
RefreshUI(); RefreshUI();
} }
/// <summary>
/// Will start or stop the process of decoding
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private async void btnUpdate_Click(object sender, EventArgs e) private async void btnUpdate_Click(object sender, EventArgs e)
{ {
cancelRequested = false; cancelRequested = false;
@@ -192,18 +216,32 @@ namespace TrackTrends
btnSettings.Enabled = true; btnSettings.Enabled = true;
} }
} }
/// <summary>
/// Will display the overtakes in the overtakes list box
/// </summary>
private void DisplayOvertakes() private void DisplayOvertakes()
{ {
Wrapper.DisplayOvertakes(lsbOvertakes); Wrapper.DisplayOvertakes(lsbOvertakes);
} }
/// <summary>
/// Will display the battles in the battles pannel
/// </summary>
private void DisplayBattles() private void DisplayBattles()
{ {
Wrapper.DisplayBattles(pnlBattles, this); Wrapper.DisplayBattles(pnlBattles, this);
} }
/// <summary>
/// Will display the time differences in the faster and slowest pannels
/// </summary>
private void DisplayDeltas() private void DisplayDeltas()
{ {
Wrapper.DisplayTimesDeltas(pnlFastest, pnlSlowest, this); Wrapper.DisplayTimesDeltas(pnlFastest, pnlSlowest, this);
} }
/// <summary>
/// Will try to stop the emulator (usually does not work please do not count on it)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Form1_FormClosing(object sender, FormClosingEventArgs e) private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{ {
if (Emulator != null) if (Emulator != null)
@@ -211,6 +249,12 @@ namespace TrackTrends
Emulator.Stop(); Emulator.Stop();
} }
} }
/// <summary>
/// Will display the live ranking on the live ranking pannel. Its called like this because historically it was the method that just recovered the bare results from the OCR
/// </summary>
/// <param name="errorCode"></param>
/// <param name="sw"></param>
/// <param name="screen"></param>
private void DisplayResults(int errorCode, Stopwatch sw, Bitmap screen) private void DisplayResults(int errorCode, Stopwatch sw, Bitmap screen)
{ {
if (errorCode != 0) if (errorCode != 0)
@@ -224,6 +268,11 @@ namespace TrackTrends
} }
} }
/// <summary>
/// Will stop the data recovering operation and resets some buttons and text
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnStopUpdating_Click(object sender, EventArgs e) private void btnStopUpdating_Click(object sender, EventArgs e)
{ {
// Set the cancellation flag // Set the cancellation flag
@@ -232,6 +281,11 @@ namespace TrackTrends
btnResetEmulator.Enabled = false; btnResetEmulator.Enabled = false;
btnStopUpdating.Text = "Stopping"; btnStopUpdating.Text = "Stopping";
} }
/// <summary>
/// Will start the F1TVEmulator, again this name is historical because back at the start of this project this button did not have a name
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private async void button1_Click(object sender, EventArgs e) private async void button1_Click(object sender, EventArgs e)
{ {
lsbOvertakes.Items.Clear(); lsbOvertakes.Items.Clear();
@@ -301,6 +355,11 @@ namespace TrackTrends
btnStartDecoding.Enabled = true; btnStartDecoding.Enabled = true;
} }
} }
/// <summary>
/// Silly way to remove borders from groupbox and make them look like pannels with titles
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void removeBorders(object sender, PaintEventArgs e) private void removeBorders(object sender, PaintEventArgs e)
{ {
GroupBox gpbx = (GroupBox)sender; GroupBox gpbx = (GroupBox)sender;
@@ -317,17 +376,31 @@ namespace TrackTrends
e.Graphics.DrawString(gpbx.Text, gpbx.Font, brush, textPosition); e.Graphics.DrawString(gpbx.Text, gpbx.Font, brush, textPosition);
} }
} }
/// <summary>
/// Will change the preset to use when starting the emulator
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void lsbPresets_SelectedIndexChanged(object sender, EventArgs e) private void lsbPresets_SelectedIndexChanged(object sender, EventArgs e)
{ {
if (lsbPresets.SelectedIndex >= 0) if (lsbPresets.SelectedIndex >= 0)
ConfigFile = lsbPresets.Items[lsbPresets.SelectedIndex].ToString(); ConfigFile = lsbPresets.Items[lsbPresets.SelectedIndex].ToString();
} }
/// <summary>
/// Will change the URL the emulator will use, historical name again
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void textBox1_TextChanged(object sender, EventArgs e) private void textBox1_TextChanged(object sender, EventArgs e)
{ {
if (tbxGpUrl.Text != "") if (tbxGpUrl.Text != "")
GpUrl = tbxGpUrl.Text; GpUrl = tbxGpUrl.Text;
} }
/// <summary>
/// This is called by the automatically generated buttons. Its here to fill in the driver info tab whenever the user clicks on a button that contains the name of a driver
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void btnDriver_Click(object sender, EventArgs e) public void btnDriver_Click(object sender, EventArgs e)
{ {
//Removes the cover //Removes the cover
@@ -381,6 +454,11 @@ namespace TrackTrends
break; break;
} }
} }
/// <summary>
/// This is supposed to be called by an automatically generated button. It should be any button with a laptime info on it
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void btnLapTime_Click(object sender, EventArgs e) public void btnLapTime_Click(object sender, EventArgs e)
{ {
//Happens when a lapTime has been clicked //Happens when a lapTime has been clicked
@@ -388,7 +466,11 @@ namespace TrackTrends
string[] parts = btn.Name.Split('_'); string[] parts = btn.Name.Split('_');
Wrapper.DisplayLapTimeInfos(parts[0], Convert.ToInt32(parts[1]), btn.Text); Wrapper.DisplayLapTimeInfos(parts[0], Convert.ToInt32(parts[1]), btn.Text);
} }
/// <summary>
/// Will trigger responsive calculation everytime the form changes size
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Main_Resize(object sender, EventArgs e) private void Main_Resize(object sender, EventArgs e)
{ {
int xDiff = this.Width - oldSize.Width; int xDiff = this.Width - oldSize.Width;
+57 -43
View File
@@ -1,8 +1,8 @@
/// Author : Maxime Rohmer /// Author : Maxime Rohmer
/// Date : 30/05/2023 /// Date : 09/06/2023
/// File : OcrImage.cs /// File : OcrImage.cs
/// Brief : Class containing all the methods used to enhance images for OCR /// Brief : Class containing all the methods used to enhance images for OCR
/// Version : Alpha 1.0 /// Version : Beta 1.0
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -19,6 +19,8 @@ namespace TrackTrends
//Any color that has any of its R,G or B channel higher than the treshold will be considered as being usefull information //Any color that has any of its R,G or B channel higher than the treshold will be considered as being usefull information
public static Color F1TV_BACKGROUND_TRESHOLD = Color.FromArgb(0x50, 0x50, 0x50); public static Color F1TV_BACKGROUND_TRESHOLD = Color.FromArgb(0x50, 0x50, 0x50);
Bitmap InputBitmap; Bitmap InputBitmap;
Random rnd = new Random();
public enum WindowType public enum WindowType
{ {
LapTime, LapTime,
@@ -71,7 +73,7 @@ namespace TrackTrends
case WindowType.LapTime: case WindowType.LapTime:
//outputBitmap.Save(Window.LAPTIME_DEBUG_FOLDER + @"\raw_" + id + ".png"); //outputBitmap.Save(Window.LAPTIME_DEBUG_FOLDER + @"\raw_" + id + ".png");
outputBitmap = Tresholding(outputBitmap,185); outputBitmap = Tresholding(outputBitmap, 185);
//outputBitmap.Save(Window.LAPTIME_DEBUG_FOLDER + @"\Treshold_" + id + ".png"); //outputBitmap.Save(Window.LAPTIME_DEBUG_FOLDER + @"\Treshold_" + id + ".png");
outputBitmap = SobelEdgeDetection(outputBitmap); outputBitmap = SobelEdgeDetection(outputBitmap);
@@ -108,42 +110,53 @@ namespace TrackTrends
public static Bitmap Grayscale(Bitmap inputBitmap) public static Bitmap Grayscale(Bitmap inputBitmap)
{ {
Rectangle rect = new Rectangle(0, 0, inputBitmap.Width, inputBitmap.Height); Rectangle rect = new Rectangle(0, 0, inputBitmap.Width, inputBitmap.Height);
BitmapData bmpData = inputBitmap.LockBits(rect, ImageLockMode.ReadWrite, inputBitmap.PixelFormat); BitmapData bmpData = inputBitmap.LockBits(rect, ImageLockMode.ReadOnly, inputBitmap.PixelFormat);
int bytesPerPixel = Bitmap.GetPixelFormatSize(inputBitmap.PixelFormat) / 8; int bytesPerPixel = Bitmap.GetPixelFormatSize(inputBitmap.PixelFormat) / 8;
Bitmap resultBitmap = new Bitmap(inputBitmap.Width, inputBitmap.Height);
unsafe unsafe
{ {
byte* ptr = (byte*)bmpData.Scan0.ToPointer(); byte* inputPtr = (byte*)bmpData.Scan0.ToPointer();
for (int y = 0; y < inputBitmap.Height; y++) byte* resultPtr = (byte*)resultBitmap.LockBits(rect, ImageLockMode.WriteOnly, resultBitmap.PixelFormat).Scan0.ToPointer();
Parallel.For(0, inputBitmap.Height, y =>
{ {
byte* currentLine = ptr + (y * bmpData.Stride); byte* currentLine = inputPtr + (y * bmpData.Stride);
byte* resultLine = resultPtr + (y * resultBitmap.Width * bytesPerPixel);
for (int x = 0; x < inputBitmap.Width; x++) for (int x = 0; x < inputBitmap.Width; x++)
{ {
byte* pixel = currentLine + (x * bytesPerPixel); byte* inputPixel = currentLine + (x * bytesPerPixel);
byte* resultPixel = resultLine + (x * bytesPerPixel);
byte blue = pixel[0]; byte blue = inputPixel[0];
byte green = pixel[1]; byte green = inputPixel[1];
byte red = pixel[2]; byte red = inputPixel[2];
//Those a specific values to correct the weights so its more pleasing to the human eye //Those a specific values to correct the weights so its more pleasing to the human eye
int gray = (int)(red * 0.3 + green * 0.59 + blue * 0.11); int gray = (int)(red * 0.3 + green * 0.59 + blue * 0.11);
//This is not a proper treshold method but it is helping the sobel edge detection //This is not a proper treshold method but it is helping the sobel edge detection
if(gray <= F1TV_BACKGROUND_TRESHOLD.R) if (gray <= F1TV_BACKGROUND_TRESHOLD.R)
{ {
pixel[0] = pixel[1] = pixel[2] = 0; resultPixel[0] = resultPixel[1] = resultPixel[2] = 0;
} }
else else
{ {
pixel[0] = pixel[1] = pixel[2] = (byte)gray; resultPixel[0] = resultPixel[1] = resultPixel[2] = (byte)gray;
} }
} }
} });
resultBitmap.UnlockBits(resultBitmap.LockBits(rect, ImageLockMode.WriteOnly, resultBitmap.PixelFormat));
} }
inputBitmap.UnlockBits(bmpData); inputBitmap.UnlockBits(bmpData);
return inputBitmap; return resultBitmap;
} }
/// <summary> /// <summary>
/// Method that uses the Sobel Edge detection to outline the edges of the characters to help with the OCR /// Method that uses the Sobel Edge detection to outline the edges of the characters to help with the OCR
/// </summary> /// </summary>
@@ -161,6 +174,7 @@ namespace TrackTrends
// Apply the Sobel operators and normalize the gradients // Apply the Sobel operators and normalize the gradients
// NOTE: I dont know how easy or hard it would be to make this paralel but it could be a good idea to do so if possible. // NOTE: I dont know how easy or hard it would be to make this paralel but it could be a good idea to do so if possible.
//Parallel.For(1, grayscaleImage.Height - 1, y =>
for (int y = 1; y < grayscaleImage.Height - 1; y++) for (int y = 1; y < grayscaleImage.Height - 1; y++)
{ {
for (int x = 1; x < grayscaleImage.Width - 1; x++) for (int x = 1; x < grayscaleImage.Width - 1; x++)
@@ -175,7 +189,7 @@ namespace TrackTrends
edgesImage.SetPixel(x, y, Color.FromArgb(gradient, gradient, gradient)); edgesImage.SetPixel(x, y, Color.FromArgb(gradient, gradient, gradient));
} }
} }//);
return edgesImage; return edgesImage;
} }
@@ -206,39 +220,37 @@ namespace TrackTrends
/// Method that is used to whiten an image. Ignore the funny name. Its used to prevent colored text to trouble the OCR when it uses grayscaling /// Method that is used to whiten an image. Ignore the funny name. Its used to prevent colored text to trouble the OCR when it uses grayscaling
/// </summary> /// </summary>
/// <param name="inputBitmap">The bitmap to vanish</param> /// <param name="inputBitmap">The bitmap to vanish</param>
/// <returns></returns> /// <returns></returns>
public static Bitmap VanishOxyAction(Bitmap inputBitmap) public Bitmap VanishOxyAction(Bitmap inputBitmap)
{ {
Rectangle rect = new Rectangle(0, 0, inputBitmap.Width, inputBitmap.Height);
BitmapData bmpData = inputBitmap.LockBits(rect, ImageLockMode.ReadWrite, inputBitmap.PixelFormat);
int bytesPerPixel = Bitmap.GetPixelFormatSize(inputBitmap.PixelFormat) / 8;
unsafe unsafe
{ {
//Note : MAKE THIS PARALELL OMG WY DID I LEFT IT LIKE THAT BitmapData bitmapData = inputBitmap.LockBits(new Rectangle(0, 0, inputBitmap.Width, inputBitmap.Height), ImageLockMode.ReadWrite, inputBitmap.PixelFormat);
byte* ptr = (byte*)bmpData.Scan0.ToPointer();
for (int y = 0; y < inputBitmap.Height; y++)
{
byte* currentLine = ptr + (y * bmpData.Stride);
for (int x = 0; x < inputBitmap.Width; x++)
{
byte* pixel = currentLine + (x * bytesPerPixel);
int blue = (int)pixel[0]; int bytesPerPixel = System.Drawing.Bitmap.GetPixelFormatSize(inputBitmap.PixelFormat) / 8;
int green = (int)pixel[1]; int heightInPixels = bitmapData.Height;
int red = (int)pixel[2]; int widthInBytes = bitmapData.Width * bytesPerPixel;
byte* PtrFirstPixel = (byte*)bitmapData.Scan0;
Parallel.For(0, heightInPixels, y =>
{
byte* currentLine = PtrFirstPixel + (y * bitmapData.Stride);
for (int x = 0; x < widthInBytes; x = x + bytesPerPixel)
{
int blue = currentLine[x];
int green = currentLine[x + 1];
int red = currentLine[x + 2];
int max = Math.Max(Math.Max(blue, green), red); int max = Math.Max(Math.Max(blue, green), red);
if (max > 255 / 3) if (max > 255 / 3)
max = 255; max = 255;
pixel[0] = pixel[1] = pixel[2] = (byte)max; currentLine[x] = currentLine[x + 1] = currentLine[x + 2] = (byte)max;
} }
} });
inputBitmap.UnlockBits(bitmapData);
} }
inputBitmap.UnlockBits(bmpData);
return inputBitmap; return inputBitmap;
} }
/// <summary> /// <summary>
@@ -294,10 +306,12 @@ namespace TrackTrends
unsafe unsafe
{ {
byte* ptr = (byte*)bmpData.Scan0.ToPointer(); byte* ptr = (byte*)bmpData.Scan0.ToPointer();
for (int y = 0; y < inputBitmap.Height; y++) int bmpHeight = inputBitmap.Height;
int bmpWidth = inputBitmap.Width;
Parallel.For(0, bmpHeight, y =>
{ {
byte* currentLine = ptr + (y * bmpData.Stride); byte* currentLine = ptr + (y * bmpData.Stride);
for (int x = 0; x < inputBitmap.Width; x++) for (int x = 0; x < bmpWidth; x++)
{ {
byte* pixel = currentLine + (x * bytesPerPixel); byte* pixel = currentLine + (x * bytesPerPixel);
@@ -308,7 +322,7 @@ namespace TrackTrends
if (R <= F1TV_BACKGROUND_TRESHOLD.R && G <= F1TV_BACKGROUND_TRESHOLD.G && B <= F1TV_BACKGROUND_TRESHOLD.B) if (R <= F1TV_BACKGROUND_TRESHOLD.R && G <= F1TV_BACKGROUND_TRESHOLD.G && B <= F1TV_BACKGROUND_TRESHOLD.B)
pixel[0] = pixel[1] = pixel[2] = 0; pixel[0] = pixel[1] = pixel[2] = 0;
} }
} });
} }
inputBitmap.UnlockBits(bmpData); inputBitmap.UnlockBits(bmpData);
@@ -401,7 +415,7 @@ namespace TrackTrends
int G = pixel[1]; int G = pixel[1];
int R = pixel[2]; int R = pixel[2];
if (R >= F1TV_BACKGROUND_TRESHOLD.R +25|| G >= F1TV_BACKGROUND_TRESHOLD.G +25|| B >= F1TV_BACKGROUND_TRESHOLD.B +25) if (R >= F1TV_BACKGROUND_TRESHOLD.R + 25 || G >= F1TV_BACKGROUND_TRESHOLD.G + 25 || B >= F1TV_BACKGROUND_TRESHOLD.B + 25)
{ {
pixel[0] = 0xFF; pixel[0] = 0xFF;
pixel[1] = 0xFF; pixel[1] = 0xFF;
@@ -458,7 +472,7 @@ namespace TrackTrends
} }
inputBitmap.UnlockBits(bmpData); inputBitmap.UnlockBits(bmpData);
return Color.FromArgb(255,Math.Min(Convert.ToInt32((float)totR / (float)totPixels),255), Math.Min(Convert.ToInt32((float)totG / (float)totPixels),255), Math.Min(Convert.ToInt32((float)totB / (float)totPixels),255)); return Color.FromArgb(255, Math.Min(Convert.ToInt32((float)totR / (float)totPixels), 255), Math.Min(Convert.ToInt32((float)totG / (float)totPixels), 255), Math.Min(Convert.ToInt32((float)totB / (float)totPixels), 255));
} }
/// <summary> /// <summary>
/// This method simply inverts all the colors in a Bitmap /// This method simply inverts all the colors in a Bitmap
-22
View File
@@ -1,22 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TrackTrends
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Main());
}
}
}
+2 -2
View File
@@ -1,8 +1,8 @@
/// Author : Maxime Rohmer /// Author : Maxime Rohmer
/// Date : 30/05/2023 /// Date : 09/06/2023
/// File : Reader.cs /// File : Reader.cs
/// Brief : Class used to Read the config file for the OCR /// Brief : Class used to Read the config file for the OCR
/// Version : Alpha 1.0 /// Version : Beta 1.0
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
-494
View File
@@ -1,494 +0,0 @@
namespace TrackTrends
{
partial class Settings
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.gpbxRaceSettings = new System.Windows.Forms.GroupBox();
this.tbxGpUrl = new System.Windows.Forms.TextBox();
this.gpbxDriverList = new System.Windows.Forms.GroupBox();
this.lsbDrivers = new System.Windows.Forms.ListBox();
this.btnRemoveDriver = new System.Windows.Forms.Button();
this.btnAddDriver = new System.Windows.Forms.Button();
this.tbxDriverName = new System.Windows.Forms.TextBox();
this.gpbxPreview = new System.Windows.Forms.GroupBox();
this.lblWindowsRemaining = new System.Windows.Forms.Label();
this.btnResetDriver = new System.Windows.Forms.Button();
this.btnRefresh = new System.Windows.Forms.Button();
this.lblWindowPointsRemaining = new System.Windows.Forms.Label();
this.lblZonePointsRemaning = new System.Windows.Forms.Label();
this.btnCreateWindow = new System.Windows.Forms.Button();
this.pbxPreview = new System.Windows.Forms.PictureBox();
this.btnCreatZone = new System.Windows.Forms.Button();
this.gpbxWindowPreview = new System.Windows.Forms.GroupBox();
this.pbxWindowPreview = new System.Windows.Forms.PictureBox();
this.btnLoadPreset = new System.Windows.Forms.Button();
this.lsbPresets = new System.Windows.Forms.ListBox();
this.tbxPresetName = new System.Windows.Forms.TextBox();
this.btnSavePreset = new System.Windows.Forms.Button();
this.gpbxPresets = new System.Windows.Forms.GroupBox();
this.btnDeletePreset = new System.Windows.Forms.Button();
this.tip1 = new System.Windows.Forms.ToolTip(this.components);
this.gpbxRaceSettings.SuspendLayout();
this.gpbxDriverList.SuspendLayout();
this.gpbxPreview.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pbxPreview)).BeginInit();
this.gpbxWindowPreview.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pbxWindowPreview)).BeginInit();
this.gpbxPresets.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft YaHei UI", 19.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.ForeColor = System.Drawing.Color.White;
this.label1.Location = new System.Drawing.Point(12, 14);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(309, 43);
this.label1.TabIndex = 0;
this.label1.Text = "Configuration tool";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.ForeColor = System.Drawing.Color.White;
this.label2.Location = new System.Drawing.Point(3, 25);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(132, 23);
this.label2.TabIndex = 1;
this.label2.Text = "Grand Prix URL";
//
// gpbxRaceSettings
//
this.gpbxRaceSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.gpbxRaceSettings.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(79)))), ((int)(((byte)(79)))), ((int)(((byte)(79)))));
this.gpbxRaceSettings.Controls.Add(this.tbxGpUrl);
this.gpbxRaceSettings.Controls.Add(this.label2);
this.gpbxRaceSettings.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.gpbxRaceSettings.ForeColor = System.Drawing.Color.White;
this.gpbxRaceSettings.Location = new System.Drawing.Point(733, 9);
this.gpbxRaceSettings.Name = "gpbxRaceSettings";
this.gpbxRaceSettings.Padding = new System.Windows.Forms.Padding(0);
this.gpbxRaceSettings.Size = new System.Drawing.Size(521, 58);
this.gpbxRaceSettings.TabIndex = 2;
this.gpbxRaceSettings.TabStop = false;
this.gpbxRaceSettings.Text = "RaceSettings";
this.gpbxRaceSettings.Paint += new System.Windows.Forms.PaintEventHandler(this.removeBorders);
//
// tbxGpUrl
//
this.tbxGpUrl.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
this.tbxGpUrl.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.tbxGpUrl.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tbxGpUrl.ForeColor = System.Drawing.Color.White;
this.tbxGpUrl.Location = new System.Drawing.Point(141, 25);
this.tbxGpUrl.Name = "tbxGpUrl";
this.tbxGpUrl.Size = new System.Drawing.Size(367, 22);
this.tbxGpUrl.TabIndex = 4;
this.tbxGpUrl.TextChanged += new System.EventHandler(this.tbxGpUrl_TextChanged);
//
// gpbxDriverList
//
this.gpbxDriverList.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.gpbxDriverList.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(79)))), ((int)(((byte)(79)))), ((int)(((byte)(79)))));
this.gpbxDriverList.Controls.Add(this.lsbDrivers);
this.gpbxDriverList.Controls.Add(this.btnRemoveDriver);
this.gpbxDriverList.Controls.Add(this.btnAddDriver);
this.gpbxDriverList.Controls.Add(this.tbxDriverName);
this.gpbxDriverList.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.gpbxDriverList.Font = new System.Drawing.Font("Microsoft YaHei UI", 10F);
this.gpbxDriverList.ForeColor = System.Drawing.Color.White;
this.gpbxDriverList.Location = new System.Drawing.Point(995, 73);
this.gpbxDriverList.Name = "gpbxDriverList";
this.gpbxDriverList.Padding = new System.Windows.Forms.Padding(0);
this.gpbxDriverList.Size = new System.Drawing.Size(259, 269);
this.gpbxDriverList.TabIndex = 3;
this.gpbxDriverList.TabStop = false;
this.gpbxDriverList.Text = "DriverList";
this.gpbxDriverList.Paint += new System.Windows.Forms.PaintEventHandler(this.removeBorders);
//
// lsbDrivers
//
this.lsbDrivers.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
this.lsbDrivers.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.lsbDrivers.Font = new System.Drawing.Font("Microsoft YaHei UI", 10F);
this.lsbDrivers.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(252)))), ((int)(((byte)(252)))), ((int)(((byte)(252)))));
this.lsbDrivers.FormattingEnabled = true;
this.lsbDrivers.ItemHeight = 23;
this.lsbDrivers.Location = new System.Drawing.Point(10, 23);
this.lsbDrivers.Name = "lsbDrivers";
this.lsbDrivers.Size = new System.Drawing.Size(243, 138);
this.lsbDrivers.TabIndex = 10;
//
// btnRemoveDriver
//
this.btnRemoveDriver.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
this.btnRemoveDriver.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnRemoveDriver.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnRemoveDriver.ForeColor = System.Drawing.Color.White;
this.btnRemoveDriver.Location = new System.Drawing.Point(132, 167);
this.btnRemoveDriver.Name = "btnRemoveDriver";
this.btnRemoveDriver.Size = new System.Drawing.Size(121, 62);
this.btnRemoveDriver.TabIndex = 9;
this.btnRemoveDriver.Text = "Remove";
this.btnRemoveDriver.UseVisualStyleBackColor = false;
this.btnRemoveDriver.Click += new System.EventHandler(this.btnRemoveDriver_Click);
//
// btnAddDriver
//
this.btnAddDriver.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
this.btnAddDriver.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnAddDriver.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnAddDriver.ForeColor = System.Drawing.Color.White;
this.btnAddDriver.Location = new System.Drawing.Point(10, 167);
this.btnAddDriver.Name = "btnAddDriver";
this.btnAddDriver.Size = new System.Drawing.Size(116, 62);
this.btnAddDriver.TabIndex = 8;
this.btnAddDriver.Text = "Add";
this.btnAddDriver.UseVisualStyleBackColor = false;
this.btnAddDriver.Click += new System.EventHandler(this.btnAddDriver_Click);
//
// tbxDriverName
//
this.tbxDriverName.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
this.tbxDriverName.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.tbxDriverName.Font = new System.Drawing.Font("Microsoft YaHei UI", 11F);
this.tbxDriverName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(252)))), ((int)(((byte)(252)))), ((int)(((byte)(252)))));
this.tbxDriverName.Location = new System.Drawing.Point(10, 235);
this.tbxDriverName.Name = "tbxDriverName";
this.tbxDriverName.Size = new System.Drawing.Size(243, 24);
this.tbxDriverName.TabIndex = 7;
//
// gpbxPreview
//
this.gpbxPreview.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(79)))), ((int)(((byte)(79)))), ((int)(((byte)(79)))));
this.gpbxPreview.Controls.Add(this.lblWindowsRemaining);
this.gpbxPreview.Controls.Add(this.btnResetDriver);
this.gpbxPreview.Controls.Add(this.btnRefresh);
this.gpbxPreview.Controls.Add(this.lblWindowPointsRemaining);
this.gpbxPreview.Controls.Add(this.lblZonePointsRemaning);
this.gpbxPreview.Controls.Add(this.btnCreateWindow);
this.gpbxPreview.Controls.Add(this.pbxPreview);
this.gpbxPreview.Controls.Add(this.btnCreatZone);
this.gpbxPreview.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.gpbxPreview.Font = new System.Drawing.Font("Microsoft YaHei UI", 10F);
this.gpbxPreview.ForeColor = System.Drawing.Color.White;
this.gpbxPreview.Location = new System.Drawing.Point(18, 73);
this.gpbxPreview.Name = "gpbxPreview";
this.gpbxPreview.Padding = new System.Windows.Forms.Padding(0);
this.gpbxPreview.Size = new System.Drawing.Size(968, 608);
this.gpbxPreview.TabIndex = 4;
this.gpbxPreview.TabStop = false;
this.gpbxPreview.Text = "Preview";
this.gpbxPreview.Paint += new System.Windows.Forms.PaintEventHandler(this.removeBorders);
//
// lblWindowsRemaining
//
this.lblWindowsRemaining.AutoSize = true;
this.lblWindowsRemaining.BackColor = System.Drawing.Color.Transparent;
this.lblWindowsRemaining.ForeColor = System.Drawing.Color.White;
this.lblWindowsRemaining.Location = new System.Drawing.Point(215, 82);
this.lblWindowsRemaining.Name = "lblWindowsRemaining";
this.lblWindowsRemaining.Size = new System.Drawing.Size(183, 23);
this.lblWindowsRemaining.TabIndex = 6;
this.lblWindowsRemaining.Text = "7 windows remaining";
//
// btnResetDriver
//
this.btnResetDriver.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnResetDriver.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
this.btnResetDriver.Enabled = false;
this.btnResetDriver.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnResetDriver.ForeColor = System.Drawing.Color.White;
this.btnResetDriver.Location = new System.Drawing.Point(748, 20);
this.btnResetDriver.Name = "btnResetDriver";
this.btnResetDriver.Size = new System.Drawing.Size(211, 33);
this.btnResetDriver.TabIndex = 2;
this.btnResetDriver.Text = "Reset the emulator";
this.btnResetDriver.UseVisualStyleBackColor = false;
this.btnResetDriver.Click += new System.EventHandler(this.btnResetDriver_Click);
//
// btnRefresh
//
this.btnRefresh.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnRefresh.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
this.btnRefresh.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnRefresh.ForeColor = System.Drawing.Color.White;
this.btnRefresh.Location = new System.Drawing.Point(549, 20);
this.btnRefresh.Name = "btnRefresh";
this.btnRefresh.Size = new System.Drawing.Size(193, 33);
this.btnRefresh.TabIndex = 1;
this.btnRefresh.Text = "Start the browser";
this.btnRefresh.UseVisualStyleBackColor = false;
this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click);
//
// lblWindowPointsRemaining
//
this.lblWindowPointsRemaining.AutoSize = true;
this.lblWindowPointsRemaining.ForeColor = System.Drawing.Color.White;
this.lblWindowPointsRemaining.Location = new System.Drawing.Point(215, 59);
this.lblWindowPointsRemaining.Name = "lblWindowPointsRemaining";
this.lblWindowPointsRemaining.Size = new System.Drawing.Size(163, 23);
this.lblWindowPointsRemaining.TabIndex = 4;
this.lblWindowPointsRemaining.Text = "0 points remaining";
//
// lblZonePointsRemaning
//
this.lblZonePointsRemaning.AutoSize = true;
this.lblZonePointsRemaning.ForeColor = System.Drawing.Color.White;
this.lblZonePointsRemaning.Location = new System.Drawing.Point(19, 59);
this.lblZonePointsRemaning.Name = "lblZonePointsRemaning";
this.lblZonePointsRemaning.Size = new System.Drawing.Size(163, 23);
this.lblZonePointsRemaning.TabIndex = 5;
this.lblZonePointsRemaning.Text = "0 points remaining";
//
// btnCreateWindow
//
this.btnCreateWindow.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
this.btnCreateWindow.Enabled = false;
this.btnCreateWindow.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnCreateWindow.ForeColor = System.Drawing.Color.White;
this.btnCreateWindow.Location = new System.Drawing.Point(213, 23);
this.btnCreateWindow.Name = "btnCreateWindow";
this.btnCreateWindow.Size = new System.Drawing.Size(201, 33);
this.btnCreateWindow.TabIndex = 2;
this.btnCreateWindow.Text = "Create the windows";
this.btnCreateWindow.UseVisualStyleBackColor = false;
this.btnCreateWindow.Click += new System.EventHandler(this.btnCreateWindow_Click);
//
// pbxPreview
//
this.pbxPreview.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
this.pbxPreview.Location = new System.Drawing.Point(10, 62);
this.pbxPreview.Name = "pbxPreview";
this.pbxPreview.Size = new System.Drawing.Size(950, 540);
this.pbxPreview.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pbxPreview.TabIndex = 0;
this.pbxPreview.TabStop = false;
this.pbxPreview.Click += new System.EventHandler(this.pbxMain_Click);
this.pbxPreview.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbxMain_MouseClick);
//
// btnCreatZone
//
this.btnCreatZone.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
this.btnCreatZone.Enabled = false;
this.btnCreatZone.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnCreatZone.ForeColor = System.Drawing.Color.White;
this.btnCreatZone.Location = new System.Drawing.Point(6, 23);
this.btnCreatZone.Name = "btnCreatZone";
this.btnCreatZone.Size = new System.Drawing.Size(201, 33);
this.btnCreatZone.TabIndex = 1;
this.btnCreatZone.Text = "Create the main zone";
this.btnCreatZone.UseVisualStyleBackColor = false;
this.btnCreatZone.Click += new System.EventHandler(this.btnCreatZone_Click);
//
// gpbxWindowPreview
//
this.gpbxWindowPreview.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.gpbxWindowPreview.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(79)))), ((int)(((byte)(79)))), ((int)(((byte)(79)))));
this.gpbxWindowPreview.Controls.Add(this.pbxWindowPreview);
this.gpbxWindowPreview.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.gpbxWindowPreview.Font = new System.Drawing.Font("Microsoft YaHei UI", 10F);
this.gpbxWindowPreview.ForeColor = System.Drawing.Color.White;
this.gpbxWindowPreview.Location = new System.Drawing.Point(18, 688);
this.gpbxWindowPreview.Name = "gpbxWindowPreview";
this.gpbxWindowPreview.Padding = new System.Windows.Forms.Padding(0);
this.gpbxWindowPreview.Size = new System.Drawing.Size(1237, 88);
this.gpbxWindowPreview.TabIndex = 5;
this.gpbxWindowPreview.TabStop = false;
this.gpbxWindowPreview.Text = "DriverZonePreview";
this.gpbxWindowPreview.Paint += new System.Windows.Forms.PaintEventHandler(this.removeBorders);
//
// pbxWindowPreview
//
this.pbxWindowPreview.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
this.pbxWindowPreview.Location = new System.Drawing.Point(6, 30);
this.pbxWindowPreview.Name = "pbxWindowPreview";
this.pbxWindowPreview.Size = new System.Drawing.Size(1225, 50);
this.pbxWindowPreview.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pbxWindowPreview.TabIndex = 0;
this.pbxWindowPreview.TabStop = false;
this.pbxWindowPreview.Click += new System.EventHandler(this.pbxDriverZone_Click);
this.pbxWindowPreview.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbxDriverZone_MouseClick);
//
// btnLoadPreset
//
this.btnLoadPreset.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
this.btnLoadPreset.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnLoadPreset.ForeColor = System.Drawing.Color.White;
this.btnLoadPreset.Location = new System.Drawing.Point(10, 213);
this.btnLoadPreset.Name = "btnLoadPreset";
this.btnLoadPreset.Size = new System.Drawing.Size(243, 40);
this.btnLoadPreset.TabIndex = 10;
this.btnLoadPreset.Text = "Load the preset";
this.btnLoadPreset.UseVisualStyleBackColor = false;
this.btnLoadPreset.Click += new System.EventHandler(this.btnLoadPreset_Click);
//
// lsbPresets
//
this.lsbPresets.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
this.lsbPresets.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.lsbPresets.Font = new System.Drawing.Font("Microsoft YaHei UI", 10F);
this.lsbPresets.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(252)))), ((int)(((byte)(252)))), ((int)(((byte)(252)))));
this.lsbPresets.FormattingEnabled = true;
this.lsbPresets.ItemHeight = 23;
this.lsbPresets.Location = new System.Drawing.Point(10, 23);
this.lsbPresets.Name = "lsbPresets";
this.lsbPresets.Size = new System.Drawing.Size(243, 138);
this.lsbPresets.TabIndex = 8;
this.lsbPresets.SelectedIndexChanged += new System.EventHandler(this.lsbPresets_SelectedIndexChanged);
//
// tbxPresetName
//
this.tbxPresetName.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
this.tbxPresetName.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.tbxPresetName.Font = new System.Drawing.Font("Microsoft YaHei UI", 11F);
this.tbxPresetName.ForeColor = System.Drawing.Color.White;
this.tbxPresetName.Location = new System.Drawing.Point(10, 303);
this.tbxPresetName.Name = "tbxPresetName";
this.tbxPresetName.Size = new System.Drawing.Size(243, 24);
this.tbxPresetName.TabIndex = 7;
//
// btnSavePreset
//
this.btnSavePreset.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
this.btnSavePreset.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnSavePreset.ForeColor = System.Drawing.Color.White;
this.btnSavePreset.Location = new System.Drawing.Point(10, 259);
this.btnSavePreset.Name = "btnSavePreset";
this.btnSavePreset.Size = new System.Drawing.Size(243, 40);
this.btnSavePreset.TabIndex = 7;
this.btnSavePreset.Text = "Save current preset";
this.btnSavePreset.UseVisualStyleBackColor = false;
this.btnSavePreset.Click += new System.EventHandler(this.btnSavePreset_Click);
//
// gpbxPresets
//
this.gpbxPresets.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.gpbxPresets.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(79)))), ((int)(((byte)(79)))), ((int)(((byte)(79)))));
this.gpbxPresets.Controls.Add(this.btnSavePreset);
this.gpbxPresets.Controls.Add(this.btnDeletePreset);
this.gpbxPresets.Controls.Add(this.tbxPresetName);
this.gpbxPresets.Controls.Add(this.btnLoadPreset);
this.gpbxPresets.Controls.Add(this.lsbPresets);
this.gpbxPresets.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.gpbxPresets.Font = new System.Drawing.Font("Microsoft YaHei UI", 10F);
this.gpbxPresets.ForeColor = System.Drawing.Color.White;
this.gpbxPresets.Location = new System.Drawing.Point(995, 348);
this.gpbxPresets.Name = "gpbxPresets";
this.gpbxPresets.Padding = new System.Windows.Forms.Padding(0);
this.gpbxPresets.Size = new System.Drawing.Size(259, 333);
this.gpbxPresets.TabIndex = 6;
this.gpbxPresets.TabStop = false;
this.gpbxPresets.Text = "Presets";
this.gpbxPresets.Paint += new System.Windows.Forms.PaintEventHandler(this.removeBorders);
//
// btnDeletePreset
//
this.btnDeletePreset.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
this.btnDeletePreset.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnDeletePreset.ForeColor = System.Drawing.Color.White;
this.btnDeletePreset.Location = new System.Drawing.Point(10, 167);
this.btnDeletePreset.Name = "btnDeletePreset";
this.btnDeletePreset.Size = new System.Drawing.Size(243, 40);
this.btnDeletePreset.TabIndex = 11;
this.btnDeletePreset.Text = "Delete the preset";
this.btnDeletePreset.UseVisualStyleBackColor = false;
this.btnDeletePreset.Click += new System.EventHandler(this.btnDeletePreset_Click);
//
// Settings
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 19F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
this.ClientSize = new System.Drawing.Size(1266, 788);
this.Controls.Add(this.gpbxPresets);
this.Controls.Add(this.gpbxWindowPreview);
this.Controls.Add(this.gpbxPreview);
this.Controls.Add(this.gpbxDriverList);
this.Controls.Add(this.label1);
this.Controls.Add(this.gpbxRaceSettings);
this.Font = new System.Drawing.Font("Microsoft YaHei UI", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.MinimumSize = new System.Drawing.Size(1284, 835);
this.Name = "Settings";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Settings";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Settings_FormClosing);
this.Resize += new System.EventHandler(this.Settings_Resize);
this.gpbxRaceSettings.ResumeLayout(false);
this.gpbxRaceSettings.PerformLayout();
this.gpbxDriverList.ResumeLayout(false);
this.gpbxDriverList.PerformLayout();
this.gpbxPreview.ResumeLayout(false);
this.gpbxPreview.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pbxPreview)).EndInit();
this.gpbxWindowPreview.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pbxWindowPreview)).EndInit();
this.gpbxPresets.ResumeLayout(false);
this.gpbxPresets.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.GroupBox gpbxRaceSettings;
private System.Windows.Forms.TextBox tbxGpUrl;
private System.Windows.Forms.GroupBox gpbxDriverList;
private System.Windows.Forms.ListBox lsbDrivers;
private System.Windows.Forms.Button btnRemoveDriver;
private System.Windows.Forms.Button btnAddDriver;
private System.Windows.Forms.TextBox tbxDriverName;
private System.Windows.Forms.GroupBox gpbxPreview;
private System.Windows.Forms.PictureBox pbxPreview;
private System.Windows.Forms.GroupBox gpbxWindowPreview;
private System.Windows.Forms.PictureBox pbxWindowPreview;
private System.Windows.Forms.Button btnCreateWindow;
private System.Windows.Forms.Button btnCreatZone;
private System.Windows.Forms.ListBox lsbPresets;
private System.Windows.Forms.TextBox tbxPresetName;
private System.Windows.Forms.Button btnSavePreset;
private System.Windows.Forms.Label lblWindowsRemaining;
private System.Windows.Forms.Label lblZonePointsRemaning;
private System.Windows.Forms.Label lblWindowPointsRemaining;
private System.Windows.Forms.Button btnRefresh;
private System.Windows.Forms.Button btnResetDriver;
private System.Windows.Forms.Button btnLoadPreset;
private System.Windows.Forms.GroupBox gpbxPresets;
private System.Windows.Forms.Button btnDeletePreset;
private System.Windows.Forms.ToolTip tip1;
}
}
+136 -26
View File
@@ -1,4 +1,10 @@
using System; /// Author : Maxime Rohmer
/// Date : 09/06/2023
/// File : Settings.cs
/// Brief : Class that controls the settings view
/// Version : Beta 1.0
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
@@ -48,6 +54,9 @@ namespace TrackTrends
InitializeComponent(); InitializeComponent();
Load(); Load();
} }
/// <summary>
/// This methods regroups all the actions that the forms need to be doing at the first launch
/// </summary>
private void Load() private void Load()
{ {
RefreshUI(); RefreshUI();
@@ -57,6 +66,11 @@ namespace TrackTrends
oldPbxPreviewSize = pbxPreview.Size; oldPbxPreviewSize = pbxPreview.Size;
oldPbxWindowPreviewSize = pbxWindowPreview.Size; oldPbxWindowPreviewSize = pbxWindowPreview.Size;
btnLoadPreset.Enabled = false;
btnDeletePreset.Enabled = false;
btnSavePreset.Enabled = false;
// I prefered regrouping all the tooltips here to make it easier to edit (there is 100% of thoses sentences containing typos so if you see one dont hesitate to edit those messages)
tip1.SetToolTip(btnCreatZone, "After clicking you can select two points in the image to set the bounds of the important data"); tip1.SetToolTip(btnCreatZone, "After clicking you can select two points in the image to set the bounds of the important data");
tip1.SetToolTip(btnCreateWindow, "After clicking this you will have to select all the windows that are important on the lower image. Refer to the documentation for more infos"); tip1.SetToolTip(btnCreateWindow, "After clicking this you will have to select all the windows that are important on the lower image. Refer to the documentation for more infos");
tip1.SetToolTip(btnRefresh, "Starts the emulator or refreshes the images if its already running"); tip1.SetToolTip(btnRefresh, "Starts the emulator or refreshes the images if its already running");
@@ -66,6 +80,10 @@ namespace TrackTrends
tip1.SetToolTip(pbxPreview, "What the emulator returns"); tip1.SetToolTip(pbxPreview, "What the emulator returns");
tip1.SetToolTip(pbxWindowPreview, "One of the driver zones that the program managed to slice from the main zone"); tip1.SetToolTip(pbxWindowPreview, "One of the driver zones that the program managed to slice from the main zone");
} }
/// <summary>
/// This is the main method that will be called anytime something changes on the view
/// It can be called at any time and will adapt the UI taking into account the state of the app
/// </summary>
private void RefreshUI() private void RefreshUI()
{ {
lsbDrivers.DataSource = null; lsbDrivers.DataSource = null;
@@ -116,12 +134,21 @@ namespace TrackTrends
pbxWindowPreview.Image = Config.MainZone.Zones[0].Draw(); pbxWindowPreview.Image = Config.MainZone.Zones[0].Draw();
} }
} }
/// <summary>
/// This will create a new zone but will require two points (one at each opposing sides and corners)
/// </summary>
/// <param name="p1">The first corner (usually top left)</param>
/// <param name="p2">The second corner (usually bottom right)</param>
private void CreateNewZone(Point p1, Point p2) private void CreateNewZone(Point p1, Point p2)
{ {
Rectangle dimensions = CreateAbsoluteRectangle(p1, p2); Rectangle dimensions = CreateAbsoluteRectangle(p1, p2);
Config = new ConfigurationTool((Bitmap)pbxPreview.Image, dimensions); Config = new ConfigurationTool((Bitmap)pbxPreview.Image, dimensions);
RefreshUI(); RefreshUI();
} }
/// <summary>
/// Creates all the windows with an array of rectangles
/// </summary>
/// <param name="dimensions">An array that contains all the windows bounds and position (expects 9)</param>
private void CreateWindows(List<Rectangle> dimensions) private void CreateWindows(List<Rectangle> dimensions)
{ {
if (Config != null) if (Config != null)
@@ -129,11 +156,20 @@ namespace TrackTrends
Config.AddWindows(dimensions); Config.AddWindows(dimensions);
} }
} }
/// <summary>
/// Will just change the main URL
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void tbxGpUrl_TextChanged(object sender, EventArgs e) private void tbxGpUrl_TextChanged(object sender, EventArgs e)
{ {
GrandPrixUrl = tbxGpUrl.Text; GrandPrixUrl = tbxGpUrl.Text;
} }
/// <summary>
/// Adds a driver into the driver list
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnAddDriver_Click(object sender, EventArgs e) private void btnAddDriver_Click(object sender, EventArgs e)
{ {
string newDriver = tbxDriverName.Text; string newDriver = tbxDriverName.Text;
@@ -141,7 +177,11 @@ namespace TrackTrends
tbxDriverName.Text = ""; tbxDriverName.Text = "";
RefreshUI(); RefreshUI();
} }
/// <summary>
/// Removes a driver from the drivers list
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnRemoveDriver_Click(object sender, EventArgs e) private void btnRemoveDriver_Click(object sender, EventArgs e)
{ {
if (lsbDrivers.SelectedIndex >= 0) if (lsbDrivers.SelectedIndex >= 0)
@@ -150,6 +190,9 @@ namespace TrackTrends
} }
RefreshUI(); RefreshUI();
} }
/// <summary>
/// Will change everything that needs to be changed for when the users starts or stops creating a zone
/// </summary>
private void SwitchZoneCreation() private void SwitchZoneCreation()
{ {
if (CreatingZone) if (CreatingZone)
@@ -180,6 +223,9 @@ namespace TrackTrends
} }
RefreshUI(); RefreshUI();
} }
/// <summary>
/// Will change everything that needs to be changed for when the users starts or stops creating a window
/// </summary>
private void SwitchWindowCreation() private void SwitchWindowCreation()
{ {
if (CreatingWindow) if (CreatingWindow)
@@ -211,6 +257,11 @@ namespace TrackTrends
{ {
SwitchWindowCreation(); SwitchWindowCreation();
} }
/// <summary>
/// If the user is supposed to create a zone, will record the position of the clicks
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void pbxMain_MouseClick(object sender, MouseEventArgs e) private void pbxMain_MouseClick(object sender, MouseEventArgs e)
{ {
if (CreatingZone && pbxPreview.Image != null) if (CreatingZone && pbxPreview.Image != null)
@@ -236,10 +287,11 @@ namespace TrackTrends
RefreshUI(); RefreshUI();
} }
} }
private void pbxMain_Click(object sender, EventArgs e) /// <summary>
{ /// If the user is supposed to create a window, will record the position of the clicks
//Not the right one to use visibly /// </summary>
} /// <param name="sender"></param>
/// <param name="e"></param>
private void pbxDriverZone_MouseClick(object sender, MouseEventArgs e) private void pbxDriverZone_MouseClick(object sender, MouseEventArgs e)
{ {
if (CreatingWindow && pbxWindowPreview.Image != null) if (CreatingWindow && pbxWindowPreview.Image != null)
@@ -276,15 +328,18 @@ namespace TrackTrends
RefreshUI(); RefreshUI();
} }
} }
private void pbxDriverZone_Click(object sender, EventArgs e) /// <summary>
{ /// Creates a rectangle without caring about the order of the points.
//Not the right one to use visibly /// </summary>
} /// <param name="p1">First point. Can be top left or bottom right</param>
/// <param name="p2">Second point. Can be top left or bottom right</param>
/// <returns></returns>
private Rectangle CreateAbsoluteRectangle(Point p1, Point p2) private Rectangle CreateAbsoluteRectangle(Point p1, Point p2)
{ {
Point newP1 = new Point(); Point newP1 = new Point();
Point newP2 = new Point(); Point newP2 = new Point();
//Kind of a pain to have to do this but this lets the user do stupid things without the app crashing
if (p1.X < p2.X) if (p1.X < p2.X)
{ {
newP1.X = p1.X; newP1.X = p1.X;
@@ -308,7 +363,11 @@ namespace TrackTrends
} }
return new Rectangle(newP1.X, newP1.Y, newP2.X - newP1.X, newP2.Y - newP1.Y); return new Rectangle(newP1.X, newP1.Y, newP2.X - newP1.X, newP2.Y - newP1.Y);
} }
/// <summary>
/// Will refresh the emulator and will controll some of the controls
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private async void btnRefresh_Click(object sender, EventArgs e) private async void btnRefresh_Click(object sender, EventArgs e)
{ {
btnRefresh.Enabled = false; btnRefresh.Enabled = false;
@@ -355,23 +414,45 @@ namespace TrackTrends
break; break;
} }
MessageBox.Show(message); MessageBox.Show(message);
btnRefresh.Text = "Retry";
btnLoadPreset.Enabled = false;
btnDeletePreset.Enabled = false;
btnSavePreset.Enabled = false;
btnCreatZone.Enabled = false;
btnCreateWindow.Enabled = false;
btnResetDriver.Enabled = false;
} }
else else
{ {
btnRefresh.Text = "Get a newer image";
pbxPreview.Image = Emulator.Screenshot(); pbxPreview.Image = Emulator.Screenshot();
btnLoadPreset.Enabled = true;
btnDeletePreset.Enabled = true;
btnSavePreset.Enabled = true;
btnCreatZone.Enabled = true;
btnCreateWindow.Enabled = true;
btnResetDriver.Enabled = true;
} }
} }
else else
{ {
pbxPreview.Image = Emulator.Screenshot(); pbxPreview.Image = Emulator.Screenshot();
//I know im repeating myself. This part could use a bool variable that allows those buttons to be displayed but it was the fastest way to fix a bad behaviour in the app
btnLoadPreset.Enabled = true;
btnDeletePreset.Enabled = true;
btnSavePreset.Enabled = true;
btnCreatZone.Enabled = true;
btnCreateWindow.Enabled = true;
btnResetDriver.Enabled = true;
} }
btnRefresh.Enabled = true; btnRefresh.Enabled = true;
btnCreatZone.Enabled = true;
btnCreateWindow.Enabled = true;
btnResetDriver.Enabled = true;
btnRefresh.Text = "Get a newer image";
} }
/// <summary>
/// Will try to close the headless browser so the main form can launch a new one safely
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Settings_FormClosing(object sender, FormClosingEventArgs e) private void Settings_FormClosing(object sender, FormClosingEventArgs e)
{ {
if (Emulator != null) if (Emulator != null)
@@ -381,7 +462,11 @@ namespace TrackTrends
Emulator = null; Emulator = null;
GC.Collect(); GC.Collect();
} }
/// <summary>
/// Will reset the drivers
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnResetDriver_Click(object sender, EventArgs e) private void btnResetDriver_Click(object sender, EventArgs e)
{ {
if (Emulator != null) if (Emulator != null)
@@ -389,7 +474,11 @@ namespace TrackTrends
Emulator.ResetDriver(); Emulator.ResetDriver();
} }
} }
/// <summary>
/// Saves the current presets as a new JSON file
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnSavePreset_Click(object sender, EventArgs e) private void btnSavePreset_Click(object sender, EventArgs e)
{ {
string presetName = tbxPresetName.Text; string presetName = tbxPresetName.Text;
@@ -399,12 +488,21 @@ namespace TrackTrends
} }
RefreshUI(); RefreshUI();
} }
/// <summary>
/// Will change the selected preset. Usefull if you close this page because then the main form will keep in memory your last choice
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void lsbPresets_SelectedIndexChanged(object sender, EventArgs e) private void lsbPresets_SelectedIndexChanged(object sender, EventArgs e)
{ {
SelectedConfigFile = (string)lsbPresets.Items[lsbPresets.SelectedIndex]; if (lsbPresets.SelectedIndex >= 0)
SelectedConfigFile = (string)lsbPresets.Items[lsbPresets.SelectedIndex];
} }
/// <summary>
/// Will load an existing presets
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnLoadPreset_Click(object sender, EventArgs e) private void btnLoadPreset_Click(object sender, EventArgs e)
{ {
//MessageBox.Show(lsbPresets.SelectedIndex.ToString()); //MessageBox.Show(lsbPresets.SelectedIndex.ToString());
@@ -427,7 +525,11 @@ namespace TrackTrends
RefreshUI(); RefreshUI();
} }
} }
/// <summary>
/// This will be called everytime the form resizes. Here we are making the form responsive
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Settings_Resize(object sender, EventArgs e) private void Settings_Resize(object sender, EventArgs e)
{ {
int xDiff = this.Width - oldSize.Width; int xDiff = this.Width - oldSize.Width;
@@ -438,7 +540,11 @@ namespace TrackTrends
pbxPreview.Size = new Size(oldPbxPreviewSize.Width + xDiff, oldPbxPreviewSize.Height + yDiff); pbxPreview.Size = new Size(oldPbxPreviewSize.Width + xDiff, oldPbxPreviewSize.Height + yDiff);
pbxWindowPreview.Size = new Size(oldPbxWindowPreviewSize.Width + xDiff, oldPbxWindowPreviewSize.Height); pbxWindowPreview.Size = new Size(oldPbxWindowPreviewSize.Width + xDiff, oldPbxWindowPreviewSize.Height);
} }
/// <summary>
/// Will delete an existing preset
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnDeletePreset_Click(object sender, EventArgs e) private void btnDeletePreset_Click(object sender, EventArgs e)
{ {
int selectedIndex = lsbPresets.SelectedIndex; int selectedIndex = lsbPresets.SelectedIndex;
@@ -456,7 +562,11 @@ namespace TrackTrends
} }
} }
} }
/// <summary>
/// Sketchy method that is used to remove the borders from groupboxes... Yes its dumb but I dont think there is any other way
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void removeBorders(object sender, PaintEventArgs e) private void removeBorders(object sender, PaintEventArgs e)
{ {
GroupBox gpbx = (GroupBox)sender; GroupBox gpbx = (GroupBox)sender;
+2 -2
View File
@@ -1,8 +1,8 @@
/// Author : Maxime Rohmer /// Author : Maxime Rohmer
/// Date : 30/05/2023 /// Date : 09/08/2023
/// File : SqliteStorage.cs /// File : SqliteStorage.cs
/// Brief : Class that controls the sqlite database /// Brief : Class that controls the sqlite database
/// Version : Alpha 1.0 /// Version : Beta 1.0
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
+2 -2
View File
@@ -1,8 +1,8 @@
/// Author : Maxime Rohmer /// Author : Maxime Rohmer
/// Date : 30/05/2023 /// Date : 09/06/2023
/// File : Window.cs /// File : Window.cs
/// Brief : Default Window object that is mainly expected to be inherited. /// Brief : Default Window object that is mainly expected to be inherited.
/// Version : Alpha 1.0 /// Version : Beta 1.0
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
+2 -2
View File
@@ -1,8 +1,8 @@
/// Author : Maxime Rohmer /// Author : Maxime Rohmer
/// Date : 30/05/2023 /// Date : 09/06/2023
/// File : Zone.cs /// File : Zone.cs
/// Brief : Class that contains all the methods and infos for a zone. This is designed to be potentially be inherited. /// Brief : Class that contains all the methods and infos for a zone. This is designed to be potentially be inherited.
/// Version : Alpha 1.0 /// Version : Beta 1.0
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;