diff --git a/Beta/FS22Companion.exe b/Beta/FS22Companion.exe deleted file mode 100644 index 72ab600..0000000 Binary files a/Beta/FS22Companion.exe and /dev/null differ diff --git a/FS22Companion/CustomMessageBox.cs b/FS22Companion/CustomMessageBox.cs index 987ccfa..d029799 100644 --- a/FS22Companion/CustomMessageBox.cs +++ b/FS22Companion/CustomMessageBox.cs @@ -44,7 +44,7 @@ public CustomMessageBox(string message) } else { - this.Width = (int)sizeOfString.Width + 40; + this.Width = (int)sizeOfString.Width + 50; label1.Width = this.Width; } diff --git a/FS22Companion/FS22Companion.csproj b/FS22Companion/FS22Companion.csproj index 846e0ff..bb355cb 100644 --- a/FS22Companion/FS22Companion.csproj +++ b/FS22Companion/FS22Companion.csproj @@ -17,6 +17,7 @@ + @@ -25,6 +26,11 @@ True Resources.resx + + True + True + Settings.settings + @@ -36,8 +42,9 @@ - + + @@ -46,6 +53,7 @@ + @@ -54,4 +62,11 @@ + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + \ No newline at end of file diff --git a/FS22Companion/FS22Companion.csproj.user b/FS22Companion/FS22Companion.csproj.user index f37db86..6a80728 100644 --- a/FS22Companion/FS22Companion.csproj.user +++ b/FS22Companion/FS22Companion.csproj.user @@ -4,7 +4,7 @@ Form - + Form diff --git a/FS22Companion/GameSettingsManager.Designer.cs b/FS22Companion/GameSettingsManager.Designer.cs new file mode 100644 index 0000000..9a99892 --- /dev/null +++ b/FS22Companion/GameSettingsManager.Designer.cs @@ -0,0 +1,473 @@ + +namespace FS22Companion +{ + partial class GameSettingsManager + { + /// + /// 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.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel(); + this.addGameSettingsButton = new Guna.UI2.WinForms.Guna2Button(); + this.label1 = new System.Windows.Forms.Label(); + this.settingPanel = new System.Windows.Forms.Panel(); + this.modDirectoryOverrideCheckBox = new Guna.UI2.WinForms.Guna2CheckBox(); + this.deleteGameSettingButton = new Guna.UI2.WinForms.Guna2Button(); + this.modFolderButton = new FontAwesome.Sharp.IconButton(); + this.label6 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.settingNameTextBox = new Guna.UI2.WinForms.Guna2TextBox(); + this.saveSettingButton = new Guna.UI2.WinForms.Guna2Button(); + this.serverPasswordTextBox = new Guna.UI2.WinForms.Guna2TextBox(); + this.serverNameTextBox = new Guna.UI2.WinForms.Guna2TextBox(); + this.usernameTextBox = new Guna.UI2.WinForms.Guna2TextBox(); + this.modFolderTextBox = new Guna.UI2.WinForms.Guna2TextBox(); + this.backwardButton = new FontAwesome.Sharp.IconButton(); + this.settingPanel.SuspendLayout(); + this.SuspendLayout(); + // + // flowLayoutPanel + // + this.flowLayoutPanel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(31)))), ((int)(((byte)(42)))), ((int)(((byte)(48))))); + this.flowLayoutPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.flowLayoutPanel.Location = new System.Drawing.Point(411, 36); + this.flowLayoutPanel.Name = "flowLayoutPanel"; + this.flowLayoutPanel.Size = new System.Drawing.Size(200, 434); + this.flowLayoutPanel.TabIndex = 0; + // + // addGameSettingsButton + // + this.addGameSettingsButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(31)))), ((int)(((byte)(42)))), ((int)(((byte)(48))))); + this.addGameSettingsButton.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.addGameSettingsButton.BorderThickness = 1; + this.addGameSettingsButton.CheckedState.Parent = this.addGameSettingsButton; + this.addGameSettingsButton.CustomImages.Parent = this.addGameSettingsButton; + this.addGameSettingsButton.DisabledState.BorderColor = System.Drawing.Color.DarkGray; + this.addGameSettingsButton.DisabledState.CustomBorderColor = System.Drawing.Color.DarkGray; + this.addGameSettingsButton.DisabledState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(169)))), ((int)(((byte)(169)))), ((int)(((byte)(169))))); + this.addGameSettingsButton.DisabledState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(141)))), ((int)(((byte)(141)))), ((int)(((byte)(141))))); + this.addGameSettingsButton.DisabledState.Parent = this.addGameSettingsButton; + this.addGameSettingsButton.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(31)))), ((int)(((byte)(42)))), ((int)(((byte)(48))))); + this.addGameSettingsButton.Font = new System.Drawing.Font("Segoe UI", 12F); + this.addGameSettingsButton.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.addGameSettingsButton.HoverState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.addGameSettingsButton.HoverState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); + this.addGameSettingsButton.HoverState.Parent = this.addGameSettingsButton; + this.addGameSettingsButton.Location = new System.Drawing.Point(411, 1); + this.addGameSettingsButton.Name = "addGameSettingsButton"; + this.addGameSettingsButton.ShadowDecoration.Parent = this.addGameSettingsButton; + this.addGameSettingsButton.Size = new System.Drawing.Size(200, 35); + this.addGameSettingsButton.TabIndex = 8; + this.addGameSettingsButton.Text = "Add Game Setting"; + this.addGameSettingsButton.Click += new System.EventHandler(this.addGameSettingsButton_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); + this.label1.Location = new System.Drawing.Point(43, 202); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(333, 63); + this.label1.TabIndex = 9; + this.label1.Text = "Select or add a new Game Setting!\r\n\r\nJoin a MP server atleast once before using t" + + "his."; + // + // settingPanel + // + this.settingPanel.Controls.Add(this.backwardButton); + this.settingPanel.Controls.Add(this.modDirectoryOverrideCheckBox); + this.settingPanel.Controls.Add(this.deleteGameSettingButton); + this.settingPanel.Controls.Add(this.modFolderButton); + this.settingPanel.Controls.Add(this.label6); + this.settingPanel.Controls.Add(this.label5); + this.settingPanel.Controls.Add(this.label4); + this.settingPanel.Controls.Add(this.label3); + this.settingPanel.Controls.Add(this.label2); + this.settingPanel.Controls.Add(this.settingNameTextBox); + this.settingPanel.Controls.Add(this.saveSettingButton); + this.settingPanel.Controls.Add(this.serverPasswordTextBox); + this.settingPanel.Controls.Add(this.serverNameTextBox); + this.settingPanel.Controls.Add(this.usernameTextBox); + this.settingPanel.Controls.Add(this.modFolderTextBox); + this.settingPanel.Location = new System.Drawing.Point(12, 12); + this.settingPanel.Name = "settingPanel"; + this.settingPanel.Size = new System.Drawing.Size(393, 446); + this.settingPanel.TabIndex = 10; + this.settingPanel.Visible = false; + // + // modDirectoryOverrideCheckBox + // + this.modDirectoryOverrideCheckBox.Animated = true; + this.modDirectoryOverrideCheckBox.AutoSize = true; + this.modDirectoryOverrideCheckBox.Checked = true; + this.modDirectoryOverrideCheckBox.CheckedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(125)))), ((int)(((byte)(137)))), ((int)(((byte)(149))))); + this.modDirectoryOverrideCheckBox.CheckedState.BorderRadius = 0; + this.modDirectoryOverrideCheckBox.CheckedState.BorderThickness = 0; + this.modDirectoryOverrideCheckBox.CheckedState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(125)))), ((int)(((byte)(137)))), ((int)(((byte)(149))))); + this.modDirectoryOverrideCheckBox.CheckMarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.modDirectoryOverrideCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; + this.modDirectoryOverrideCheckBox.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.modDirectoryOverrideCheckBox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.modDirectoryOverrideCheckBox.Location = new System.Drawing.Point(76, 105); + this.modDirectoryOverrideCheckBox.Name = "modDirectoryOverrideCheckBox"; + this.modDirectoryOverrideCheckBox.Size = new System.Drawing.Size(194, 25); + this.modDirectoryOverrideCheckBox.TabIndex = 21; + this.modDirectoryOverrideCheckBox.Text = "Mod Directory Override"; + this.modDirectoryOverrideCheckBox.UncheckedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(125)))), ((int)(((byte)(137)))), ((int)(((byte)(149))))); + this.modDirectoryOverrideCheckBox.UncheckedState.BorderRadius = 0; + this.modDirectoryOverrideCheckBox.UncheckedState.BorderThickness = 0; + this.modDirectoryOverrideCheckBox.UncheckedState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(125)))), ((int)(((byte)(137)))), ((int)(((byte)(149))))); + // + // deleteGameSettingButton + // + this.deleteGameSettingButton.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.deleteGameSettingButton.BorderRadius = 7; + this.deleteGameSettingButton.BorderThickness = 1; + this.deleteGameSettingButton.CheckedState.Parent = this.deleteGameSettingButton; + this.deleteGameSettingButton.CustomImages.Parent = this.deleteGameSettingButton; + this.deleteGameSettingButton.DisabledState.BorderColor = System.Drawing.Color.DarkGray; + this.deleteGameSettingButton.DisabledState.CustomBorderColor = System.Drawing.Color.DarkGray; + this.deleteGameSettingButton.DisabledState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(169)))), ((int)(((byte)(169)))), ((int)(((byte)(169))))); + this.deleteGameSettingButton.DisabledState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(141)))), ((int)(((byte)(141)))), ((int)(((byte)(141))))); + this.deleteGameSettingButton.DisabledState.Parent = this.deleteGameSettingButton; + this.deleteGameSettingButton.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); + this.deleteGameSettingButton.Font = new System.Drawing.Font("Segoe UI", 12F); + this.deleteGameSettingButton.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.deleteGameSettingButton.HoverState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.deleteGameSettingButton.HoverState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); + this.deleteGameSettingButton.HoverState.Parent = this.deleteGameSettingButton; + this.deleteGameSettingButton.Location = new System.Drawing.Point(151, 372); + this.deleteGameSettingButton.Name = "deleteGameSettingButton"; + this.deleteGameSettingButton.ShadowDecoration.Parent = this.deleteGameSettingButton; + this.deleteGameSettingButton.Size = new System.Drawing.Size(76, 29); + this.deleteGameSettingButton.TabIndex = 19; + this.deleteGameSettingButton.Text = "Delete"; + this.deleteGameSettingButton.Click += new System.EventHandler(this.deleteGameSettingButton_Click); + // + // modFolderButton + // + this.modFolderButton.FlatAppearance.BorderSize = 0; + this.modFolderButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.modFolderButton.IconChar = FontAwesome.Sharp.IconChar.FolderOpen; + this.modFolderButton.IconColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.modFolderButton.IconFont = FontAwesome.Sharp.IconFont.Auto; + this.modFolderButton.IconSize = 38; + this.modFolderButton.Location = new System.Drawing.Point(317, 158); + this.modFolderButton.Name = "modFolderButton"; + this.modFolderButton.Size = new System.Drawing.Size(34, 29); + this.modFolderButton.TabIndex = 18; + this.modFolderButton.UseVisualStyleBackColor = true; + this.modFolderButton.Click += new System.EventHandler(this.modFolderButton_Click); + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.label6.Location = new System.Drawing.Point(72, 311); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(125, 21); + this.label6.TabIndex = 17; + this.label6.Text = "Server Password"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.label5.Location = new System.Drawing.Point(72, 254); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(101, 21); + this.label5.TabIndex = 16; + this.label5.Text = "Server Name"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.label4.Location = new System.Drawing.Point(72, 195); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(81, 21); + this.label4.TabIndex = 15; + this.label4.Text = "Username"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.label3.Location = new System.Drawing.Point(72, 133); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(90, 21); + this.label3.TabIndex = 14; + this.label3.Text = "Mod Folder"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.label2.Location = new System.Drawing.Point(72, 40); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(105, 21); + this.label2.TabIndex = 13; + this.label2.Text = "Setting Name"; + // + // settingNameTextBox + // + this.settingNameTextBox.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.settingNameTextBox.BorderRadius = 7; + this.settingNameTextBox.Cursor = System.Windows.Forms.Cursors.IBeam; + this.settingNameTextBox.DefaultText = ""; + this.settingNameTextBox.DisabledState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(208)))), ((int)(((byte)(208)))), ((int)(((byte)(208))))); + this.settingNameTextBox.DisabledState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(226)))), ((int)(((byte)(226)))), ((int)(((byte)(226))))); + this.settingNameTextBox.DisabledState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(138)))), ((int)(((byte)(138)))), ((int)(((byte)(138))))); + this.settingNameTextBox.DisabledState.Parent = this.settingNameTextBox; + this.settingNameTextBox.DisabledState.PlaceholderForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(138)))), ((int)(((byte)(138)))), ((int)(((byte)(138))))); + this.settingNameTextBox.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); + this.settingNameTextBox.FocusedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); + this.settingNameTextBox.FocusedState.Parent = this.settingNameTextBox; + this.settingNameTextBox.Font = new System.Drawing.Font("Segoe UI", 12F); + this.settingNameTextBox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.settingNameTextBox.HoverState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); + this.settingNameTextBox.HoverState.Parent = this.settingNameTextBox; + this.settingNameTextBox.Location = new System.Drawing.Point(69, 65); + this.settingNameTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.settingNameTextBox.Name = "settingNameTextBox"; + this.settingNameTextBox.PasswordChar = '\0'; + this.settingNameTextBox.PlaceholderForeColor = System.Drawing.Color.Gray; + this.settingNameTextBox.PlaceholderText = "Setting Name"; + this.settingNameTextBox.SelectedText = ""; + this.settingNameTextBox.ShadowDecoration.Parent = this.settingNameTextBox; + this.settingNameTextBox.Size = new System.Drawing.Size(240, 29); + this.settingNameTextBox.TabIndex = 12; + // + // saveSettingButton + // + this.saveSettingButton.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.saveSettingButton.BorderRadius = 7; + this.saveSettingButton.BorderThickness = 1; + this.saveSettingButton.CheckedState.Parent = this.saveSettingButton; + this.saveSettingButton.CustomImages.Parent = this.saveSettingButton; + this.saveSettingButton.DisabledState.BorderColor = System.Drawing.Color.DarkGray; + this.saveSettingButton.DisabledState.CustomBorderColor = System.Drawing.Color.DarkGray; + this.saveSettingButton.DisabledState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(169)))), ((int)(((byte)(169)))), ((int)(((byte)(169))))); + this.saveSettingButton.DisabledState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(141)))), ((int)(((byte)(141)))), ((int)(((byte)(141))))); + this.saveSettingButton.DisabledState.Parent = this.saveSettingButton; + this.saveSettingButton.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); + this.saveSettingButton.Font = new System.Drawing.Font("Segoe UI", 12F); + this.saveSettingButton.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.saveSettingButton.HoverState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.saveSettingButton.HoverState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); + this.saveSettingButton.HoverState.Parent = this.saveSettingButton; + this.saveSettingButton.Location = new System.Drawing.Point(233, 372); + this.saveSettingButton.Name = "saveSettingButton"; + this.saveSettingButton.ShadowDecoration.Parent = this.saveSettingButton; + this.saveSettingButton.Size = new System.Drawing.Size(76, 29); + this.saveSettingButton.TabIndex = 11; + this.saveSettingButton.Text = "Apply"; + this.saveSettingButton.Click += new System.EventHandler(this.saveSettingButton_Click); + // + // serverPasswordTextBox + // + this.serverPasswordTextBox.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.serverPasswordTextBox.BorderRadius = 7; + this.serverPasswordTextBox.Cursor = System.Windows.Forms.Cursors.IBeam; + this.serverPasswordTextBox.DefaultText = ""; + this.serverPasswordTextBox.DisabledState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(208)))), ((int)(((byte)(208)))), ((int)(((byte)(208))))); + this.serverPasswordTextBox.DisabledState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(226)))), ((int)(((byte)(226)))), ((int)(((byte)(226))))); + this.serverPasswordTextBox.DisabledState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(138)))), ((int)(((byte)(138)))), ((int)(((byte)(138))))); + this.serverPasswordTextBox.DisabledState.Parent = this.serverPasswordTextBox; + this.serverPasswordTextBox.DisabledState.PlaceholderForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(138)))), ((int)(((byte)(138)))), ((int)(((byte)(138))))); + this.serverPasswordTextBox.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); + this.serverPasswordTextBox.FocusedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); + this.serverPasswordTextBox.FocusedState.Parent = this.serverPasswordTextBox; + this.serverPasswordTextBox.Font = new System.Drawing.Font("Segoe UI", 12F); + this.serverPasswordTextBox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.serverPasswordTextBox.HoverState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); + this.serverPasswordTextBox.HoverState.Parent = this.serverPasswordTextBox; + this.serverPasswordTextBox.Location = new System.Drawing.Point(69, 336); + this.serverPasswordTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.serverPasswordTextBox.Name = "serverPasswordTextBox"; + this.serverPasswordTextBox.PasswordChar = '\0'; + this.serverPasswordTextBox.PlaceholderForeColor = System.Drawing.Color.Gray; + this.serverPasswordTextBox.PlaceholderText = "Server Password"; + this.serverPasswordTextBox.SelectedText = ""; + this.serverPasswordTextBox.ShadowDecoration.Parent = this.serverPasswordTextBox; + this.serverPasswordTextBox.Size = new System.Drawing.Size(240, 29); + this.serverPasswordTextBox.TabIndex = 11; + // + // serverNameTextBox + // + this.serverNameTextBox.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.serverNameTextBox.BorderRadius = 7; + this.serverNameTextBox.Cursor = System.Windows.Forms.Cursors.IBeam; + this.serverNameTextBox.DefaultText = ""; + this.serverNameTextBox.DisabledState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(208)))), ((int)(((byte)(208)))), ((int)(((byte)(208))))); + this.serverNameTextBox.DisabledState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(226)))), ((int)(((byte)(226)))), ((int)(((byte)(226))))); + this.serverNameTextBox.DisabledState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(138)))), ((int)(((byte)(138)))), ((int)(((byte)(138))))); + this.serverNameTextBox.DisabledState.Parent = this.serverNameTextBox; + this.serverNameTextBox.DisabledState.PlaceholderForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(138)))), ((int)(((byte)(138)))), ((int)(((byte)(138))))); + this.serverNameTextBox.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); + this.serverNameTextBox.FocusedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); + this.serverNameTextBox.FocusedState.Parent = this.serverNameTextBox; + this.serverNameTextBox.Font = new System.Drawing.Font("Segoe UI", 12F); + this.serverNameTextBox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.serverNameTextBox.HoverState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); + this.serverNameTextBox.HoverState.Parent = this.serverNameTextBox; + this.serverNameTextBox.Location = new System.Drawing.Point(69, 279); + this.serverNameTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.serverNameTextBox.Name = "serverNameTextBox"; + this.serverNameTextBox.PasswordChar = '\0'; + this.serverNameTextBox.PlaceholderForeColor = System.Drawing.Color.Gray; + this.serverNameTextBox.PlaceholderText = "Server Name"; + this.serverNameTextBox.SelectedText = ""; + this.serverNameTextBox.ShadowDecoration.Parent = this.serverNameTextBox; + this.serverNameTextBox.Size = new System.Drawing.Size(240, 29); + this.serverNameTextBox.TabIndex = 10; + // + // usernameTextBox + // + this.usernameTextBox.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.usernameTextBox.BorderRadius = 7; + this.usernameTextBox.Cursor = System.Windows.Forms.Cursors.IBeam; + this.usernameTextBox.DefaultText = ""; + this.usernameTextBox.DisabledState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(208)))), ((int)(((byte)(208)))), ((int)(((byte)(208))))); + this.usernameTextBox.DisabledState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(226)))), ((int)(((byte)(226)))), ((int)(((byte)(226))))); + this.usernameTextBox.DisabledState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(138)))), ((int)(((byte)(138)))), ((int)(((byte)(138))))); + this.usernameTextBox.DisabledState.Parent = this.usernameTextBox; + this.usernameTextBox.DisabledState.PlaceholderForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(138)))), ((int)(((byte)(138)))), ((int)(((byte)(138))))); + this.usernameTextBox.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); + this.usernameTextBox.FocusedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); + this.usernameTextBox.FocusedState.Parent = this.usernameTextBox; + this.usernameTextBox.Font = new System.Drawing.Font("Segoe UI", 12F); + this.usernameTextBox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.usernameTextBox.HoverState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); + this.usernameTextBox.HoverState.Parent = this.usernameTextBox; + this.usernameTextBox.Location = new System.Drawing.Point(69, 220); + this.usernameTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.usernameTextBox.Name = "usernameTextBox"; + this.usernameTextBox.PasswordChar = '\0'; + this.usernameTextBox.PlaceholderForeColor = System.Drawing.Color.Gray; + this.usernameTextBox.PlaceholderText = "Username"; + this.usernameTextBox.SelectedText = ""; + this.usernameTextBox.ShadowDecoration.Parent = this.usernameTextBox; + this.usernameTextBox.Size = new System.Drawing.Size(240, 29); + this.usernameTextBox.TabIndex = 9; + // + // modFolderTextBox + // + this.modFolderTextBox.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.modFolderTextBox.BorderRadius = 7; + this.modFolderTextBox.Cursor = System.Windows.Forms.Cursors.IBeam; + this.modFolderTextBox.DefaultText = ""; + this.modFolderTextBox.DisabledState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(208)))), ((int)(((byte)(208)))), ((int)(((byte)(208))))); + this.modFolderTextBox.DisabledState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(226)))), ((int)(((byte)(226)))), ((int)(((byte)(226))))); + this.modFolderTextBox.DisabledState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(138)))), ((int)(((byte)(138)))), ((int)(((byte)(138))))); + this.modFolderTextBox.DisabledState.Parent = this.modFolderTextBox; + this.modFolderTextBox.DisabledState.PlaceholderForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(138)))), ((int)(((byte)(138)))), ((int)(((byte)(138))))); + this.modFolderTextBox.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); + this.modFolderTextBox.FocusedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); + this.modFolderTextBox.FocusedState.Parent = this.modFolderTextBox; + this.modFolderTextBox.Font = new System.Drawing.Font("Segoe UI", 12F); + this.modFolderTextBox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.modFolderTextBox.HoverState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); + this.modFolderTextBox.HoverState.Parent = this.modFolderTextBox; + this.modFolderTextBox.Location = new System.Drawing.Point(69, 158); + this.modFolderTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.modFolderTextBox.Name = "modFolderTextBox"; + this.modFolderTextBox.PasswordChar = '\0'; + this.modFolderTextBox.PlaceholderForeColor = System.Drawing.Color.Gray; + this.modFolderTextBox.PlaceholderText = "Mod Folder"; + this.modFolderTextBox.SelectedText = ""; + this.modFolderTextBox.ShadowDecoration.Parent = this.modFolderTextBox; + this.modFolderTextBox.Size = new System.Drawing.Size(240, 29); + this.modFolderTextBox.TabIndex = 8; + // + // backwardButton + // + this.backwardButton.FlatAppearance.BorderSize = 0; + this.backwardButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.backwardButton.IconChar = FontAwesome.Sharp.IconChar.Backward; + this.backwardButton.IconColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.backwardButton.IconFont = FontAwesome.Sharp.IconFont.Auto; + this.backwardButton.IconSize = 35; + this.backwardButton.Location = new System.Drawing.Point(3, 3); + this.backwardButton.Name = "backwardButton"; + this.backwardButton.Padding = new System.Windows.Forms.Padding(0, 5, 0, 0); + this.backwardButton.Size = new System.Drawing.Size(37, 31); + this.backwardButton.TabIndex = 22; + this.backwardButton.UseVisualStyleBackColor = true; + this.backwardButton.Click += new System.EventHandler(this.backwardButton_Click); + // + // GameSettingsManager + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); + this.ClientSize = new System.Drawing.Size(612, 470); + this.Controls.Add(this.settingPanel); + this.Controls.Add(this.label1); + this.Controls.Add(this.addGameSettingsButton); + this.Controls.Add(this.flowLayoutPanel); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Name = "GameSettingsManager"; + this.Text = "GameSaveManager"; + this.Load += new System.EventHandler(this.GameSettingsManager_Load); + this.settingPanel.ResumeLayout(false); + this.settingPanel.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel; + private Guna.UI2.WinForms.Guna2Button addGameSettingsButton; + public System.Windows.Forms.Label label1; + private Guna.UI2.WinForms.Guna2Button saveSettingButton; + private Guna.UI2.WinForms.Guna2TextBox serverPasswordTextBox; + private Guna.UI2.WinForms.Guna2TextBox serverNameTextBox; + private Guna.UI2.WinForms.Guna2TextBox usernameTextBox; + private Guna.UI2.WinForms.Guna2TextBox modFolderTextBox; + private Guna.UI2.WinForms.Guna2TextBox settingNameTextBox; + public System.Windows.Forms.Panel settingPanel; + private FontAwesome.Sharp.IconButton modFolderButton; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label2; + private Guna.UI2.WinForms.Guna2Button deleteGameSettingButton; + private Guna.UI2.WinForms.Guna2CheckBox modDirectoryOverrideCheckBox; + private FontAwesome.Sharp.IconButton backwardButton; + } +} \ No newline at end of file diff --git a/FS22Companion/GameSettingsManager.cs b/FS22Companion/GameSettingsManager.cs new file mode 100644 index 0000000..79c9bf2 --- /dev/null +++ b/FS22Companion/GameSettingsManager.cs @@ -0,0 +1,218 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Collections.Specialized; +using System.Collections; +using Guna.UI2.WinForms; +using Newtonsoft.Json; +using System.Xml.Serialization; +using System.IO; +using System.Xml.Linq; + +namespace FS22Companion +{ + public partial class GameSettingsManager : Form + { + public Dictionary gameSettingsCollection; + GameSetting selectedSetting; + string modFolder; + + public GameSettingsManager() + { + InitializeComponent(); + } + + private void GameSettingsManager_Load(object sender, EventArgs e) + { + gameSettingsCollection = JsonConvert.DeserializeObject>(Properties.Settings.Default.GameSettingsDictionary); + + if (gameSettingsCollection == null) + gameSettingsCollection = new Dictionary(); + + XmlSerializer serializer = new XmlSerializer(typeof(GameSetting)); + var gameSetting = new GameSetting(); + using (Stream stream = new FileStream(Properties.Settings.Default.GameSettingsPath + "\\gameSettings.xml", FileMode.Open)) + { + gameSetting = (GameSetting)serializer.Deserialize(stream); + gameSetting.Name = "Current Setting"; + } + gameSettingsCollection["Current Setting"] = gameSetting; + //MessageBox.Show(JsonConvert.SerializeObject(i)); + + UpdateDictionaryEntries(); + } + + public void UpdateDictionaryEntries() + { + flowLayoutPanel.Controls.Clear(); + foreach (var entry in gameSettingsCollection) + { + GameSetting gameSetting = entry.Value; + + Guna2Button entryLabel = new Guna2Button(); + entryLabel.Text = gameSetting.Name; + entryLabel.Name = gameSetting.Name; + entryLabel.Font = new Font("Segoe UI", 12F); + entryLabel.ForeColor = Color.FromArgb(57, 187, 223); + entryLabel.FillColor = Color.FromArgb(31, 42, 48); + entryLabel.AutoSize = false; + entryLabel.Size = new Size(195, 35); + entryLabel.HoverState.FillColor = Color.FromArgb(57, 187, 223); + entryLabel.HoverState.ForeColor = Color.FromArgb(31, 42, 48); + + entryLabel.Click += (sender, e) => + { + selectedSetting = gameSetting; + ShowSettingPanel(gameSetting); + }; + + flowLayoutPanel.Controls.Add(entryLabel); + } + } + + public void ShowSettingPanel(GameSetting setting) + { + settingNameTextBox.Text = setting.Name; + modDirectoryOverrideCheckBox.Checked = setting.modsDirectoryOverride.active; + modFolderTextBox.Text = setting.modsDirectoryOverride.directory; + usernameTextBox.Text = setting.onlinePresenceName; + serverNameTextBox.Text = setting.joinGame.serverName; + serverPasswordTextBox.Text = setting.joinGame.password; + settingPanel.Show(); + } + + private void addGameSettingsButton_Click(object sender, EventArgs e) + { + if(gameSettingsCollection.ContainsKey("New Setting")) + { + CustomMessageBox.Show("\"New Setting\" already exists!", MessageBoxButtons.OK); + } + else + { + var gameSetting = new GameSetting("New Setting", true, "", "", "", ""); + gameSettingsCollection.Add("New Setting", gameSetting); + Properties.Settings.Default.GameSettingsDictionary = JsonConvert.SerializeObject(gameSettingsCollection); + Properties.Settings.Default.Save(); + UpdateDictionaryEntries(); + } + } + + private void saveSettingButton_Click(object sender, EventArgs e) + { + if (CustomMessageBox.Show("Are you sure?", MessageBoxButtons.YesNo) == DialogResult.Yes) + { + var oldName = selectedSetting.Name; + gameSettingsCollection.Remove(oldName); + selectedSetting = new GameSetting(settingNameTextBox.Text, modDirectoryOverrideCheckBox.Checked, modFolderTextBox.Text, usernameTextBox.Text, serverNameTextBox.Text, serverPasswordTextBox.Text); + gameSettingsCollection[selectedSetting.Name] = selectedSetting; + Properties.Settings.Default.GameSettingsDictionary = JsonConvert.SerializeObject(gameSettingsCollection); + Properties.Settings.Default.Save(); + settingPanel.Hide(); + + XDocument doc = new XDocument(); + using (Stream stream = new FileStream(Properties.Settings.Default.GameSettingsPath + "\\gameSettings.xml", FileMode.Open)) + { + doc = XDocument.Load(stream); + doc.Root.Element((XName)"modsDirectoryOverride").Attribute((XName)"active").SetValue(modDirectoryOverrideCheckBox.Checked); + doc.Root.Element((XName)"modsDirectoryOverride").Attribute((XName)"directory").Value = modFolderTextBox.Text; + doc.Root.Element((XName)"onlinePresenceName").Value = usernameTextBox.Text; + doc.Root.Element((XName)"joinGame").Attribute((XName)"serverName").Value = serverNameTextBox.Text; + doc.Root.Element((XName)"joinGame").Attribute((XName)"password").Value = serverPasswordTextBox.Text; + } + doc.Save(Properties.Settings.Default.GameSettingsPath + "\\gameSettings.xml"); + + XmlSerializer serializer = new XmlSerializer(typeof(GameSetting)); + var gameSetting = new GameSetting(); + using (Stream stream = new FileStream(Properties.Settings.Default.GameSettingsPath + "\\gameSettings.xml", FileMode.Open)) + { + gameSetting = (GameSetting)serializer.Deserialize(stream); + gameSetting.Name = "Current Setting"; + } + gameSettingsCollection["Current Setting"] = gameSetting; + + UpdateDictionaryEntries(); + } + } + + private void modFolderButton_Click(object sender, EventArgs e) + { + FolderBrowserDialog browserDialog = new FolderBrowserDialog(); + if (!String.IsNullOrEmpty(modFolder)) + browserDialog.SelectedPath = modFolder; + if(browserDialog.ShowDialog() == DialogResult.OK) + { + modFolder = browserDialog.SelectedPath; + modFolderTextBox.Text = modFolder; + modFolderTextBox.Select(modFolderTextBox.Text.Length, 0); + } + } + + private void deleteGameSettingButton_Click(object sender, EventArgs e) + { + if(selectedSetting.Name == "Current Setting") + { + CustomMessageBox.Show("Current Setting can't be deleted", MessageBoxButtons.OK); + } + else if (CustomMessageBox.Show("Are you sure?", MessageBoxButtons.YesNo) == DialogResult.Yes) + { + gameSettingsCollection.Remove(selectedSetting.Name); + Properties.Settings.Default.GameSettingsDictionary = JsonConvert.SerializeObject(gameSettingsCollection); + Properties.Settings.Default.Save(); + settingPanel.Hide(); + UpdateDictionaryEntries(); + } + } + + private void backwardButton_Click(object sender, EventArgs e) + { + settingPanel.Hide(); + } + } + + [XmlRoot("gameSettings"), XmlType("gameSettings")] + public class GameSetting + { + public modsDirectoryOverride modsDirectoryOverride { get; set; } + public string onlinePresenceName { get; set; } + public joinGame joinGame { get; set; } + public string Name { get; set; } + + public GameSetting(string name, bool modDirectoryOverride, string modFolderPath, string username, string serverName, string serverPassword) + { + Name = name; + modsDirectoryOverride = new modsDirectoryOverride(); + modsDirectoryOverride.active = modDirectoryOverride; + modsDirectoryOverride.directory = modFolderPath; + onlinePresenceName = username; + joinGame = new joinGame(); + joinGame.serverName = serverName; + joinGame.password = serverPassword; + } + public GameSetting() + { + + } + } + + public class joinGame + { + [XmlAttribute] + public string serverName { get; set; } + [XmlAttribute] + public string password { get; set; } + } + + public class modsDirectoryOverride + { + [XmlAttribute] + public bool active { get; set; } + [XmlAttribute] + public string directory { get; set; } + } +} diff --git a/FS22Companion/GameSettingsManager.resx b/FS22Companion/GameSettingsManager.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/FS22Companion/GameSettingsManager.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/FS22Companion/Home.Designer.cs b/FS22Companion/Home.Designer.cs index 1639baf..607ae1c 100644 --- a/FS22Companion/Home.Designer.cs +++ b/FS22Companion/Home.Designer.cs @@ -32,9 +32,10 @@ private void InitializeComponent() System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Home)); this.label1 = new System.Windows.Forms.Label(); this.gameStatusButton = new Guna.UI2.WinForms.Guna2Button(); - this.iconPictureBox1 = new FontAwesome.Sharp.IconPictureBox(); this.githubButton = new Guna.UI2.WinForms.Guna2Button(); this.discordButton = new Guna.UI2.WinForms.Guna2Button(); + this.label2 = new System.Windows.Forms.Label(); + this.iconPictureBox1 = new FontAwesome.Sharp.IconPictureBox(); ((System.ComponentModel.ISupportInitialize)(this.iconPictureBox1)).BeginInit(); this.SuspendLayout(); // @@ -45,7 +46,7 @@ private void InitializeComponent() this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); this.label1.Location = new System.Drawing.Point(26, 24); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(460, 231); + this.label1.Size = new System.Drawing.Size(460, 378); this.label1.TabIndex = 1; this.label1.Text = resources.GetString("label1.Text"); // @@ -64,27 +65,13 @@ private void InitializeComponent() this.gameStatusButton.Font = new System.Drawing.Font("Segoe UI", 9F); this.gameStatusButton.ForeColor = System.Drawing.Color.Black; this.gameStatusButton.HoverState.Parent = this.gameStatusButton; - this.gameStatusButton.Location = new System.Drawing.Point(12, 353); + this.gameStatusButton.Location = new System.Drawing.Point(12, 434); this.gameStatusButton.Name = "gameStatusButton"; this.gameStatusButton.ShadowDecoration.Parent = this.gameStatusButton; this.gameStatusButton.Size = new System.Drawing.Size(122, 25); this.gameStatusButton.TabIndex = 2; this.gameStatusButton.Text = "gameStatus"; // - // iconPictureBox1 - // - this.iconPictureBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); - this.iconPictureBox1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); - this.iconPictureBox1.IconChar = FontAwesome.Sharp.IconChar.Tractor; - this.iconPictureBox1.IconColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); - this.iconPictureBox1.IconFont = FontAwesome.Sharp.IconFont.Auto; - this.iconPictureBox1.IconSize = 78; - this.iconPictureBox1.Location = new System.Drawing.Point(520, 317); - this.iconPictureBox1.Name = "iconPictureBox1"; - this.iconPictureBox1.Size = new System.Drawing.Size(80, 78); - this.iconPictureBox1.TabIndex = 0; - this.iconPictureBox1.TabStop = false; - // // githubButton // this.githubButton.BackColor = System.Drawing.Color.Transparent; @@ -104,7 +91,7 @@ private void InitializeComponent() this.githubButton.HoverState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); this.githubButton.HoverState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); this.githubButton.HoverState.Parent = this.githubButton; - this.githubButton.Location = new System.Drawing.Point(342, 349); + this.githubButton.Location = new System.Drawing.Point(360, 430); this.githubButton.Name = "githubButton"; this.githubButton.ShadowDecoration.Parent = this.githubButton; this.githubButton.Size = new System.Drawing.Size(144, 29); @@ -130,7 +117,7 @@ private void InitializeComponent() this.discordButton.HoverState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); this.discordButton.HoverState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); this.discordButton.HoverState.Parent = this.discordButton; - this.discordButton.Location = new System.Drawing.Point(192, 349); + this.discordButton.Location = new System.Drawing.Point(210, 430); this.discordButton.Name = "discordButton"; this.discordButton.ShadowDecoration.Parent = this.discordButton; this.discordButton.Size = new System.Drawing.Size(144, 29); @@ -138,12 +125,38 @@ private void InitializeComponent() this.discordButton.Text = "Join Discord"; this.discordButton.Click += new System.EventHandler(this.discordButton_Click); // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); + this.label2.Location = new System.Drawing.Point(146, 434); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(51, 21); + this.label2.TabIndex = 12; + this.label2.Text = "v1.1.0"; + // + // iconPictureBox1 + // + this.iconPictureBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); + this.iconPictureBox1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); + this.iconPictureBox1.IconChar = FontAwesome.Sharp.IconChar.Tractor; + this.iconPictureBox1.IconColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); + this.iconPictureBox1.IconFont = FontAwesome.Sharp.IconFont.Auto; + this.iconPictureBox1.IconSize = 78; + this.iconPictureBox1.Location = new System.Drawing.Point(520, 395); + this.iconPictureBox1.Name = "iconPictureBox1"; + this.iconPictureBox1.Size = new System.Drawing.Size(80, 78); + this.iconPictureBox1.TabIndex = 0; + this.iconPictureBox1.TabStop = false; + // // Home // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); - this.ClientSize = new System.Drawing.Size(612, 390); + this.ClientSize = new System.Drawing.Size(612, 470); + this.Controls.Add(this.label2); this.Controls.Add(this.githubButton); this.Controls.Add(this.discordButton); this.Controls.Add(this.gameStatusButton); @@ -166,5 +179,6 @@ private void InitializeComponent() public System.Windows.Forms.Label label1; private Guna.UI2.WinForms.Guna2Button githubButton; private Guna.UI2.WinForms.Guna2Button discordButton; + public System.Windows.Forms.Label label2; } } \ No newline at end of file diff --git a/FS22Companion/Home.resx b/FS22Companion/Home.resx index 76f8929..73b0b72 100644 --- a/FS22Companion/Home.resx +++ b/FS22Companion/Home.resx @@ -127,8 +127,15 @@ Menu: - Set Season, Month, Time Scale and the Current Time - GPS (keep your tractor aligned) +Game Settings Manager: + - Create presets for game settings, with custom mod folders + Table: - - Check the best prices for your crops/products + - Check the best prices for your crops/products + +Hotkeys: + - Ins - Bring to top of screen (put the game in Windowed Mode) + - Ctrl + Q - Toggle GPS diff --git a/FS22Companion/MainForm.Designer.cs b/FS22Companion/MainForm.Designer.cs index 900ceb0..3d4944c 100644 --- a/FS22Companion/MainForm.Designer.cs +++ b/FS22Companion/MainForm.Designer.cs @@ -30,18 +30,20 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); this.sidePanel = new System.Windows.Forms.Panel(); - this.pagePanel = new System.Windows.Forms.Panel(); + this.gameSaveManagerButton = new FontAwesome.Sharp.IconButton(); this.homeButton = new FontAwesome.Sharp.IconButton(); this.exitButton = new FontAwesome.Sharp.IconButton(); this.settingsButton = new FontAwesome.Sharp.IconButton(); this.pricesTableButton = new FontAwesome.Sharp.IconButton(); this.menuButton = new FontAwesome.Sharp.IconButton(); + this.pagePanel = new System.Windows.Forms.Panel(); this.sidePanel.SuspendLayout(); this.SuspendLayout(); // // sidePanel // this.sidePanel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(31)))), ((int)(((byte)(42)))), ((int)(((byte)(48))))); + this.sidePanel.Controls.Add(this.gameSaveManagerButton); this.sidePanel.Controls.Add(this.homeButton); this.sidePanel.Controls.Add(this.exitButton); this.sidePanel.Controls.Add(this.settingsButton); @@ -50,16 +52,23 @@ private void InitializeComponent() this.sidePanel.Dock = System.Windows.Forms.DockStyle.Left; this.sidePanel.Location = new System.Drawing.Point(0, 0); this.sidePanel.Name = "sidePanel"; - this.sidePanel.Size = new System.Drawing.Size(74, 390); + this.sidePanel.Size = new System.Drawing.Size(74, 470); this.sidePanel.TabIndex = 0; // - // pagePanel - // - this.pagePanel.Dock = System.Windows.Forms.DockStyle.Fill; - this.pagePanel.Location = new System.Drawing.Point(74, 0); - this.pagePanel.Name = "pagePanel"; - this.pagePanel.Size = new System.Drawing.Size(612, 390); - this.pagePanel.TabIndex = 1; + // gameSaveManagerButton + // + this.gameSaveManagerButton.FlatAppearance.BorderSize = 0; + this.gameSaveManagerButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.gameSaveManagerButton.IconChar = FontAwesome.Sharp.IconChar.Save; + this.gameSaveManagerButton.IconColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); + this.gameSaveManagerButton.IconFont = FontAwesome.Sharp.IconFont.Auto; + this.gameSaveManagerButton.IconSize = 43; + this.gameSaveManagerButton.Location = new System.Drawing.Point(-3, 157); + this.gameSaveManagerButton.Name = "gameSaveManagerButton"; + this.gameSaveManagerButton.Size = new System.Drawing.Size(80, 80); + this.gameSaveManagerButton.TabIndex = 8; + this.gameSaveManagerButton.UseVisualStyleBackColor = true; + this.gameSaveManagerButton.Click += new System.EventHandler(this.gameSaveManagerButton_Click); // // homeButton // @@ -84,7 +93,7 @@ private void InitializeComponent() this.exitButton.IconColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); this.exitButton.IconFont = FontAwesome.Sharp.IconFont.Auto; this.exitButton.IconSize = 43; - this.exitButton.Location = new System.Drawing.Point(-3, 315); + this.exitButton.Location = new System.Drawing.Point(-3, 391); this.exitButton.Name = "exitButton"; this.exitButton.Size = new System.Drawing.Size(80, 80); this.exitButton.TabIndex = 6; @@ -99,7 +108,7 @@ private void InitializeComponent() this.settingsButton.IconColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); this.settingsButton.IconFont = FontAwesome.Sharp.IconFont.Auto; this.settingsButton.IconSize = 43; - this.settingsButton.Location = new System.Drawing.Point(-3, 236); + this.settingsButton.Location = new System.Drawing.Point(-3, 312); this.settingsButton.Name = "settingsButton"; this.settingsButton.Size = new System.Drawing.Size(80, 80); this.settingsButton.TabIndex = 5; @@ -114,7 +123,7 @@ private void InitializeComponent() this.pricesTableButton.IconColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); this.pricesTableButton.IconFont = FontAwesome.Sharp.IconFont.Auto; this.pricesTableButton.IconSize = 43; - this.pricesTableButton.Location = new System.Drawing.Point(-3, 157); + this.pricesTableButton.Location = new System.Drawing.Point(-3, 233); this.pricesTableButton.Name = "pricesTableButton"; this.pricesTableButton.Size = new System.Drawing.Size(80, 80); this.pricesTableButton.TabIndex = 4; @@ -136,12 +145,20 @@ private void InitializeComponent() this.menuButton.UseVisualStyleBackColor = true; this.menuButton.Click += new System.EventHandler(this.menuButton_Click); // + // pagePanel + // + this.pagePanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.pagePanel.Location = new System.Drawing.Point(74, 0); + this.pagePanel.Name = "pagePanel"; + this.pagePanel.Size = new System.Drawing.Size(612, 470); + this.pagePanel.TabIndex = 1; + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); - this.ClientSize = new System.Drawing.Size(686, 390); + this.ClientSize = new System.Drawing.Size(686, 470); this.Controls.Add(this.pagePanel); this.Controls.Add(this.sidePanel); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; @@ -162,6 +179,7 @@ private void InitializeComponent() private FontAwesome.Sharp.IconButton exitButton; private FontAwesome.Sharp.IconButton settingsButton; private FontAwesome.Sharp.IconButton homeButton; + private FontAwesome.Sharp.IconButton gameSaveManagerButton; } } diff --git a/FS22Companion/MainForm.cs b/FS22Companion/MainForm.cs index 78db0c3..49b5890 100644 --- a/FS22Companion/MainForm.cs +++ b/FS22Companion/MainForm.cs @@ -13,6 +13,7 @@ using System.Runtime.InteropServices; using FontAwesome.Sharp; using System.Diagnostics; +using Octokit; namespace FS22Companion { @@ -26,28 +27,49 @@ public partial class MainForm : Form [DllImportAttribute("user32.dll")] public static extern bool ReleaseCapture(); + [DllImport("user32.dll")] + public static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, int vlc); + public Form currentForm; Home home = new Home(); Menu menu = null; + GameSettingsManager gameSettingsManager = new GameSettingsManager(); PricesTable pricesTable = new PricesTable(); Settings settings = new Settings(); IconButton selectedButton; + string version = "1.1.0"; + public MainForm() { InitializeComponent(); sidePanel.MouseMove += dragabbleElement_MouseMove; pagePanel.MouseMove += dragabbleElement_MouseMove; - //iconPictureBox.MouseMove += dragabbleElement_MouseMove; + home.label1.MouseMove += dragabbleElement_MouseMove; + gameSettingsManager.settingPanel.MouseMove += dragabbleElement_MouseMove; + + // Check for updates + CheckVersion(); this.FormClosing += (sender, e) => { if (menu != null && menu.newmem != 0) // checks if the script has been ran - { + {; menu.DisableScript(); } }; + // Game Settings Path + if (Properties.Settings.Default.GameSettingsPath.Length == 0) + { + Properties.Settings.Default.GameSettingsPath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\Documents\\My Games\\FarmingSimulator2022"; + } + settings.gameSettingsFolderTextBox.Text = Properties.Settings.Default.GameSettingsPath; + settings.gameSettingsFolderTextBox.Select(settings.gameSettingsFolderTextBox.Text.Length, 0); + + RegisterHotKey(this.Handle, 1, Constants.NOMOD, (int)Keys.Insert); + RegisterHotKey(this.Handle, 2, Constants.CTRL, (int)Keys.Q); + if (Process.GetProcessesByName("FarmingSimulator2022Game").Length > 0) { home.gameStatusButton.Text = "Game Running"; @@ -67,9 +89,6 @@ public MainForm() this.TopMost = true; }; - LoadForm(home, pagePanel, homeButton); - home.label1.MouseMove += dragabbleElement_MouseMove; - foreach (Control control in sidePanel.Controls) { if (control.GetType() == typeof(IconButton)) @@ -93,6 +112,45 @@ public MainForm() } MemoryFonts.AddMemoryFont(Properties.Resources.helvetica_light); + + LoadForm(home, pagePanel, homeButton); + } + + private void HandleHotkey1() + { + + } + + protected override void WndProc(ref Message m) + { + if (m.Msg == 0x0312) + { + int id = m.WParam.ToInt32(); + + switch (id) + { + case 1: + if (this.Visible && this.TopMost) + { + this.TopMost = false; + this.SendToBack(); + this.WindowState = FormWindowState.Minimized; + } + else + { + this.TopMost = true; + this.Show(); + this.WindowState = FormWindowState.Normal; + this.Focus(); + } + break; + case 2: + menu.activateGPSButton.PerformClick(); + break; + } + } + + base.WndProc(ref m); } private void LoadForm(Form form, Panel panel, IconButton button) @@ -108,6 +166,32 @@ private void LoadForm(Form form, Panel panel, IconButton button) SelectedButton(button); } + public async void CheckVersion() + { + GitHubClient client = new GitHubClient(new ProductHeaderValue("afonsosousah")); + IReadOnlyList releases = await client.Repository.Release.GetAll("afonsosousah", "fs22companion"); + + //Setup the versions + Version latestGitHubVersion = new Version(releases[0].TagName); + Version localVersion = new Version(version); + + int versionComparison = localVersion.CompareTo(latestGitHubVersion); + if (versionComparison < 0) + { + //The version on GitHub is more up to date than this local release. + CustomMessageBox.Show("There is a newer version available on GitHub!", MessageBoxButtons.OK); + } + else if (versionComparison > 0) + { + //This local version is greater than the release version on GitHub. + CustomMessageBox.Show("This is a beta build!", MessageBoxButtons.OK); + } + else + { + //This local Version and the Version on GitHub are equal. + } + } + private void SelectedButton(IconButton button) { foreach(Control control in sidePanel.Controls) @@ -164,6 +248,11 @@ private void menuButton_Click(object sender, EventArgs e) } } + private void gameSaveManagerButton_Click(object sender, EventArgs e) + { + LoadForm(gameSettingsManager, pagePanel, gameSaveManagerButton); + } + private void pricesTableButton_Click(object sender, EventArgs e) { LoadForm(pricesTable, pagePanel, pricesTableButton); @@ -179,4 +268,20 @@ private void exitButton_Click(object sender, EventArgs e) this.Close(); } } + + + public static class Constants + { + //modifiers + public const int NOMOD = 0x0000; + public const int ALT = 0x0001; + public const int CTRL = 0x0002; + public const int SHIFT = 0x0004; + public const int WIN = 0x0008; + + + //windows message id for hotkey + public const int WM_HOTKEY_MSG_ID = 0x0312; + } + } diff --git a/FS22Companion/Menu.Designer.cs b/FS22Companion/Menu.Designer.cs index 5c4e1a1..07bfac1 100644 --- a/FS22Companion/Menu.Designer.cs +++ b/FS22Companion/Menu.Designer.cs @@ -48,15 +48,18 @@ private void InitializeComponent() this.monthLabel = new System.Windows.Forms.Label(); this.monthComboBox = new Guna.UI2.WinForms.Guna2ComboBox(); this.gpsTab = new System.Windows.Forms.TabPage(); + this.snapDirectionCheckBox = new Guna.UI2.WinForms.Guna2CheckBox(); + this.plus270Button = new Guna.UI2.WinForms.Guna2Button(); + this.plus180Button = new Guna.UI2.WinForms.Guna2Button(); + this.plus90Button = new Guna.UI2.WinForms.Guna2Button(); + this.gpsActiveButton = new Guna.UI2.WinForms.Guna2Button(); this.label2 = new System.Windows.Forms.Label(); this.directionLabel = new System.Windows.Forms.Label(); this.isInVehicleButton = new Guna.UI2.WinForms.Guna2Button(); - this.deactivateGPSButton = new Guna.UI2.WinForms.Guna2Button(); this.activateGPSButton = new Guna.UI2.WinForms.Guna2Button(); this.directionTextBox = new Guna.UI2.WinForms.Guna2TextBox(); this.gpsTimer = new System.Windows.Forms.Timer(this.components); this.isInVehicleTimer = new System.Windows.Forms.Timer(this.components); - this.gpsActiveButton = new Guna.UI2.WinForms.Guna2Button(); this.guna2TabControl1.SuspendLayout(); this.moneyTab.SuspendLayout(); this.timeTime.SuspendLayout(); @@ -87,10 +90,10 @@ private void InitializeComponent() this.removeMoneyButton.HoverState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); this.removeMoneyButton.HoverState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); this.removeMoneyButton.HoverState.Parent = this.removeMoneyButton; - this.removeMoneyButton.Location = new System.Drawing.Point(472, 151); + this.removeMoneyButton.Location = new System.Drawing.Point(296, 230); this.removeMoneyButton.Name = "removeMoneyButton"; this.removeMoneyButton.ShadowDecoration.Parent = this.removeMoneyButton; - this.removeMoneyButton.Size = new System.Drawing.Size(87, 29); + this.removeMoneyButton.Size = new System.Drawing.Size(118, 29); this.removeMoneyButton.TabIndex = 9; this.removeMoneyButton.Text = "Remove"; // @@ -112,7 +115,7 @@ private void InitializeComponent() this.moneyTextBox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); this.moneyTextBox.HoverState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); this.moneyTextBox.HoverState.Parent = this.moneyTextBox; - this.moneyTextBox.Location = new System.Drawing.Point(39, 150); + this.moneyTextBox.Location = new System.Drawing.Point(174, 143); this.moneyTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.moneyTextBox.Name = "moneyTextBox"; this.moneyTextBox.PasswordChar = '\0'; @@ -141,10 +144,10 @@ private void InitializeComponent() this.addMoneyButton.HoverState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); this.addMoneyButton.HoverState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); this.addMoneyButton.HoverState.Parent = this.addMoneyButton; - this.addMoneyButton.Location = new System.Drawing.Point(379, 151); + this.addMoneyButton.Location = new System.Drawing.Point(174, 230); this.addMoneyButton.Name = "addMoneyButton"; this.addMoneyButton.ShadowDecoration.Parent = this.addMoneyButton; - this.addMoneyButton.Size = new System.Drawing.Size(87, 29); + this.addMoneyButton.Size = new System.Drawing.Size(118, 29); this.addMoneyButton.TabIndex = 8; this.addMoneyButton.Text = "Add"; // @@ -166,10 +169,10 @@ private void InitializeComponent() this.setMoneyButton.HoverState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); this.setMoneyButton.HoverState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); this.setMoneyButton.HoverState.Parent = this.setMoneyButton; - this.setMoneyButton.Location = new System.Drawing.Point(286, 151); + this.setMoneyButton.Location = new System.Drawing.Point(174, 195); this.setMoneyButton.Name = "setMoneyButton"; this.setMoneyButton.ShadowDecoration.Parent = this.setMoneyButton; - this.setMoneyButton.Size = new System.Drawing.Size(87, 29); + this.setMoneyButton.Size = new System.Drawing.Size(240, 29); this.setMoneyButton.TabIndex = 7; this.setMoneyButton.Text = "Set"; // @@ -191,7 +194,7 @@ private void InitializeComponent() this.timeScaleTextBox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); this.timeScaleTextBox.HoverState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); this.timeScaleTextBox.HoverState.Parent = this.timeScaleTextBox; - this.timeScaleTextBox.Location = new System.Drawing.Point(152, 176); + this.timeScaleTextBox.Location = new System.Drawing.Point(152, 205); this.timeScaleTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.timeScaleTextBox.Name = "timeScaleTextBox"; this.timeScaleTextBox.PasswordChar = '\0'; @@ -220,7 +223,7 @@ private void InitializeComponent() this.currentTimeTextBox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); this.currentTimeTextBox.HoverState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); this.currentTimeTextBox.HoverState.Parent = this.currentTimeTextBox; - this.currentTimeTextBox.Location = new System.Drawing.Point(152, 222); + this.currentTimeTextBox.Location = new System.Drawing.Point(152, 251); this.currentTimeTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.currentTimeTextBox.Name = "currentTimeTextBox"; this.currentTimeTextBox.PasswordChar = '\0'; @@ -249,7 +252,7 @@ private void InitializeComponent() this.setTimeScaleButton.HoverState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); this.setTimeScaleButton.HoverState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); this.setTimeScaleButton.HoverState.Parent = this.setTimeScaleButton; - this.setTimeScaleButton.Location = new System.Drawing.Point(301, 176); + this.setTimeScaleButton.Location = new System.Drawing.Point(301, 205); this.setTimeScaleButton.Name = "setTimeScaleButton"; this.setTimeScaleButton.ShadowDecoration.Parent = this.setTimeScaleButton; this.setTimeScaleButton.Size = new System.Drawing.Size(135, 29); @@ -274,7 +277,7 @@ private void InitializeComponent() this.setTimeButton.HoverState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); this.setTimeButton.HoverState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); this.setTimeButton.HoverState.Parent = this.setTimeButton; - this.setTimeButton.Location = new System.Drawing.Point(301, 222); + this.setTimeButton.Location = new System.Drawing.Point(301, 251); this.setTimeButton.Name = "setTimeButton"; this.setTimeButton.ShadowDecoration.Parent = this.setTimeButton; this.setTimeButton.Size = new System.Drawing.Size(135, 29); @@ -291,7 +294,7 @@ private void InitializeComponent() this.guna2TabControl1.Location = new System.Drawing.Point(0, 0); this.guna2TabControl1.Name = "guna2TabControl1"; this.guna2TabControl1.SelectedIndex = 0; - this.guna2TabControl1.Size = new System.Drawing.Size(612, 390); + this.guna2TabControl1.Size = new System.Drawing.Size(612, 470); this.guna2TabControl1.TabButtonHoverState.BorderColor = System.Drawing.Color.Empty; this.guna2TabControl1.TabButtonHoverState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(31)))), ((int)(((byte)(42)))), ((int)(((byte)(48))))); this.guna2TabControl1.TabButtonHoverState.Font = new System.Drawing.Font("Segoe UI Semibold", 10F); @@ -323,7 +326,7 @@ private void InitializeComponent() this.moneyTab.Location = new System.Drawing.Point(4, 44); this.moneyTab.Name = "moneyTab"; this.moneyTab.Padding = new System.Windows.Forms.Padding(3); - this.moneyTab.Size = new System.Drawing.Size(604, 342); + this.moneyTab.Size = new System.Drawing.Size(604, 422); this.moneyTab.TabIndex = 0; this.moneyTab.Text = "Money"; // @@ -342,14 +345,14 @@ private void InitializeComponent() this.timeTime.Location = new System.Drawing.Point(4, 44); this.timeTime.Name = "timeTime"; this.timeTime.Padding = new System.Windows.Forms.Padding(3); - this.timeTime.Size = new System.Drawing.Size(604, 342); + this.timeTime.Size = new System.Drawing.Size(604, 422); this.timeTime.TabIndex = 1; this.timeTime.Text = "Time"; // // label1 // this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); - this.label1.Location = new System.Drawing.Point(148, 125); + this.label1.Location = new System.Drawing.Point(148, 154); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(64, 29); this.label1.TabIndex = 22; @@ -377,7 +380,7 @@ private void InitializeComponent() "Autumn", "Winter"}); this.seasonComboBox.ItemsAppearance.Parent = this.seasonComboBox; - this.seasonComboBox.Location = new System.Drawing.Point(218, 125); + this.seasonComboBox.Location = new System.Drawing.Point(218, 154); this.seasonComboBox.Name = "seasonComboBox"; this.seasonComboBox.ShadowDecoration.Parent = this.seasonComboBox; this.seasonComboBox.Size = new System.Drawing.Size(218, 29); @@ -386,7 +389,7 @@ private void InitializeComponent() // monthLabel // this.monthLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); - this.monthLabel.Location = new System.Drawing.Point(148, 84); + this.monthLabel.Location = new System.Drawing.Point(148, 113); this.monthLabel.Name = "monthLabel"; this.monthLabel.Size = new System.Drawing.Size(64, 29); this.monthLabel.TabIndex = 20; @@ -422,7 +425,7 @@ private void InitializeComponent() "November", "December"}); this.monthComboBox.ItemsAppearance.Parent = this.monthComboBox; - this.monthComboBox.Location = new System.Drawing.Point(218, 84); + this.monthComboBox.Location = new System.Drawing.Point(218, 113); this.monthComboBox.Name = "monthComboBox"; this.monthComboBox.ShadowDecoration.Parent = this.monthComboBox; this.monthComboBox.Size = new System.Drawing.Size(218, 29); @@ -431,26 +434,148 @@ private void InitializeComponent() // gpsTab // this.gpsTab.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); + this.gpsTab.Controls.Add(this.snapDirectionCheckBox); + this.gpsTab.Controls.Add(this.plus270Button); + this.gpsTab.Controls.Add(this.plus180Button); + this.gpsTab.Controls.Add(this.plus90Button); this.gpsTab.Controls.Add(this.gpsActiveButton); this.gpsTab.Controls.Add(this.label2); this.gpsTab.Controls.Add(this.directionLabel); this.gpsTab.Controls.Add(this.isInVehicleButton); - this.gpsTab.Controls.Add(this.deactivateGPSButton); this.gpsTab.Controls.Add(this.activateGPSButton); this.gpsTab.Controls.Add(this.directionTextBox); this.gpsTab.Location = new System.Drawing.Point(4, 44); this.gpsTab.Name = "gpsTab"; this.gpsTab.Padding = new System.Windows.Forms.Padding(3); - this.gpsTab.Size = new System.Drawing.Size(604, 342); + this.gpsTab.Size = new System.Drawing.Size(604, 422); this.gpsTab.TabIndex = 2; this.gpsTab.Text = "GPS"; // + // snapDirectionCheckBox + // + this.snapDirectionCheckBox.Animated = true; + this.snapDirectionCheckBox.AutoSize = true; + this.snapDirectionCheckBox.Checked = true; + this.snapDirectionCheckBox.CheckedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(125)))), ((int)(((byte)(137)))), ((int)(((byte)(149))))); + this.snapDirectionCheckBox.CheckedState.BorderRadius = 0; + this.snapDirectionCheckBox.CheckedState.BorderThickness = 0; + this.snapDirectionCheckBox.CheckedState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(125)))), ((int)(((byte)(137)))), ((int)(((byte)(149))))); + this.snapDirectionCheckBox.CheckMarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.snapDirectionCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; + this.snapDirectionCheckBox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.snapDirectionCheckBox.Location = new System.Drawing.Point(195, 306); + this.snapDirectionCheckBox.Name = "snapDirectionCheckBox"; + this.snapDirectionCheckBox.Size = new System.Drawing.Size(206, 17); + this.snapDirectionCheckBox.TabIndex = 20; + this.snapDirectionCheckBox.Text = "Snap GPS Direction every 90 degrees"; + this.snapDirectionCheckBox.UncheckedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(125)))), ((int)(((byte)(137)))), ((int)(((byte)(149))))); + this.snapDirectionCheckBox.UncheckedState.BorderRadius = 0; + this.snapDirectionCheckBox.UncheckedState.BorderThickness = 0; + this.snapDirectionCheckBox.UncheckedState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(125)))), ((int)(((byte)(137)))), ((int)(((byte)(149))))); + // + // plus270Button + // + this.plus270Button.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.plus270Button.BorderRadius = 7; + this.plus270Button.BorderThickness = 1; + this.plus270Button.CheckedState.Parent = this.plus270Button; + this.plus270Button.CustomImages.Parent = this.plus270Button; + this.plus270Button.DisabledState.BorderColor = System.Drawing.Color.DarkGray; + this.plus270Button.DisabledState.CustomBorderColor = System.Drawing.Color.DarkGray; + this.plus270Button.DisabledState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(169)))), ((int)(((byte)(169)))), ((int)(((byte)(169))))); + this.plus270Button.DisabledState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(141)))), ((int)(((byte)(141)))), ((int)(((byte)(141))))); + this.plus270Button.DisabledState.Parent = this.plus270Button; + this.plus270Button.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); + this.plus270Button.Font = new System.Drawing.Font("Segoe UI", 12F); + this.plus270Button.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.plus270Button.HoverState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.plus270Button.HoverState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); + this.plus270Button.HoverState.Parent = this.plus270Button; + this.plus270Button.Location = new System.Drawing.Point(336, 260); + this.plus270Button.Name = "plus270Button"; + this.plus270Button.ShadowDecoration.Parent = this.plus270Button; + this.plus270Button.Size = new System.Drawing.Size(68, 29); + this.plus270Button.TabIndex = 19; + this.plus270Button.Text = "+270"; + // + // plus180Button + // + this.plus180Button.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.plus180Button.BorderRadius = 7; + this.plus180Button.BorderThickness = 1; + this.plus180Button.CheckedState.Parent = this.plus180Button; + this.plus180Button.CustomImages.Parent = this.plus180Button; + this.plus180Button.DisabledState.BorderColor = System.Drawing.Color.DarkGray; + this.plus180Button.DisabledState.CustomBorderColor = System.Drawing.Color.DarkGray; + this.plus180Button.DisabledState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(169)))), ((int)(((byte)(169)))), ((int)(((byte)(169))))); + this.plus180Button.DisabledState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(141)))), ((int)(((byte)(141)))), ((int)(((byte)(141))))); + this.plus180Button.DisabledState.Parent = this.plus180Button; + this.plus180Button.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); + this.plus180Button.Font = new System.Drawing.Font("Segoe UI", 12F); + this.plus180Button.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.plus180Button.HoverState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.plus180Button.HoverState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); + this.plus180Button.HoverState.Parent = this.plus180Button; + this.plus180Button.Location = new System.Drawing.Point(262, 260); + this.plus180Button.Name = "plus180Button"; + this.plus180Button.ShadowDecoration.Parent = this.plus180Button; + this.plus180Button.Size = new System.Drawing.Size(68, 29); + this.plus180Button.TabIndex = 18; + this.plus180Button.Text = "+180"; + // + // plus90Button + // + this.plus90Button.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.plus90Button.BorderRadius = 7; + this.plus90Button.BorderThickness = 1; + this.plus90Button.CheckedState.Parent = this.plus90Button; + this.plus90Button.CustomImages.Parent = this.plus90Button; + this.plus90Button.DisabledState.BorderColor = System.Drawing.Color.DarkGray; + this.plus90Button.DisabledState.CustomBorderColor = System.Drawing.Color.DarkGray; + this.plus90Button.DisabledState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(169)))), ((int)(((byte)(169)))), ((int)(((byte)(169))))); + this.plus90Button.DisabledState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(141)))), ((int)(((byte)(141)))), ((int)(((byte)(141))))); + this.plus90Button.DisabledState.Parent = this.plus90Button; + this.plus90Button.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); + this.plus90Button.Font = new System.Drawing.Font("Segoe UI", 12F); + this.plus90Button.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.plus90Button.HoverState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.plus90Button.HoverState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); + this.plus90Button.HoverState.Parent = this.plus90Button; + this.plus90Button.Location = new System.Drawing.Point(187, 260); + this.plus90Button.Name = "plus90Button"; + this.plus90Button.ShadowDecoration.Parent = this.plus90Button; + this.plus90Button.Size = new System.Drawing.Size(68, 29); + this.plus90Button.TabIndex = 17; + this.plus90Button.Text = "+90"; + // + // gpsActiveButton + // + this.gpsActiveButton.AutoRoundedCorners = true; + this.gpsActiveButton.BorderRadius = 11; + this.gpsActiveButton.CheckedState.Parent = this.gpsActiveButton; + this.gpsActiveButton.CustomImages.Parent = this.gpsActiveButton; + this.gpsActiveButton.DisabledState.BorderColor = System.Drawing.Color.DarkGray; + this.gpsActiveButton.DisabledState.CustomBorderColor = System.Drawing.Color.DarkGray; + this.gpsActiveButton.DisabledState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(169)))), ((int)(((byte)(169)))), ((int)(((byte)(169))))); + this.gpsActiveButton.DisabledState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(141)))), ((int)(((byte)(141)))), ((int)(((byte)(141))))); + this.gpsActiveButton.DisabledState.Parent = this.gpsActiveButton; + this.gpsActiveButton.FillColor = System.Drawing.Color.Gainsboro; + this.gpsActiveButton.Font = new System.Drawing.Font("Segoe UI", 9F); + this.gpsActiveButton.ForeColor = System.Drawing.Color.Black; + this.gpsActiveButton.HoverState.Parent = this.gpsActiveButton; + this.gpsActiveButton.Location = new System.Drawing.Point(297, 80); + this.gpsActiveButton.Name = "gpsActiveButton"; + this.gpsActiveButton.ShadowDecoration.Parent = this.gpsActiveButton; + this.gpsActiveButton.Size = new System.Drawing.Size(105, 25); + this.gpsActiveButton.TabIndex = 16; + this.gpsActiveButton.Text = "gpsActive"; + // // label2 // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); - this.label2.Location = new System.Drawing.Point(181, 176); + this.label2.Location = new System.Drawing.Point(183, 173); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(109, 21); this.label2.TabIndex = 15; @@ -461,7 +586,7 @@ private void InitializeComponent() this.directionLabel.AutoSize = true; this.directionLabel.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.directionLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); - this.directionLabel.Location = new System.Drawing.Point(181, 125); + this.directionLabel.Location = new System.Drawing.Point(183, 122); this.directionLabel.Name = "directionLabel"; this.directionLabel.Size = new System.Drawing.Size(133, 21); this.directionLabel.TabIndex = 14; @@ -482,38 +607,13 @@ private void InitializeComponent() this.isInVehicleButton.Font = new System.Drawing.Font("Segoe UI", 9F); this.isInVehicleButton.ForeColor = System.Drawing.Color.Black; this.isInVehicleButton.HoverState.Parent = this.isInVehicleButton; - this.isInVehicleButton.Location = new System.Drawing.Point(185, 83); + this.isInVehicleButton.Location = new System.Drawing.Point(187, 80); this.isInVehicleButton.Name = "isInVehicleButton"; this.isInVehicleButton.ShadowDecoration.Parent = this.isInVehicleButton; this.isInVehicleButton.Size = new System.Drawing.Size(105, 25); this.isInVehicleButton.TabIndex = 12; this.isInVehicleButton.Text = "isInVehicle"; // - // deactivateGPSButton - // - this.deactivateGPSButton.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); - this.deactivateGPSButton.BorderRadius = 7; - this.deactivateGPSButton.BorderThickness = 1; - this.deactivateGPSButton.CheckedState.Parent = this.deactivateGPSButton; - this.deactivateGPSButton.CustomImages.Parent = this.deactivateGPSButton; - this.deactivateGPSButton.DisabledState.BorderColor = System.Drawing.Color.DarkGray; - this.deactivateGPSButton.DisabledState.CustomBorderColor = System.Drawing.Color.DarkGray; - this.deactivateGPSButton.DisabledState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(169)))), ((int)(((byte)(169)))), ((int)(((byte)(169))))); - this.deactivateGPSButton.DisabledState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(141)))), ((int)(((byte)(141)))), ((int)(((byte)(141))))); - this.deactivateGPSButton.DisabledState.Parent = this.deactivateGPSButton; - this.deactivateGPSButton.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); - this.deactivateGPSButton.Font = new System.Drawing.Font("Segoe UI", 12F); - this.deactivateGPSButton.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); - this.deactivateGPSButton.HoverState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); - this.deactivateGPSButton.HoverState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); - this.deactivateGPSButton.HoverState.Parent = this.deactivateGPSButton; - this.deactivateGPSButton.Location = new System.Drawing.Point(303, 218); - this.deactivateGPSButton.Name = "deactivateGPSButton"; - this.deactivateGPSButton.ShadowDecoration.Parent = this.deactivateGPSButton; - this.deactivateGPSButton.Size = new System.Drawing.Size(97, 29); - this.deactivateGPSButton.TabIndex = 10; - this.deactivateGPSButton.Text = "Dectivate"; - // // activateGPSButton // this.activateGPSButton.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); @@ -532,10 +632,10 @@ private void InitializeComponent() this.activateGPSButton.HoverState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); this.activateGPSButton.HoverState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); this.activateGPSButton.HoverState.Parent = this.activateGPSButton; - this.activateGPSButton.Location = new System.Drawing.Point(185, 218); + this.activateGPSButton.Location = new System.Drawing.Point(187, 215); this.activateGPSButton.Name = "activateGPSButton"; this.activateGPSButton.ShadowDecoration.Parent = this.activateGPSButton; - this.activateGPSButton.Size = new System.Drawing.Size(97, 29); + this.activateGPSButton.Size = new System.Drawing.Size(217, 29); this.activateGPSButton.TabIndex = 9; this.activateGPSButton.Text = "Activate"; // @@ -557,7 +657,7 @@ private void InitializeComponent() this.directionTextBox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); this.directionTextBox.HoverState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); this.directionTextBox.HoverState.Parent = this.directionTextBox; - this.directionTextBox.Location = new System.Drawing.Point(303, 174); + this.directionTextBox.Location = new System.Drawing.Point(305, 171); this.directionTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.directionTextBox.Name = "directionTextBox"; this.directionTextBox.PasswordChar = '\0'; @@ -578,34 +678,12 @@ private void InitializeComponent() this.isInVehicleTimer.Enabled = true; this.isInVehicleTimer.Interval = 500; // - // gpsActiveButton - // - this.gpsActiveButton.AutoRoundedCorners = true; - this.gpsActiveButton.BorderRadius = 11; - this.gpsActiveButton.CheckedState.Parent = this.gpsActiveButton; - this.gpsActiveButton.CustomImages.Parent = this.gpsActiveButton; - this.gpsActiveButton.DisabledState.BorderColor = System.Drawing.Color.DarkGray; - this.gpsActiveButton.DisabledState.CustomBorderColor = System.Drawing.Color.DarkGray; - this.gpsActiveButton.DisabledState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(169)))), ((int)(((byte)(169)))), ((int)(((byte)(169))))); - this.gpsActiveButton.DisabledState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(141)))), ((int)(((byte)(141)))), ((int)(((byte)(141))))); - this.gpsActiveButton.DisabledState.Parent = this.gpsActiveButton; - this.gpsActiveButton.FillColor = System.Drawing.Color.Gainsboro; - this.gpsActiveButton.Font = new System.Drawing.Font("Segoe UI", 9F); - this.gpsActiveButton.ForeColor = System.Drawing.Color.Black; - this.gpsActiveButton.HoverState.Parent = this.gpsActiveButton; - this.gpsActiveButton.Location = new System.Drawing.Point(295, 83); - this.gpsActiveButton.Name = "gpsActiveButton"; - this.gpsActiveButton.ShadowDecoration.Parent = this.gpsActiveButton; - this.gpsActiveButton.Size = new System.Drawing.Size(105, 25); - this.gpsActiveButton.TabIndex = 16; - this.gpsActiveButton.Text = "gpsActive"; - // // Menu // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); - this.ClientSize = new System.Drawing.Size(612, 390); + this.ClientSize = new System.Drawing.Size(612, 470); this.Controls.Add(this.guna2TabControl1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); @@ -638,8 +716,6 @@ private void InitializeComponent() private System.Windows.Forms.Label label1; private Guna.UI2.WinForms.Guna2ComboBox seasonComboBox; private System.Windows.Forms.Label monthLabel; - private Guna.UI2.WinForms.Guna2Button deactivateGPSButton; - private Guna.UI2.WinForms.Guna2Button activateGPSButton; private Guna.UI2.WinForms.Guna2TextBox directionTextBox; public Guna.UI2.WinForms.Guna2Button isInVehicleButton; private System.Windows.Forms.Timer gpsTimer; @@ -647,5 +723,10 @@ private void InitializeComponent() private System.Windows.Forms.Label label2; private System.Windows.Forms.Timer isInVehicleTimer; public Guna.UI2.WinForms.Guna2Button gpsActiveButton; + private Guna.UI2.WinForms.Guna2Button plus270Button; + private Guna.UI2.WinForms.Guna2Button plus180Button; + private Guna.UI2.WinForms.Guna2Button plus90Button; + public Guna.UI2.WinForms.Guna2Button activateGPSButton; + private Guna.UI2.WinForms.Guna2CheckBox snapDirectionCheckBox; } } \ No newline at end of file diff --git a/FS22Companion/Menu.cs b/FS22Companion/Menu.cs index 96d8c43..295d8d5 100644 --- a/FS22Companion/Menu.cs +++ b/FS22Companion/Menu.cs @@ -206,15 +206,53 @@ public Menu() double direction; bool previousIsInVehicle = false; bool isInVehicle = false; + bool snapDirection = true; activateGPSButton.Click += (sender, e) => { - GPSactive = true; + if(GPSactive) + { + GPSactive = false; + System.Media.SoundPlayer snd = new System.Media.SoundPlayer(Properties.Resources.gs_deactivate); + snd.Play(); + activateGPSButton.Text = "Activate"; + } + else if(!GPSactive) + { + GPSactive = true; + System.Media.SoundPlayer snd = new System.Media.SoundPlayer(Properties.Resources.gs_activate); + snd.Play(); + activateGPSButton.Text = "Deactivate"; + } }; - deactivateGPSButton.Click += (sender, e) => + snapDirectionCheckBox.CheckedChanged += (sender, e) => { - GPSactive = false; + snapDirection = snapDirectionCheckBox.Checked; + }; + + plus90Button.Click += (sender, e) => + { + var newDirection = Double.Parse(directionTextBox.Text) + 90.0; + if (newDirection > 360) + newDirection = newDirection - 360; + directionTextBox.Text = newDirection.ToString("0.0"); + }; + + plus180Button.Click += (sender, e) => + { + var newDirection = Double.Parse(directionTextBox.Text) + 180.0; + if (newDirection > 360) + newDirection = newDirection - 360; + directionTextBox.Text = newDirection.ToString("0.0"); + }; + + plus270Button.Click += (sender, e) => + { + var newDirection = Double.Parse(directionTextBox.Text) + 270.0; + if (newDirection > 360) + newDirection = newDirection - 360; + directionTextBox.Text = newDirection.ToString("0.0"); }; isInVehicleTimer.Tick += (sender, e) => @@ -256,13 +294,25 @@ public Menu() if (direction < 0) direction = -direction; // normalize the angle direction = 360 - direction; directionLabel.Text = "Current Direction: " + (direction).ToString("0.0") + "º"; - + var GPSDirection = Double.Parse(directionTextBox.Text); axisSideAddress = ReadInt64(globalArray + 0x90); - if(GPSactive) + if(snapDirection) { - var GPSDirection = Double.Parse(directionTextBox.Text); + if (45 <= direction && direction < 135) + GPSDirection = 90.0; + if (135 <= direction && direction < 225) + GPSDirection = 180.0; + if (225 <= direction && direction < 315) + GPSDirection = 270.0; + if ((315 <= direction && direction <= 360) || (0 <= direction && direction < 45)) + GPSDirection = 360.0; + if (!directionTextBox.Focused && directionTextBox.Text != GPSDirection.ToString("0.0")) + directionTextBox.Text = GPSDirection.ToString("0.0"); + } + if (GPSactive) + { if (GPSDirection != direction) { if(GPSDirection > direction && GPSDirection - direction <= 180) @@ -304,11 +354,17 @@ public Menu() public void steer(bool left, long axisSideAddress, double GPSDirection, double direction) { - if((direction >= 359.9 || direction <= 0.1) && (System.Math.Abs(GPSDirection - direction) <= 0.5 || (359.9 <= System.Math.Abs(GPSDirection - direction) && System.Math.Abs(GPSDirection - direction) <= 360.0))) + if(direction >= 359 || direction <= 1) // Offset it so that it doesn't bug out near the 360 degrees { - // Don't steer + if (direction <= 1) + direction = direction + 360; + if (GPSDirection <= 1) + GPSDirection = GPSDirection + 360; + direction = direction - 90; + GPSDirection = GPSDirection - 90; } - else if (System.Math.Abs(GPSDirection - direction) <= 0.1) + + if (System.Math.Abs(GPSDirection - direction) <= 0.1) { var steerPercentage = 0.02; if (left) steerPercentage = -0.02; @@ -751,30 +807,30 @@ public long GetGlobalArray() public void DisableScript() { - baseAddress = (long)process.MainModule.BaseAddress + 0x8EDD2; - - if (baseAddress == 0 || newmem == 0) + if (Process.GetProcessesByName("FarmingSimulator2022Game").Length > 0) { - CustomMessageBox.Show("The script was not disabled!", MessageBoxButtons.OK); - return; - } + baseAddress = (long)process.MainModule.BaseAddress + 0x8EDD2; + + if (baseAddress == 0 || newmem == 0) + { + CustomMessageBox.Show("The script was not disabled!", MessageBoxButtons.OK); + return; + } - byte[] originalbytes = { 0x4D, 0x8B, 0x1A, 0x49, 0x83, 0xFB, 0xFF }; + byte[] originalbytes = { 0x4D, 0x8B, 0x1A, 0x49, 0x83, 0xFB, 0xFF }; - IntPtr bytes; + IntPtr bytes; - if (Process.GetProcessesByName("FarmingSimulator2022Game").Length > 0) - { WriteProcessMemory(process.Handle, baseAddress, originalbytes, originalbytes.Length, out bytes); - } - var successDeallocating = Dealloc(process.Handle, newmem); + var successDeallocating = Dealloc(process.Handle, newmem); - if (!successDeallocating) - { - int error = Marshal.GetLastWin32Error(); - CustomMessageBox.Show("Deallocation failed. Error code: " + error.ToString(), MessageBoxButtons.OK); - return; + if (!successDeallocating) + { + int error = Marshal.GetLastWin32Error(); + CustomMessageBox.Show("Deallocation failed. Error code: " + error.ToString(), MessageBoxButtons.OK); + return; + } } } diff --git a/FS22Companion/PricesTable.Designer.cs b/FS22Companion/PricesTable.Designer.cs index f9b1f4d..ee093f3 100644 --- a/FS22Companion/PricesTable.Designer.cs +++ b/FS22Companion/PricesTable.Designer.cs @@ -35,11 +35,11 @@ private void InitializeComponent() this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.panel1 = new System.Windows.Forms.Panel(); this.difficultyLabel = new System.Windows.Forms.Label(); + this.difficultyButtonRight = new FontAwesome.Sharp.IconButton(); + this.difficultyButtonLeft = new FontAwesome.Sharp.IconButton(); this.label1 = new System.Windows.Forms.Label(); this.tableScrollBar = new Guna.UI2.WinForms.Guna2VScrollBar(); this.label2 = new System.Windows.Forms.Label(); - this.difficultyButtonRight = new FontAwesome.Sharp.IconButton(); - this.difficultyButtonLeft = new FontAwesome.Sharp.IconButton(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.panel1.SuspendLayout(); this.SuspendLayout(); @@ -88,7 +88,7 @@ private void InitializeComponent() this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; this.dataGridView1.ShowCellToolTips = false; this.dataGridView1.ShowEditingIcon = false; - this.dataGridView1.Size = new System.Drawing.Size(367, 347); + this.dataGridView1.Size = new System.Drawing.Size(367, 425); this.dataGridView1.TabIndex = 0; // // panel1 @@ -113,6 +113,43 @@ private void InitializeComponent() this.difficultyLabel.Text = "Easy"; this.difficultyLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // + // difficultyButtonRight + // + this.difficultyButtonRight.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(33)))), ((int)(((byte)(117)))), ((int)(((byte)(143))))); + this.difficultyButtonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.difficultyButtonRight.FlatAppearance.BorderSize = 0; + this.difficultyButtonRight.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.difficultyButtonRight.Flip = FontAwesome.Sharp.FlipOrientation.Horizontal; + this.difficultyButtonRight.IconChar = FontAwesome.Sharp.IconChar.AngleLeft; + this.difficultyButtonRight.IconColor = System.Drawing.Color.FromArgb(((int)(((byte)(69)))), ((int)(((byte)(186)))), ((int)(((byte)(213))))); + this.difficultyButtonRight.IconFont = FontAwesome.Sharp.IconFont.Auto; + this.difficultyButtonRight.IconSize = 35; + this.difficultyButtonRight.Location = new System.Drawing.Point(137, 0); + this.difficultyButtonRight.Name = "difficultyButtonRight"; + this.difficultyButtonRight.Padding = new System.Windows.Forms.Padding(0, 6, 0, 0); + this.difficultyButtonRight.Size = new System.Drawing.Size(34, 35); + this.difficultyButtonRight.TabIndex = 1; + this.difficultyButtonRight.UseVisualStyleBackColor = false; + this.difficultyButtonRight.Click += new System.EventHandler(this.difficultyButtonRight_Click); + // + // difficultyButtonLeft + // + this.difficultyButtonLeft.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(33)))), ((int)(((byte)(117)))), ((int)(((byte)(143))))); + this.difficultyButtonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.difficultyButtonLeft.FlatAppearance.BorderSize = 0; + this.difficultyButtonLeft.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.difficultyButtonLeft.IconChar = FontAwesome.Sharp.IconChar.AngleLeft; + this.difficultyButtonLeft.IconColor = System.Drawing.Color.FromArgb(((int)(((byte)(69)))), ((int)(((byte)(186)))), ((int)(((byte)(213))))); + this.difficultyButtonLeft.IconFont = FontAwesome.Sharp.IconFont.Auto; + this.difficultyButtonLeft.IconSize = 35; + this.difficultyButtonLeft.Location = new System.Drawing.Point(0, 0); + this.difficultyButtonLeft.Name = "difficultyButtonLeft"; + this.difficultyButtonLeft.Padding = new System.Windows.Forms.Padding(0, 6, 3, 0); + this.difficultyButtonLeft.Size = new System.Drawing.Size(34, 35); + this.difficultyButtonLeft.TabIndex = 0; + this.difficultyButtonLeft.UseVisualStyleBackColor = false; + this.difficultyButtonLeft.Click += new System.EventHandler(this.difficultyButtonLeft_Click); + // // label1 // this.label1.Font = new System.Drawing.Font("Segoe UI", 12.5F); @@ -138,7 +175,7 @@ private void InitializeComponent() this.tableScrollBar.Name = "tableScrollBar"; this.tableScrollBar.PressedState.Parent = this.tableScrollBar; this.tableScrollBar.ScrollbarSize = 10; - this.tableScrollBar.Size = new System.Drawing.Size(10, 347); + this.tableScrollBar.Size = new System.Drawing.Size(10, 425); this.tableScrollBar.TabIndex = 4; this.tableScrollBar.ThumbColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); this.tableScrollBar.ThumbStyle = Guna.UI2.WinForms.Enums.ThumbStyle.Inset; @@ -148,7 +185,7 @@ private void InitializeComponent() // this.label2.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label2.ForeColor = System.Drawing.Color.White; - this.label2.Location = new System.Drawing.Point(421, 335); + this.label2.Location = new System.Drawing.Point(421, 413); this.label2.Name = "label2"; this.label2.RightToLeft = System.Windows.Forms.RightToLeft.No; this.label2.Size = new System.Drawing.Size(171, 33); @@ -156,49 +193,12 @@ private void InitializeComponent() this.label2.Text = "Credits to u/Edigorin"; this.label2.TextAlign = System.Drawing.ContentAlignment.BottomRight; // - // difficultyButtonRight - // - this.difficultyButtonRight.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(33)))), ((int)(((byte)(117)))), ((int)(((byte)(143))))); - this.difficultyButtonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; - this.difficultyButtonRight.FlatAppearance.BorderSize = 0; - this.difficultyButtonRight.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.difficultyButtonRight.Flip = FontAwesome.Sharp.FlipOrientation.Horizontal; - this.difficultyButtonRight.IconChar = FontAwesome.Sharp.IconChar.AngleLeft; - this.difficultyButtonRight.IconColor = System.Drawing.Color.FromArgb(((int)(((byte)(69)))), ((int)(((byte)(186)))), ((int)(((byte)(213))))); - this.difficultyButtonRight.IconFont = FontAwesome.Sharp.IconFont.Auto; - this.difficultyButtonRight.IconSize = 35; - this.difficultyButtonRight.Location = new System.Drawing.Point(137, 0); - this.difficultyButtonRight.Name = "difficultyButtonRight"; - this.difficultyButtonRight.Padding = new System.Windows.Forms.Padding(0, 6, 0, 0); - this.difficultyButtonRight.Size = new System.Drawing.Size(34, 35); - this.difficultyButtonRight.TabIndex = 1; - this.difficultyButtonRight.UseVisualStyleBackColor = false; - this.difficultyButtonRight.Click += new System.EventHandler(this.difficultyButtonRight_Click); - // - // difficultyButtonLeft - // - this.difficultyButtonLeft.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(33)))), ((int)(((byte)(117)))), ((int)(((byte)(143))))); - this.difficultyButtonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; - this.difficultyButtonLeft.FlatAppearance.BorderSize = 0; - this.difficultyButtonLeft.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.difficultyButtonLeft.IconChar = FontAwesome.Sharp.IconChar.AngleLeft; - this.difficultyButtonLeft.IconColor = System.Drawing.Color.FromArgb(((int)(((byte)(69)))), ((int)(((byte)(186)))), ((int)(((byte)(213))))); - this.difficultyButtonLeft.IconFont = FontAwesome.Sharp.IconFont.Auto; - this.difficultyButtonLeft.IconSize = 35; - this.difficultyButtonLeft.Location = new System.Drawing.Point(0, 0); - this.difficultyButtonLeft.Name = "difficultyButtonLeft"; - this.difficultyButtonLeft.Padding = new System.Windows.Forms.Padding(0, 6, 3, 0); - this.difficultyButtonLeft.Size = new System.Drawing.Size(34, 35); - this.difficultyButtonLeft.TabIndex = 0; - this.difficultyButtonLeft.UseVisualStyleBackColor = false; - this.difficultyButtonLeft.Click += new System.EventHandler(this.difficultyButtonLeft_Click); - // // PricesTable // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); - this.ClientSize = new System.Drawing.Size(612, 390); + this.ClientSize = new System.Drawing.Size(612, 470); this.Controls.Add(this.label2); this.Controls.Add(this.tableScrollBar); this.Controls.Add(this.label1); diff --git a/FS22Companion/PricesTable.cs b/FS22Companion/PricesTable.cs index 6b5d3b2..81dbcdd 100644 --- a/FS22Companion/PricesTable.cs +++ b/FS22Companion/PricesTable.cs @@ -16,11 +16,121 @@ public partial class PricesTable : Form { Dictionary> averageSellPrices = new Dictionary>(); + Dictionary basePrices = new Dictionary() + { + { "Wheat ", 337 }, + { "Barley ", 313 }, + { "Oat ", 532 }, + { "Canola ", 603 }, + { "Sorghum ", 430 }, + { "Grapes ", 603 }, + { "Olives ", 603 }, + { "Sunflowers ", 673 }, + { "Soybeans ", 778 }, + { "Corn ", 380 }, + { "Potatoes ", 172 }, + { "SugarBeet ", 122 }, + { "SugarBeetCut ", 172 }, + { "Cotton ", 1252 }, + { "Sugarcane ", 119 }, + { "Eggs ", 1120 }, + { "Wool ", 940 }, + { "Milk ", 700 }, + { "Chaff ", 42 }, + { "Woodchips ", 80 }, + { "Silage ", 171 }, + { "Wood ", 1000 }, + { "Grass ", 45 }, + { "Hay ", 56 }, + { "Straw ", 41 }, + { "Manure ", 33 }, + { "Slurry ", 33 }, + { "Digestate ", 33 }, + { "Stones ", 50 }, + { "Flour ", 570 }, + { "Bread ", 1520 }, + { "Cake ", 3300 }, + { "Butter ", 900 }, + { "Cheese ", 1800 }, + { "Fabric ", 3000 }, + { "Clothes ", 8000 }, + { "Sugar ", 500 }, + { "Honey ", 1000 }, + { "Cereal ", 2350 }, + { "SunflowerOil ", 1780 }, + { "CanolaOil ", 1640 }, + { "OliveOil ", 2440 }, + { "Raisins ", 1400 }, + { "GrapeJuice ", 1600 }, + { "Lettuce ", 990 }, + { "Tomato ", 500 }, + { "Strawberry ", 250 }, + { "Chocolate ", 2000 }, + { "Boards ", 1300 }, + { "Furniture ", 2000 } + }; + public PricesTable() { InitializeComponent(); } + private DataTable getAverageSellPricesTable(string difficulty, Dictionary> averageSellPrices) + { + + DataTable averageSellPricesTable = new DataTable("AverageSellPrices"); + DataColumn dtColumn; + + dtColumn = new DataColumn(); + dtColumn.DataType = typeof(String); + dtColumn.ColumnName = "Products"; + dtColumn.Caption = ""; + dtColumn.ReadOnly = false; + dtColumn.Unique = true; + averageSellPricesTable.Columns.Add(dtColumn); + + dtColumn = new DataColumn(); + dtColumn.DataType = typeof(String); + dtColumn.ColumnName = "Average"; + dtColumn.Caption = ""; + dtColumn.AutoIncrement = false; + dtColumn.ReadOnly = false; + dtColumn.Unique = false; + averageSellPricesTable.Columns.Add(dtColumn); + + dtColumn = new DataColumn(); + dtColumn.DataType = typeof(String); + dtColumn.ColumnName = "Good"; + dtColumn.Caption = ""; + dtColumn.ReadOnly = false; + dtColumn.Unique = false; + averageSellPricesTable.Columns.Add(dtColumn); + + dtColumn = new DataColumn(); + dtColumn.DataType = typeof(String); + dtColumn.ColumnName = "Best"; + dtColumn.Caption = ""; + dtColumn.ReadOnly = false; + dtColumn.Unique = false; + averageSellPricesTable.Columns.Add(dtColumn); + + + foreach (var cropPriceDict in averageSellPrices[difficulty]) + { + var cropName = cropPriceDict.Key; + var cropPriceArray = cropPriceDict.Value; + + var row = averageSellPricesTable.NewRow(); + row["Products"] = cropName; + row["Average"] = cropPriceArray[0]; + row["Good"] = cropPriceArray[1]; + row["Best"] = cropPriceArray[2]; + averageSellPricesTable.Rows.Add(row); + } + + return averageSellPricesTable; + } + private void PricesTable_Load(object sender, EventArgs e) { // Easy prices diff --git a/FS22Companion/Properties/Resources.Designer.cs b/FS22Companion/Properties/Resources.Designer.cs index 66ebd2b..c3ca8fb 100644 --- a/FS22Companion/Properties/Resources.Designer.cs +++ b/FS22Companion/Properties/Resources.Designer.cs @@ -80,6 +80,24 @@ internal static byte[] fontawesome_webfont { } } + /// + /// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream. + /// + internal static System.IO.UnmanagedMemoryStream gs_activate { + get { + return ResourceManager.GetStream("gs_activate", resourceCulture); + } + } + + /// + /// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream. + /// + internal static System.IO.UnmanagedMemoryStream gs_deactivate { + get { + return ResourceManager.GetStream("gs_deactivate", resourceCulture); + } + } + /// /// Looks up a localized resource of type System.Byte[]. /// @@ -139,5 +157,15 @@ internal static byte[] Newtonsoft_Json { return ((byte[])(obj)); } } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] Octokit { + get { + object obj = ResourceManager.GetObject("Octokit", resourceCulture); + return ((byte[])(obj)); + } + } } } diff --git a/FS22Companion/Properties/Resources.resx b/FS22Companion/Properties/Resources.resx index 5892fc1..a0147b3 100644 --- a/FS22Companion/Properties/Resources.resx +++ b/FS22Companion/Properties/Resources.resx @@ -124,6 +124,12 @@ ..\Resources\fontawesome-webfont.ttf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\gs_activate.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\gs_deactivate.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + ..\Resources\Guna.UI2.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -142,4 +148,7 @@ ..\Resources\Newtonsoft.Json.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\Octokit.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ No newline at end of file diff --git a/FS22Companion/Properties/Settings.Designer.cs b/FS22Companion/Properties/Settings.Designer.cs new file mode 100644 index 0000000..76811f1 --- /dev/null +++ b/FS22Companion/Properties/Settings.Designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace FS22Companion.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string GameSettingsDictionary { + get { + return ((string)(this["GameSettingsDictionary"])); + } + set { + this["GameSettingsDictionary"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool TopMost { + get { + return ((bool)(this["TopMost"])); + } + set { + this["TopMost"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string GameSettingsPath { + get { + return ((string)(this["GameSettingsPath"])); + } + set { + this["GameSettingsPath"] = value; + } + } + } +} diff --git a/FS22Companion/Properties/Settings.settings b/FS22Companion/Properties/Settings.settings new file mode 100644 index 0000000..fe6240b --- /dev/null +++ b/FS22Companion/Properties/Settings.settings @@ -0,0 +1,15 @@ + + + + + + + + + False + + + + + + \ No newline at end of file diff --git a/FS22Companion/Resources/Octokit.dll b/FS22Companion/Resources/Octokit.dll new file mode 100644 index 0000000..b618852 Binary files /dev/null and b/FS22Companion/Resources/Octokit.dll differ diff --git a/FS22Companion/Resources/gs_activate.wav b/FS22Companion/Resources/gs_activate.wav new file mode 100644 index 0000000..c5a70ae Binary files /dev/null and b/FS22Companion/Resources/gs_activate.wav differ diff --git a/FS22Companion/Resources/gs_deactivate.wav b/FS22Companion/Resources/gs_deactivate.wav new file mode 100644 index 0000000..0260c05 Binary files /dev/null and b/FS22Companion/Resources/gs_deactivate.wav differ diff --git a/FS22Companion/Settings.Designer.cs b/FS22Companion/Settings.Designer.cs index 3bb063e..1730c2a 100644 --- a/FS22Companion/Settings.Designer.cs +++ b/FS22Companion/Settings.Designer.cs @@ -32,6 +32,9 @@ private void InitializeComponent() System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Settings)); this.topMostButton = new Guna.UI2.WinForms.Guna2Button(); this.label1 = new System.Windows.Forms.Label(); + this.gameSettingsFolderButton = new FontAwesome.Sharp.IconButton(); + this.label7 = new System.Windows.Forms.Label(); + this.gameSettingsFolderTextBox = new Guna.UI2.WinForms.Guna2TextBox(); this.SuspendLayout(); // // topMostButton @@ -65,18 +68,77 @@ private void InitializeComponent() this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); - this.label1.Location = new System.Drawing.Point(189, 342); + this.label1.Location = new System.Drawing.Point(191, 420); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(208, 21); this.label1.TabIndex = 11; this.label1.Text = "This is looking kinda empty...\r\n"; // + // gameSettingsFolderButton + // + this.gameSettingsFolderButton.FlatAppearance.BorderSize = 0; + this.gameSettingsFolderButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.gameSettingsFolderButton.IconChar = FontAwesome.Sharp.IconChar.FolderOpen; + this.gameSettingsFolderButton.IconColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.gameSettingsFolderButton.IconFont = FontAwesome.Sharp.IconFont.Auto; + this.gameSettingsFolderButton.IconSize = 38; + this.gameSettingsFolderButton.Location = new System.Drawing.Point(533, 120); + this.gameSettingsFolderButton.Name = "gameSettingsFolderButton"; + this.gameSettingsFolderButton.Size = new System.Drawing.Size(34, 29); + this.gameSettingsFolderButton.TabIndex = 24; + this.gameSettingsFolderButton.UseVisualStyleBackColor = true; + this.gameSettingsFolderButton.Click += new System.EventHandler(this.gameSettingsFolderButton_Click); + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.label7.Location = new System.Drawing.Point(52, 95); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(159, 21); + this.label7.TabIndex = 23; + this.label7.Text = "Game Settings Folder"; + // + // gameSettingsFolderTextBox + // + this.gameSettingsFolderTextBox.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.gameSettingsFolderTextBox.BorderRadius = 7; + this.gameSettingsFolderTextBox.Cursor = System.Windows.Forms.Cursors.IBeam; + this.gameSettingsFolderTextBox.DefaultText = ""; + this.gameSettingsFolderTextBox.DisabledState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(208)))), ((int)(((byte)(208)))), ((int)(((byte)(208))))); + this.gameSettingsFolderTextBox.DisabledState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(226)))), ((int)(((byte)(226)))), ((int)(((byte)(226))))); + this.gameSettingsFolderTextBox.DisabledState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(138)))), ((int)(((byte)(138)))), ((int)(((byte)(138))))); + this.gameSettingsFolderTextBox.DisabledState.Parent = this.gameSettingsFolderTextBox; + this.gameSettingsFolderTextBox.DisabledState.PlaceholderForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(138)))), ((int)(((byte)(138)))), ((int)(((byte)(138))))); + this.gameSettingsFolderTextBox.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); + this.gameSettingsFolderTextBox.FocusedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); + this.gameSettingsFolderTextBox.FocusedState.Parent = this.gameSettingsFolderTextBox; + this.gameSettingsFolderTextBox.Font = new System.Drawing.Font("Segoe UI", 12F); + this.gameSettingsFolderTextBox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(187)))), ((int)(((byte)(223))))); + this.gameSettingsFolderTextBox.HoverState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(194)))), ((int)(((byte)(243))))); + this.gameSettingsFolderTextBox.HoverState.Parent = this.gameSettingsFolderTextBox; + this.gameSettingsFolderTextBox.Location = new System.Drawing.Point(50, 120); + this.gameSettingsFolderTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.gameSettingsFolderTextBox.Name = "gameSettingsFolderTextBox"; + this.gameSettingsFolderTextBox.PasswordChar = '\0'; + this.gameSettingsFolderTextBox.PlaceholderForeColor = System.Drawing.Color.Gray; + this.gameSettingsFolderTextBox.PlaceholderText = "Game Settings Folder"; + this.gameSettingsFolderTextBox.SelectedText = ""; + this.gameSettingsFolderTextBox.ShadowDecoration.Parent = this.gameSettingsFolderTextBox; + this.gameSettingsFolderTextBox.Size = new System.Drawing.Size(476, 29); + this.gameSettingsFolderTextBox.TabIndex = 22; + this.gameSettingsFolderTextBox.TextChanged += new System.EventHandler(this.gameSettingsFolderTextBox_TextChanged); + // // Settings // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(47)))), ((int)(((byte)(55))))); - this.ClientSize = new System.Drawing.Size(612, 390); + this.ClientSize = new System.Drawing.Size(612, 470); + this.Controls.Add(this.gameSettingsFolderButton); + this.Controls.Add(this.label7); + this.Controls.Add(this.gameSettingsFolderTextBox); this.Controls.Add(this.label1); this.Controls.Add(this.topMostButton); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; @@ -91,5 +153,8 @@ private void InitializeComponent() #endregion public System.Windows.Forms.Label label1; public Guna.UI2.WinForms.Guna2Button topMostButton; + private FontAwesome.Sharp.IconButton gameSettingsFolderButton; + private System.Windows.Forms.Label label7; + public Guna.UI2.WinForms.Guna2TextBox gameSettingsFolderTextBox; } } \ No newline at end of file diff --git a/FS22Companion/Settings.cs b/FS22Companion/Settings.cs index 1f099c9..6ac17a3 100644 --- a/FS22Companion/Settings.cs +++ b/FS22Companion/Settings.cs @@ -12,6 +12,7 @@ namespace FS22Companion { public partial class Settings : Form { + public Settings() { InitializeComponent(); @@ -21,5 +22,25 @@ private void topMostButton_Click(object sender, EventArgs e) { } + + private void gameSettingsFolderButton_Click(object sender, EventArgs e) + { + FolderBrowserDialog browserDialog = new FolderBrowserDialog(); + if (!String.IsNullOrEmpty(Properties.Settings.Default.GameSettingsPath)) + browserDialog.SelectedPath = Properties.Settings.Default.GameSettingsPath; + if (browserDialog.ShowDialog() == DialogResult.OK) + { + Properties.Settings.Default.GameSettingsPath = browserDialog.SelectedPath; + gameSettingsFolderTextBox.Text = Properties.Settings.Default.GameSettingsPath; + gameSettingsFolderTextBox.Select(gameSettingsFolderTextBox.Text.Length, 0); + Properties.Settings.Default.Save(); + } + } + + private void gameSettingsFolderTextBox_TextChanged(object sender, EventArgs e) + { + Properties.Settings.Default.GameSettingsPath = gameSettingsFolderTextBox.Text; + Properties.Settings.Default.Save(); + } } }