diff --git a/docs/Code/DataWrapper.cs b/docs/Code/DataWrapper.cs index d5ce5d6..eda5691 100644 --- a/docs/Code/DataWrapper.cs +++ b/docs/Code/DataWrapper.cs @@ -1,8 +1,8 @@ /// Author : Maxime Rohmer -/// Date : 30/05/2023 +/// Date : 09/06/2023 /// 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 -/// Version : Alpha 1.0 +/// Version : Beta 1.0 using System; using System.Collections.Generic; diff --git a/docs/Code/DriverData.cs b/docs/Code/DriverData.cs index 75abe73..f76385a 100644 --- a/docs/Code/DriverData.cs +++ b/docs/Code/DriverData.cs @@ -1,8 +1,8 @@ /// Author : Maxime Rohmer -/// Date : 30/05/2023 +/// Date : 09/06/2023 /// File : DriverData.cs /// 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.Collections.Generic; diff --git a/docs/Code/DriverDrsWindow.cs b/docs/Code/DriverDrsWindow.cs index 781c506..a65db8e 100644 --- a/docs/Code/DriverDrsWindow.cs +++ b/docs/Code/DriverDrsWindow.cs @@ -1,8 +1,8 @@ /// Author : Maxime Rohmer -/// Date : 30/05/2023 +/// Date : 09/06/2023 /// File : DriverDrsWindow.cs /// Brief : Window containing DRS related method and infos -/// Version : Alpha 1.0 +/// Version : Beta 1.0 using System; using System.Collections.Generic; diff --git a/docs/Code/DriverLapTimeWindow.cs b/docs/Code/DriverLapTimeWindow.cs index 845d030..7a2f246 100644 --- a/docs/Code/DriverLapTimeWindow.cs +++ b/docs/Code/DriverLapTimeWindow.cs @@ -1,8 +1,8 @@ /// Author : Maxime Rohmer -/// Date : 30/05/2023 +/// Date : 09/06/2023 /// File : DriverLapTimeWindow /// Brief : Window containing infos about the lap time of a driver -/// Version : Alpha 1.0 +/// Version : Beta 1.0 using System; using System.Collections.Generic; diff --git a/docs/Code/DriverNameWindow.cs b/docs/Code/DriverNameWindow.cs index 7a5e757..9d70328 100644 --- a/docs/Code/DriverNameWindow.cs +++ b/docs/Code/DriverNameWindow.cs @@ -1,8 +1,8 @@ /// Author : Maxime Rohmer -/// Date : 30/05/2023 +/// Date : 09/06/2023 /// File : DriverNameWindow /// Brief : Window containing infos about the name of the driver -/// Version : Alpha 1.0 +/// Version : Beta 1.0 using System; using System.Collections.Generic; diff --git a/docs/Code/DriverPositionWindow.cs b/docs/Code/DriverPositionWindow.cs index e3fce4d..0830819 100644 --- a/docs/Code/DriverPositionWindow.cs +++ b/docs/Code/DriverPositionWindow.cs @@ -1,8 +1,8 @@ /// Author : Maxime Rohmer -/// Date : 30/05/2023 +/// Date : 09/06/2023 /// File : DriverPositionWindow.cs /// Brief : Window containing infos about the position of a driver. -/// Version : Alpha 1.0 +/// Version : Beta 1.0 using System; using System.Collections.Generic; diff --git a/docs/Code/DriverSectorWindow.cs b/docs/Code/DriverSectorWindow.cs index 4623469..2a2bfbe 100644 --- a/docs/Code/DriverSectorWindow.cs +++ b/docs/Code/DriverSectorWindow.cs @@ -1,8 +1,8 @@ /// Author : Maxime Rohmer -/// Date : 30/05/2023 +/// Date : 09/06/2023 /// File : DriverSectorWindow.cs /// 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.Collections.Generic; diff --git a/docs/Code/DriverTyresWindow.cs b/docs/Code/DriverTyresWindow.cs index 45e6a3e..46a85cc 100644 --- a/docs/Code/DriverTyresWindow.cs +++ b/docs/Code/DriverTyresWindow.cs @@ -1,8 +1,8 @@ /// Author : Maxime Rohmer -/// Date : 30/05/2023 +/// Date : 09/06/2023 /// File : DriverTyresWindow.cs /// Brief : Window containing infos about a driver's tyre -/// Version : Alpha 1.0 +/// Version : Beta 1.0 using System; using System.Collections.Generic; diff --git a/docs/Code/F1TVEmulator.cs b/docs/Code/F1TVEmulator.cs index fbd8bee..e5ef49a 100644 --- a/docs/Code/F1TVEmulator.cs +++ b/docs/Code/F1TVEmulator.cs @@ -1,8 +1,8 @@ /// Author : Maxime Rohmer -/// Date : 30/05/2023 +/// Date : 09/06/2023 /// File : F1TVEmulator.cs /// 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.Firefox; @@ -187,6 +187,18 @@ namespace TrackTrends 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) //Cannot use The timeout because the feed loading is not really loading so there is not event or anything Thread.Sleep(5000); diff --git a/docs/Code/Form1.cs b/docs/Code/Form1.cs index 0ee7951..6899b87 100644 --- a/docs/Code/Form1.cs +++ b/docs/Code/Form1.cs @@ -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.ComponentModel; using System.Data; @@ -15,7 +21,6 @@ namespace TrackTrends { public partial class Main : Form { - //private Reader Reader = null; private F1TVEmulator Emulator = null; private DataWrapper Wrapper = null; private bool cancelRequested = false; @@ -47,7 +52,10 @@ namespace TrackTrends { InitializeComponent(); } - public async void RefreshUI() + /// + /// Will update everything that is not data related + /// + public void RefreshUI() { if (Directory.Exists(ConfigurationTool.CONFIGS_FOLDER_NAME)) { @@ -55,7 +63,12 @@ namespace TrackTrends lsbPresets.DataSource = Directory.GetFiles(ConfigurationTool.CONFIGS_FOLDER_NAME); } } - private async void btnSettings_Click(object sender, EventArgs e) + /// + /// Opens the settings page. Also disposes of the browser if there is one opened and all thos things + /// + /// + /// + private void btnSettings_Click(object sender, EventArgs e) { if (Emulator != null) Emulator.ResetDriver(); @@ -88,6 +101,7 @@ namespace TrackTrends } 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"); } } @@ -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"); } } - + /// + /// Will do everything that needs to be done at the first start of the app + /// + /// + /// 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 @@ -106,6 +124,8 @@ namespace TrackTrends tbxGpUrl.Text = GpUrl; + this.DoubleBuffered = true; + oldSize = this.Size; oldRankingSize = gpbxRanking.Size; oldLapTimesSize = gpbxLapTimes.Size; @@ -134,7 +154,11 @@ namespace TrackTrends RefreshUI(); } - + /// + /// Will start or stop the process of decoding + /// + /// + /// private async void btnUpdate_Click(object sender, EventArgs e) { cancelRequested = false; @@ -192,18 +216,32 @@ namespace TrackTrends btnSettings.Enabled = true; } } + /// + /// Will display the overtakes in the overtakes list box + /// private void DisplayOvertakes() { Wrapper.DisplayOvertakes(lsbOvertakes); } + /// + /// Will display the battles in the battles pannel + /// private void DisplayBattles() { Wrapper.DisplayBattles(pnlBattles, this); } + /// + /// Will display the time differences in the faster and slowest pannels + /// private void DisplayDeltas() { Wrapper.DisplayTimesDeltas(pnlFastest, pnlSlowest, this); } + /// + /// Will try to stop the emulator (usually does not work please do not count on it) + /// + /// + /// private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (Emulator != null) @@ -211,6 +249,12 @@ namespace TrackTrends Emulator.Stop(); } } + /// + /// 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 + /// + /// + /// + /// private void DisplayResults(int errorCode, Stopwatch sw, Bitmap screen) { if (errorCode != 0) @@ -224,6 +268,11 @@ namespace TrackTrends } } + /// + /// Will stop the data recovering operation and resets some buttons and text + /// + /// + /// private void btnStopUpdating_Click(object sender, EventArgs e) { // Set the cancellation flag @@ -232,6 +281,11 @@ namespace TrackTrends btnResetEmulator.Enabled = false; btnStopUpdating.Text = "Stopping"; } + /// + /// Will start the F1TVEmulator, again this name is historical because back at the start of this project this button did not have a name + /// + /// + /// private async void button1_Click(object sender, EventArgs e) { lsbOvertakes.Items.Clear(); @@ -301,6 +355,11 @@ namespace TrackTrends btnStartDecoding.Enabled = true; } } + /// + /// Silly way to remove borders from groupbox and make them look like pannels with titles + /// + /// + /// private void removeBorders(object sender, PaintEventArgs e) { GroupBox gpbx = (GroupBox)sender; @@ -317,17 +376,31 @@ namespace TrackTrends e.Graphics.DrawString(gpbx.Text, gpbx.Font, brush, textPosition); } } + /// + /// Will change the preset to use when starting the emulator + /// + /// + /// private void lsbPresets_SelectedIndexChanged(object sender, EventArgs e) { if (lsbPresets.SelectedIndex >= 0) ConfigFile = lsbPresets.Items[lsbPresets.SelectedIndex].ToString(); } - + /// + /// Will change the URL the emulator will use, historical name again + /// + /// + /// private void textBox1_TextChanged(object sender, EventArgs e) { if (tbxGpUrl.Text != "") GpUrl = tbxGpUrl.Text; } + /// + /// 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 + /// + /// + /// public void btnDriver_Click(object sender, EventArgs e) { //Removes the cover @@ -381,6 +454,11 @@ namespace TrackTrends break; } } + /// + /// This is supposed to be called by an automatically generated button. It should be any button with a laptime info on it + /// + /// + /// public void btnLapTime_Click(object sender, EventArgs e) { //Happens when a lapTime has been clicked @@ -388,7 +466,11 @@ namespace TrackTrends string[] parts = btn.Name.Split('_'); Wrapper.DisplayLapTimeInfos(parts[0], Convert.ToInt32(parts[1]), btn.Text); } - + /// + /// Will trigger responsive calculation everytime the form changes size + /// + /// + /// private void Main_Resize(object sender, EventArgs e) { int xDiff = this.Width - oldSize.Width; diff --git a/docs/Code/OcrImage.cs b/docs/Code/OcrImage.cs index 15878d5..66c36e2 100644 --- a/docs/Code/OcrImage.cs +++ b/docs/Code/OcrImage.cs @@ -1,8 +1,8 @@ /// Author : Maxime Rohmer -/// Date : 30/05/2023 +/// Date : 09/06/2023 /// File : OcrImage.cs /// Brief : Class containing all the methods used to enhance images for OCR -/// Version : Alpha 1.0 +/// Version : Beta 1.0 using System; 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 public static Color F1TV_BACKGROUND_TRESHOLD = Color.FromArgb(0x50, 0x50, 0x50); Bitmap InputBitmap; + + Random rnd = new Random(); public enum WindowType { LapTime, @@ -71,7 +73,7 @@ namespace TrackTrends case WindowType.LapTime: //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 = SobelEdgeDetection(outputBitmap); @@ -108,42 +110,53 @@ namespace TrackTrends public static Bitmap Grayscale(Bitmap inputBitmap) { 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; + Bitmap resultBitmap = new Bitmap(inputBitmap.Width, inputBitmap.Height); + unsafe { - byte* ptr = (byte*)bmpData.Scan0.ToPointer(); - for (int y = 0; y < inputBitmap.Height; y++) + byte* inputPtr = (byte*)bmpData.Scan0.ToPointer(); + 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++) { - byte* pixel = currentLine + (x * bytesPerPixel); + byte* inputPixel = currentLine + (x * bytesPerPixel); + byte* resultPixel = resultLine + (x * bytesPerPixel); - byte blue = pixel[0]; - byte green = pixel[1]; - byte red = pixel[2]; + byte blue = inputPixel[0]; + byte green = inputPixel[1]; + byte red = inputPixel[2]; //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); //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 { - 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); - return inputBitmap; + return resultBitmap; } + /// /// Method that uses the Sobel Edge detection to outline the edges of the characters to help with the OCR /// @@ -161,6 +174,7 @@ namespace TrackTrends // 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. + //Parallel.For(1, grayscaleImage.Height - 1, y => for (int y = 1; y < grayscaleImage.Height - 1; y++) { for (int x = 1; x < grayscaleImage.Width - 1; x++) @@ -175,7 +189,7 @@ namespace TrackTrends edgesImage.SetPixel(x, y, Color.FromArgb(gradient, gradient, gradient)); } - } + }//); 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 /// /// The bitmap to vanish - /// - 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 { - //Note : MAKE THIS PARALELL OMG WY DID I LEFT IT LIKE THAT - 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); + BitmapData bitmapData = inputBitmap.LockBits(new Rectangle(0, 0, inputBitmap.Width, inputBitmap.Height), ImageLockMode.ReadWrite, inputBitmap.PixelFormat); - int blue = (int)pixel[0]; - int green = (int)pixel[1]; - int red = (int)pixel[2]; + int bytesPerPixel = System.Drawing.Bitmap.GetPixelFormatSize(inputBitmap.PixelFormat) / 8; + int heightInPixels = bitmapData.Height; + 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); if (max > 255 / 3) 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; } /// @@ -294,10 +306,12 @@ namespace TrackTrends unsafe { 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); - for (int x = 0; x < inputBitmap.Width; x++) + for (int x = 0; x < bmpWidth; x++) { 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) pixel[0] = pixel[1] = pixel[2] = 0; } - } + }); } inputBitmap.UnlockBits(bmpData); @@ -401,7 +415,7 @@ namespace TrackTrends int G = pixel[1]; 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[1] = 0xFF; @@ -458,7 +472,7 @@ namespace TrackTrends } 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)); } /// /// This method simply inverts all the colors in a Bitmap diff --git a/docs/Code/Program.cs b/docs/Code/Program.cs deleted file mode 100644 index f995bc2..0000000 --- a/docs/Code/Program.cs +++ /dev/null @@ -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 - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Main()); - } - } -} diff --git a/docs/Code/Reader.cs b/docs/Code/Reader.cs index d1d4c30..73d526e 100644 --- a/docs/Code/Reader.cs +++ b/docs/Code/Reader.cs @@ -1,8 +1,8 @@ /// Author : Maxime Rohmer -/// Date : 30/05/2023 +/// Date : 09/06/2023 /// File : Reader.cs /// Brief : Class used to Read the config file for the OCR -/// Version : Alpha 1.0 +/// Version : Beta 1.0 using System; using System.Collections.Generic; diff --git a/docs/Code/Settings.Designer.cs b/docs/Code/Settings.Designer.cs deleted file mode 100644 index 8d05266..0000000 --- a/docs/Code/Settings.Designer.cs +++ /dev/null @@ -1,494 +0,0 @@ -namespace TrackTrends -{ - partial class Settings - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - 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; - } -} \ No newline at end of file diff --git a/docs/Code/Settings.cs b/docs/Code/Settings.cs index 28077fd..fc2370b 100644 --- a/docs/Code/Settings.cs +++ b/docs/Code/Settings.cs @@ -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.ComponentModel; using System.Data; @@ -48,6 +54,9 @@ namespace TrackTrends InitializeComponent(); Load(); } + /// + /// This methods regroups all the actions that the forms need to be doing at the first launch + /// private void Load() { RefreshUI(); @@ -57,6 +66,11 @@ namespace TrackTrends oldPbxPreviewSize = pbxPreview.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(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"); @@ -66,6 +80,10 @@ namespace TrackTrends 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"); } + /// + /// 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 + /// private void RefreshUI() { lsbDrivers.DataSource = null; @@ -116,12 +134,21 @@ namespace TrackTrends pbxWindowPreview.Image = Config.MainZone.Zones[0].Draw(); } } + /// + /// This will create a new zone but will require two points (one at each opposing sides and corners) + /// + /// The first corner (usually top left) + /// The second corner (usually bottom right) private void CreateNewZone(Point p1, Point p2) { Rectangle dimensions = CreateAbsoluteRectangle(p1, p2); Config = new ConfigurationTool((Bitmap)pbxPreview.Image, dimensions); RefreshUI(); } + /// + /// Creates all the windows with an array of rectangles + /// + /// An array that contains all the windows bounds and position (expects 9) private void CreateWindows(List dimensions) { if (Config != null) @@ -129,11 +156,20 @@ namespace TrackTrends Config.AddWindows(dimensions); } } + /// + /// Will just change the main URL + /// + /// + /// private void tbxGpUrl_TextChanged(object sender, EventArgs e) { GrandPrixUrl = tbxGpUrl.Text; } - + /// + /// Adds a driver into the driver list + /// + /// + /// private void btnAddDriver_Click(object sender, EventArgs e) { string newDriver = tbxDriverName.Text; @@ -141,7 +177,11 @@ namespace TrackTrends tbxDriverName.Text = ""; RefreshUI(); } - + /// + /// Removes a driver from the drivers list + /// + /// + /// private void btnRemoveDriver_Click(object sender, EventArgs e) { if (lsbDrivers.SelectedIndex >= 0) @@ -150,6 +190,9 @@ namespace TrackTrends } RefreshUI(); } + /// + /// Will change everything that needs to be changed for when the users starts or stops creating a zone + /// private void SwitchZoneCreation() { if (CreatingZone) @@ -180,6 +223,9 @@ namespace TrackTrends } RefreshUI(); } + /// + /// Will change everything that needs to be changed for when the users starts or stops creating a window + /// private void SwitchWindowCreation() { if (CreatingWindow) @@ -211,6 +257,11 @@ namespace TrackTrends { SwitchWindowCreation(); } + /// + /// If the user is supposed to create a zone, will record the position of the clicks + /// + /// + /// private void pbxMain_MouseClick(object sender, MouseEventArgs e) { if (CreatingZone && pbxPreview.Image != null) @@ -236,10 +287,11 @@ namespace TrackTrends RefreshUI(); } } - private void pbxMain_Click(object sender, EventArgs e) - { - //Not the right one to use visibly - } + /// + /// If the user is supposed to create a window, will record the position of the clicks + /// + /// + /// private void pbxDriverZone_MouseClick(object sender, MouseEventArgs e) { if (CreatingWindow && pbxWindowPreview.Image != null) @@ -276,15 +328,18 @@ namespace TrackTrends RefreshUI(); } } - private void pbxDriverZone_Click(object sender, EventArgs e) - { - //Not the right one to use visibly - } + /// + /// Creates a rectangle without caring about the order of the points. + /// + /// First point. Can be top left or bottom right + /// Second point. Can be top left or bottom right + /// private Rectangle CreateAbsoluteRectangle(Point p1, Point p2) { Point newP1 = 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) { 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); } - + /// + /// Will refresh the emulator and will controll some of the controls + /// + /// + /// private async void btnRefresh_Click(object sender, EventArgs e) { btnRefresh.Enabled = false; @@ -355,23 +414,45 @@ namespace TrackTrends break; } 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 { + btnRefresh.Text = "Get a newer image"; pbxPreview.Image = Emulator.Screenshot(); + + btnLoadPreset.Enabled = true; + btnDeletePreset.Enabled = true; + btnSavePreset.Enabled = true; + btnCreatZone.Enabled = true; + btnCreateWindow.Enabled = true; + btnResetDriver.Enabled = true; } } else { 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; - btnCreatZone.Enabled = true; - btnCreateWindow.Enabled = true; - btnResetDriver.Enabled = true; - btnRefresh.Text = "Get a newer image"; } - + /// + /// Will try to close the headless browser so the main form can launch a new one safely + /// + /// + /// private void Settings_FormClosing(object sender, FormClosingEventArgs e) { if (Emulator != null) @@ -381,7 +462,11 @@ namespace TrackTrends Emulator = null; GC.Collect(); } - + /// + /// Will reset the drivers + /// + /// + /// private void btnResetDriver_Click(object sender, EventArgs e) { if (Emulator != null) @@ -389,7 +474,11 @@ namespace TrackTrends Emulator.ResetDriver(); } } - + /// + /// Saves the current presets as a new JSON file + /// + /// + /// private void btnSavePreset_Click(object sender, EventArgs e) { string presetName = tbxPresetName.Text; @@ -399,12 +488,21 @@ namespace TrackTrends } RefreshUI(); } - + /// + /// Will change the selected preset. Usefull if you close this page because then the main form will keep in memory your last choice + /// + /// + /// private void lsbPresets_SelectedIndexChanged(object sender, EventArgs e) { - SelectedConfigFile = (string)lsbPresets.Items[lsbPresets.SelectedIndex]; + if (lsbPresets.SelectedIndex >= 0) + SelectedConfigFile = (string)lsbPresets.Items[lsbPresets.SelectedIndex]; } - + /// + /// Will load an existing presets + /// + /// + /// private void btnLoadPreset_Click(object sender, EventArgs e) { //MessageBox.Show(lsbPresets.SelectedIndex.ToString()); @@ -427,7 +525,11 @@ namespace TrackTrends RefreshUI(); } } - + /// + /// This will be called everytime the form resizes. Here we are making the form responsive + /// + /// + /// private void Settings_Resize(object sender, EventArgs e) { int xDiff = this.Width - oldSize.Width; @@ -438,7 +540,11 @@ namespace TrackTrends pbxPreview.Size = new Size(oldPbxPreviewSize.Width + xDiff, oldPbxPreviewSize.Height + yDiff); pbxWindowPreview.Size = new Size(oldPbxWindowPreviewSize.Width + xDiff, oldPbxWindowPreviewSize.Height); } - + /// + /// Will delete an existing preset + /// + /// + /// private void btnDeletePreset_Click(object sender, EventArgs e) { int selectedIndex = lsbPresets.SelectedIndex; @@ -456,7 +562,11 @@ namespace TrackTrends } } } - + /// + /// Sketchy method that is used to remove the borders from groupboxes... Yes its dumb but I dont think there is any other way + /// + /// + /// private void removeBorders(object sender, PaintEventArgs e) { GroupBox gpbx = (GroupBox)sender; diff --git a/docs/Code/SqliteStorage.cs b/docs/Code/SqliteStorage.cs index 21eec7a..8af449b 100644 --- a/docs/Code/SqliteStorage.cs +++ b/docs/Code/SqliteStorage.cs @@ -1,8 +1,8 @@ /// Author : Maxime Rohmer -/// Date : 30/05/2023 +/// Date : 09/08/2023 /// File : SqliteStorage.cs /// Brief : Class that controls the sqlite database -/// Version : Alpha 1.0 +/// Version : Beta 1.0 using System; using System.Collections.Generic; diff --git a/docs/Code/Window.cs b/docs/Code/Window.cs index 882153a..853d195 100644 --- a/docs/Code/Window.cs +++ b/docs/Code/Window.cs @@ -1,8 +1,8 @@ /// Author : Maxime Rohmer -/// Date : 30/05/2023 +/// Date : 09/06/2023 /// File : Window.cs /// Brief : Default Window object that is mainly expected to be inherited. -/// Version : Alpha 1.0 +/// Version : Beta 1.0 using System; using System.Collections.Generic; diff --git a/docs/Code/Zone.cs b/docs/Code/Zone.cs index 5a06a22..8ac3598 100644 --- a/docs/Code/Zone.cs +++ b/docs/Code/Zone.cs @@ -1,8 +1,8 @@ /// Author : Maxime Rohmer -/// Date : 30/05/2023 +/// Date : 09/06/2023 /// File : Zone.cs /// 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.Collections.Generic;