From 1bfb1b5f54b8da534e957871afdca9bba5231534 Mon Sep 17 00:00:00 2001 From: Rennorb <18741506+SaculRennorb@users.noreply.github.com> Date: Wed, 14 Dec 2022 22:04:22 +0100 Subject: [PATCH 1/4] initial draft --- AppSettings/ApplicationSettings.cs | 7 +- AppSettings/ApplicationSettingsBuildCodes.cs | 12 + Forms/FormGW2API.Designer.cs | 239 +++++++++--------- Forms/FormGW2API.cs | 24 +- ...HSBuildCodeCompressionSettings.Designer.cs | 105 ++++++++ Forms/FormHSBuildCodeCompressionSettings.cs | 37 +++ Forms/FormHSBuildCodeCompressionSettings.resx | 63 +++++ Forms/FormMain.cs | 17 +- 8 files changed, 383 insertions(+), 121 deletions(-) create mode 100644 AppSettings/ApplicationSettingsBuildCodes.cs create mode 100644 Forms/FormHSBuildCodeCompressionSettings.Designer.cs create mode 100644 Forms/FormHSBuildCodeCompressionSettings.cs create mode 100644 Forms/FormHSBuildCodeCompressionSettings.resx diff --git a/AppSettings/ApplicationSettings.cs b/AppSettings/ApplicationSettings.cs index 8709fdf..168e059 100644 --- a/AppSettings/ApplicationSettings.cs +++ b/AppSettings/ApplicationSettings.cs @@ -107,6 +107,9 @@ private static ApplicationSettings DeserialiseFromFile(string loadLocation) [JsonProperty("upload")] internal ApplicationSettingsUpload Upload { get; set; } = new ApplicationSettingsUpload(); - #endregion - } + + [JsonProperty("buildCodes")] + internal ApplicationSettingsBuildCodes BuildCodes { get; set; } = new(); + #endregion + } } diff --git a/AppSettings/ApplicationSettingsBuildCodes.cs b/AppSettings/ApplicationSettingsBuildCodes.cs new file mode 100644 index 0000000..fa0e7f7 --- /dev/null +++ b/AppSettings/ApplicationSettingsBuildCodes.cs @@ -0,0 +1,12 @@ +using Newtonsoft.Json; +using static Hardstuck.GuildWars2.BuildCodes.V2.Static; + +namespace PlenBotLogUploader.AppSettings +{ + internal sealed class ApplicationSettingsBuildCodes + { + [JsonProperty("demoteRunes")] internal bool DemoteRunes { get; set; } = true; + [JsonProperty("demoteSigils")] internal bool DemoteSigils { get; set; } = true; + [JsonProperty("compression")] internal CompressionOptions Compression { get; set; } = CompressionOptions.ALL; + } +} diff --git a/Forms/FormGW2API.Designer.cs b/Forms/FormGW2API.Designer.cs index 78802d8..91427b3 100644 --- a/Forms/FormGW2API.Designer.cs +++ b/Forms/FormGW2API.Designer.cs @@ -28,123 +28,135 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - this.labelAPIKeyInfo = new System.Windows.Forms.Label(); - this.listBoxAPIKeys = new System.Windows.Forms.ListBox(); - this.contextMenuStripEditAPIKeys = new System.Windows.Forms.ContextMenuStrip(this.components); - this.toolStripMenuItemEditKey = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuItemRemoveKey = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparatorOne = new System.Windows.Forms.ToolStripSeparator(); - this.toolStripMenuItemAddKey = new System.Windows.Forms.ToolStripMenuItem(); - this.buttonAddAPIKey = new System.Windows.Forms.Button(); - this.buttonGetHardstuckBuildLink = new System.Windows.Forms.Button(); - this.contextMenuStripEditAPIKeys.SuspendLayout(); - this.SuspendLayout(); - // - // labelAPIKeyInfo - // - this.labelAPIKeyInfo.Location = new System.Drawing.Point(8, 404); - this.labelAPIKeyInfo.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.labelAPIKeyInfo.Name = "labelAPIKeyInfo"; - this.labelAPIKeyInfo.Size = new System.Drawing.Size(561, 91); - this.labelAPIKeyInfo.TabIndex = 1; - this.labelAPIKeyInfo.Text = "API keys are used with \"!ign\" and \"!build\" Twitch commands.\r\nYou do not need to s" + + this.components = new System.ComponentModel.Container(); + this.labelAPIKeyInfo = new System.Windows.Forms.Label(); + this.listBoxAPIKeys = new System.Windows.Forms.ListBox(); + this.contextMenuStripEditAPIKeys = new System.Windows.Forms.ContextMenuStrip(this.components); + this.toolStripMenuItemEditKey = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItemRemoveKey = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparatorOne = new System.Windows.Forms.ToolStripSeparator(); + this.toolStripMenuItemAddKey = new System.Windows.Forms.ToolStripMenuItem(); + this.buttonAddAPIKey = new System.Windows.Forms.Button(); + this.buttonGetHardstuckBuildLink = new System.Windows.Forms.Button(); + this.ButtonBuildCodeCompressionSettings = new System.Windows.Forms.Button(); + this.contextMenuStripEditAPIKeys.SuspendLayout(); + this.SuspendLayout(); + // + // labelAPIKeyInfo + // + this.labelAPIKeyInfo.Location = new System.Drawing.Point(7, 303); + this.labelAPIKeyInfo.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.labelAPIKeyInfo.Name = "labelAPIKeyInfo"; + this.labelAPIKeyInfo.Size = new System.Drawing.Size(491, 68); + this.labelAPIKeyInfo.TabIndex = 1; + this.labelAPIKeyInfo.Text = "API keys are used with \"!ign\" and \"!build\" Twitch commands.\r\nYou do not need to s" + "et it unless you want to use these Twitch commands."; - this.labelAPIKeyInfo.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // listBoxAPIKeys - // - this.listBoxAPIKeys.BackColor = System.Drawing.Color.White; - this.listBoxAPIKeys.ContextMenuStrip = this.contextMenuStripEditAPIKeys; - this.listBoxAPIKeys.FormattingEnabled = true; - this.listBoxAPIKeys.ItemHeight = 20; - this.listBoxAPIKeys.Location = new System.Drawing.Point(12, 15); - this.listBoxAPIKeys.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); - this.listBoxAPIKeys.Name = "listBoxAPIKeys"; - this.listBoxAPIKeys.Size = new System.Drawing.Size(906, 384); - this.listBoxAPIKeys.TabIndex = 2; - this.listBoxAPIKeys.DoubleClick += new System.EventHandler(this.ListBoxAPIKeys_DoubleClick); - // - // contextMenuStripEditAPIKeys - // - this.contextMenuStripEditAPIKeys.ImageScalingSize = new System.Drawing.Size(20, 20); - this.contextMenuStripEditAPIKeys.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.labelAPIKeyInfo.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // listBoxAPIKeys + // + this.listBoxAPIKeys.BackColor = System.Drawing.Color.White; + this.listBoxAPIKeys.ContextMenuStrip = this.contextMenuStripEditAPIKeys; + this.listBoxAPIKeys.FormattingEnabled = true; + this.listBoxAPIKeys.ItemHeight = 15; + this.listBoxAPIKeys.Location = new System.Drawing.Point(10, 11); + this.listBoxAPIKeys.Name = "listBoxAPIKeys"; + this.listBoxAPIKeys.Size = new System.Drawing.Size(793, 289); + this.listBoxAPIKeys.TabIndex = 2; + this.listBoxAPIKeys.DoubleClick += new System.EventHandler(this.ListBoxAPIKeys_DoubleClick); + // + // contextMenuStripEditAPIKeys + // + this.contextMenuStripEditAPIKeys.ImageScalingSize = new System.Drawing.Size(20, 20); + this.contextMenuStripEditAPIKeys.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripMenuItemEditKey, this.toolStripMenuItemRemoveKey, this.toolStripSeparatorOne, this.toolStripMenuItemAddKey}); - this.contextMenuStripEditAPIKeys.Name = "contextMenuStripEditAPIKeys"; - this.contextMenuStripEditAPIKeys.Size = new System.Drawing.Size(269, 82); - this.contextMenuStripEditAPIKeys.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripEditAPIKeys_Opening); - // - // toolStripMenuItemEditKey - // - this.toolStripMenuItemEditKey.Name = "toolStripMenuItemEditKey"; - this.toolStripMenuItemEditKey.Size = new System.Drawing.Size(268, 24); - this.toolStripMenuItemEditKey.Text = "Edit the selected API key"; - this.toolStripMenuItemEditKey.Click += new System.EventHandler(this.ToolStripMenuItemEditKey_Click); - // - // toolStripMenuItemRemoveKey - // - this.toolStripMenuItemRemoveKey.Name = "toolStripMenuItemRemoveKey"; - this.toolStripMenuItemRemoveKey.Size = new System.Drawing.Size(268, 24); - this.toolStripMenuItemRemoveKey.Text = "Remove the selected API key"; - this.toolStripMenuItemRemoveKey.Click += new System.EventHandler(this.ToolStripMenuItemRemoveKey_Click); - // - // toolStripSeparatorOne - // - this.toolStripSeparatorOne.Name = "toolStripSeparatorOne"; - this.toolStripSeparatorOne.Size = new System.Drawing.Size(265, 6); - // - // toolStripMenuItemAddKey - // - this.toolStripMenuItemAddKey.Name = "toolStripMenuItemAddKey"; - this.toolStripMenuItemAddKey.Size = new System.Drawing.Size(268, 24); - this.toolStripMenuItemAddKey.Text = "Add a new API key"; - this.toolStripMenuItemAddKey.Click += new System.EventHandler(this.ToolStripMenuItemAddKey_Click); - // - // buttonAddAPIKey - // - this.buttonAddAPIKey.Location = new System.Drawing.Point(767, 409); - this.buttonAddAPIKey.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.buttonAddAPIKey.Name = "buttonAddAPIKey"; - this.buttonAddAPIKey.Size = new System.Drawing.Size(151, 35); - this.buttonAddAPIKey.TabIndex = 3; - this.buttonAddAPIKey.Text = "Add a new API key"; - this.buttonAddAPIKey.UseVisualStyleBackColor = true; - this.buttonAddAPIKey.Click += new System.EventHandler(this.ButtonAddAPIKey_Click); - // - // buttonGetHardstuckBuildLink - // - this.buttonGetHardstuckBuildLink.Location = new System.Drawing.Point(577, 454); - this.buttonGetHardstuckBuildLink.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.buttonGetHardstuckBuildLink.Name = "buttonGetHardstuckBuildLink"; - this.buttonGetHardstuckBuildLink.Size = new System.Drawing.Size(341, 35); - this.buttonGetHardstuckBuildLink.TabIndex = 4; - this.buttonGetHardstuckBuildLink.Text = "Get Hardstuck build link for the current character"; - this.buttonGetHardstuckBuildLink.UseVisualStyleBackColor = true; - this.buttonGetHardstuckBuildLink.Click += new System.EventHandler(this.ButtonGetHardStuckCode_Click); - // - // FormGW2API - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(933, 506); - this.Controls.Add(this.buttonGetHardstuckBuildLink); - this.Controls.Add(this.buttonAddAPIKey); - this.Controls.Add(this.listBoxAPIKeys); - this.Controls.Add(this.labelAPIKeyInfo); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "FormGW2API"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "GW2 API settings"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormGW2API_FormClosing); - this.contextMenuStripEditAPIKeys.ResumeLayout(false); - this.ResumeLayout(false); + this.contextMenuStripEditAPIKeys.Name = "contextMenuStripEditAPIKeys"; + this.contextMenuStripEditAPIKeys.Size = new System.Drawing.Size(226, 76); + this.contextMenuStripEditAPIKeys.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripEditAPIKeys_Opening); + // + // toolStripMenuItemEditKey + // + this.toolStripMenuItemEditKey.Name = "toolStripMenuItemEditKey"; + this.toolStripMenuItemEditKey.Size = new System.Drawing.Size(225, 22); + this.toolStripMenuItemEditKey.Text = "Edit the selected API key"; + this.toolStripMenuItemEditKey.Click += new System.EventHandler(this.ToolStripMenuItemEditKey_Click); + // + // toolStripMenuItemRemoveKey + // + this.toolStripMenuItemRemoveKey.Name = "toolStripMenuItemRemoveKey"; + this.toolStripMenuItemRemoveKey.Size = new System.Drawing.Size(225, 22); + this.toolStripMenuItemRemoveKey.Text = "Remove the selected API key"; + this.toolStripMenuItemRemoveKey.Click += new System.EventHandler(this.ToolStripMenuItemRemoveKey_Click); + // + // toolStripSeparatorOne + // + this.toolStripSeparatorOne.Name = "toolStripSeparatorOne"; + this.toolStripSeparatorOne.Size = new System.Drawing.Size(222, 6); + // + // toolStripMenuItemAddKey + // + this.toolStripMenuItemAddKey.Name = "toolStripMenuItemAddKey"; + this.toolStripMenuItemAddKey.Size = new System.Drawing.Size(225, 22); + this.toolStripMenuItemAddKey.Text = "Add a new API key"; + this.toolStripMenuItemAddKey.Click += new System.EventHandler(this.ToolStripMenuItemAddKey_Click); + // + // buttonAddAPIKey + // + this.buttonAddAPIKey.Location = new System.Drawing.Point(671, 307); + this.buttonAddAPIKey.Margin = new System.Windows.Forms.Padding(4); + this.buttonAddAPIKey.Name = "buttonAddAPIKey"; + this.buttonAddAPIKey.Size = new System.Drawing.Size(132, 26); + this.buttonAddAPIKey.TabIndex = 3; + this.buttonAddAPIKey.Text = "Add a new API key"; + this.buttonAddAPIKey.UseVisualStyleBackColor = true; + this.buttonAddAPIKey.Click += new System.EventHandler(this.ButtonAddAPIKey_Click); + // + // buttonGetHardstuckBuildLink + // + this.buttonGetHardstuckBuildLink.Location = new System.Drawing.Point(478, 340); + this.buttonGetHardstuckBuildLink.Margin = new System.Windows.Forms.Padding(4); + this.buttonGetHardstuckBuildLink.Name = "buttonGetHardstuckBuildLink"; + this.buttonGetHardstuckBuildLink.Size = new System.Drawing.Size(325, 26); + this.buttonGetHardstuckBuildLink.TabIndex = 4; + this.buttonGetHardstuckBuildLink.Text = "Get Hardstuck build link for the current character"; + this.buttonGetHardstuckBuildLink.UseVisualStyleBackColor = true; + this.buttonGetHardstuckBuildLink.Click += new System.EventHandler(this.ButtonGetHardStuckCode_Click); + // + // ButtonBuildCodeCompressionSettings + // + this.ButtonBuildCodeCompressionSettings.Location = new System.Drawing.Point(478, 307); + this.ButtonBuildCodeCompressionSettings.Margin = new System.Windows.Forms.Padding(4); + this.ButtonBuildCodeCompressionSettings.Name = "ButtonBuildCodeCompressionSettings"; + this.ButtonBuildCodeCompressionSettings.Size = new System.Drawing.Size(185, 26); + this.ButtonBuildCodeCompressionSettings.TabIndex = 5; + this.ButtonBuildCodeCompressionSettings.Text = "\'!build\' compression settings"; + this.ButtonBuildCodeCompressionSettings.UseVisualStyleBackColor = true; + this.ButtonBuildCodeCompressionSettings.Click += new System.EventHandler(this.ButtonBuildCodeCompressionSettings_Click); + // + // FormGW2API + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.White; + this.ClientSize = new System.Drawing.Size(816, 380); + this.Controls.Add(this.ButtonBuildCodeCompressionSettings); + this.Controls.Add(this.buttonGetHardstuckBuildLink); + this.Controls.Add(this.buttonAddAPIKey); + this.Controls.Add(this.listBoxAPIKeys); + this.Controls.Add(this.labelAPIKeyInfo); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Margin = new System.Windows.Forms.Padding(4); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "FormGW2API"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "GW2 API settings"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormGW2API_FormClosing); + this.contextMenuStripEditAPIKeys.ResumeLayout(false); + this.ResumeLayout(false); } @@ -158,5 +170,6 @@ private void InitializeComponent() private System.Windows.Forms.Button buttonAddAPIKey; private System.Windows.Forms.Button buttonGetHardstuckBuildLink; private System.Windows.Forms.ToolStripSeparator toolStripSeparatorOne; - } + private System.Windows.Forms.Button ButtonBuildCodeCompressionSettings; + } } \ No newline at end of file diff --git a/Forms/FormGW2API.cs b/Forms/FormGW2API.cs index ce19a7c..1df81be 100644 --- a/Forms/FormGW2API.cs +++ b/Forms/FormGW2API.cs @@ -75,22 +75,33 @@ private void ButtonGetHardStuckCode_Click(object sender, EventArgs e) _ = Task.Run(async () => { using var httpClientController = new HttpClientController(); - foreach (var apiKey in ApplicationSettings.Current.GW2APIs.Where(x => x.Valid)) + var settings = ApplicationSettings.Current; + foreach (var apiKey in settings.GW2APIs.Where(x => x.Valid)) { await apiKey.GetCharacters(httpClientController); } - var trueApiKey = ApplicationSettings.Current.GW2APIs.Find(x => x.Characters.Contains(mainLink.MumbleReader.Data.Identity.Name)); + var trueApiKey = settings.GW2APIs.Find(x => x.Characters.Contains(mainLink.MumbleReader.Data.Identity.Name)); if (trueApiKey is null) { - foreach (var apiKey in ApplicationSettings.Current.GW2APIs.Where(x => x.Valid)) + foreach (var apiKey in settings.GW2APIs.Where(x => x.Valid)) { await apiKey.GetCharacters(httpClientController, true); } - trueApiKey = ApplicationSettings.Current.GW2APIs.Find(x => x.Characters.Contains(mainLink.MumbleReader.Data.Identity.Name)); + trueApiKey = settings.GW2APIs.Find(x => x.Characters.Contains(mainLink.MumbleReader.Data.Identity.Name)); } try { var code = await APILoader.LoadBuildCodeFromCurrentCharacter(trueApiKey.APIKey); + if(settings.BuildCodes.DemoteRunes) { + code.Rune = Static.LegendaryToSuperior(code.Rune); + } + if(settings.BuildCodes.DemoteSigils) { + code.WeaponSet1.Sigil1 = Static.LegendaryToSuperior(code.WeaponSet1.Sigil1); + code.WeaponSet1.Sigil2 = Static.LegendaryToSuperior(code.WeaponSet1.Sigil2); + code.WeaponSet2.Sigil1 = Static.LegendaryToSuperior(code.WeaponSet2.Sigil1); + code.WeaponSet2.Sigil2 = Static.LegendaryToSuperior(code.WeaponSet2.Sigil2); + } + Static.Compress(code, settings.BuildCodes.Compression); mainLink.AddToText($"https://hardstuck.gg/gw2/builds/?b={TextLoader.WriteBuildCode(code)}"); } catch (InvalidAccessTokenException) @@ -113,5 +124,10 @@ private void ButtonGetHardStuckCode_Click(object sender, EventArgs e) }); } } + + private void ButtonBuildCodeCompressionSettings_Click(object sender, EventArgs e) + { + (new FormHSBuildCodeCompressionSettings()).Show(); + } } } diff --git a/Forms/FormHSBuildCodeCompressionSettings.Designer.cs b/Forms/FormHSBuildCodeCompressionSettings.Designer.cs new file mode 100644 index 0000000..b0ed8fe --- /dev/null +++ b/Forms/FormHSBuildCodeCompressionSettings.Designer.cs @@ -0,0 +1,105 @@ +namespace PlenBotLogUploader { + partial class FormHSBuildCodeCompressionSettings { + /// + /// 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() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormHSBuildCodeCompressionSettings)); + this.label1 = new System.Windows.Forms.Label(); + this.CheckBoxDemoteRunes = new System.Windows.Forms.CheckBox(); + this.CheckBoxDemoteSigils = new System.Windows.Forms.CheckBox(); + this.CheckboxListCompressionOptions = new System.Windows.Forms.CheckedListBox(); + this.SuspendLayout(); + // + // label1 + // + this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(564, 45); + this.label1.TabIndex = 0; + this.label1.Text = resources.GetString("label1.Text"); + // + // CheckBoxDemoteRunes + // + this.CheckBoxDemoteRunes.AutoSize = true; + this.CheckBoxDemoteRunes.Location = new System.Drawing.Point(12, 70); + this.CheckBoxDemoteRunes.Name = "CheckBoxDemoteRunes"; + this.CheckBoxDemoteRunes.Size = new System.Drawing.Size(251, 19); + this.CheckBoxDemoteRunes.TabIndex = 1; + this.CheckBoxDemoteRunes.Text = "Demote Runes from Legendary to Superior"; + this.CheckBoxDemoteRunes.UseVisualStyleBackColor = true; + this.CheckBoxDemoteRunes.CheckedChanged += new System.EventHandler(this.CheckBoxDemoteRunes_CheckedChanged); + // + // CheckBoxDemoteSigils + // + this.CheckBoxDemoteSigils.AutoSize = true; + this.CheckBoxDemoteSigils.Location = new System.Drawing.Point(12, 95); + this.CheckBoxDemoteSigils.Name = "CheckBoxDemoteSigils"; + this.CheckBoxDemoteSigils.Size = new System.Drawing.Size(246, 19); + this.CheckBoxDemoteSigils.TabIndex = 2; + this.CheckBoxDemoteSigils.Text = "Demote Sigils from Legendary to Superior"; + this.CheckBoxDemoteSigils.UseVisualStyleBackColor = true; + this.CheckBoxDemoteSigils.CheckedChanged += new System.EventHandler(this.CheckBoxDemoteSigils_CheckedChanged); + // + // CheckboxListCompressionOptions + // + this.CheckboxListCompressionOptions.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Right))); + this.CheckboxListCompressionOptions.FormattingEnabled = true; + this.CheckboxListCompressionOptions.Location = new System.Drawing.Point(311, 65); + this.CheckboxListCompressionOptions.Name = "CheckboxListCompressionOptions"; + this.CheckboxListCompressionOptions.Size = new System.Drawing.Size(265, 166); + this.CheckboxListCompressionOptions.TabIndex = 3; + this.CheckboxListCompressionOptions.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.CheckboxListCompressionOptions_ItemCheck); + // + // FormHSBuildCodeCompressionSettings + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(588, 254); + this.Controls.Add(this.CheckboxListCompressionOptions); + this.Controls.Add(this.CheckBoxDemoteSigils); + this.Controls.Add(this.CheckBoxDemoteRunes); + this.Controls.Add(this.label1); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "FormHSBuildCodeCompressionSettings"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "BuildCode Compression Settings"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.CheckBox CheckBoxDemoteRunes; + private System.Windows.Forms.CheckBox CheckBoxDemoteSigils; + private System.Windows.Forms.CheckedListBox CheckboxListCompressionOptions; + } +} \ No newline at end of file diff --git a/Forms/FormHSBuildCodeCompressionSettings.cs b/Forms/FormHSBuildCodeCompressionSettings.cs new file mode 100644 index 0000000..0d3eb69 --- /dev/null +++ b/Forms/FormHSBuildCodeCompressionSettings.cs @@ -0,0 +1,37 @@ +using PlenBotLogUploader.AppSettings; +using System; +using System.Windows.Forms; +using static Hardstuck.GuildWars2.BuildCodes.V2.Static; + +namespace PlenBotLogUploader +{ + public partial class FormHSBuildCodeCompressionSettings : Form + { + public FormHSBuildCodeCompressionSettings() + { + InitializeComponent(); + + var settings = ApplicationSettings.Current.BuildCodes; + this.CheckBoxDemoteRunes .Checked = settings.DemoteRunes; + this.CheckBoxDemoteSigils.Checked = settings.DemoteSigils; + foreach(var option in Enum.GetValues()) + { + if(option == CompressionOptions.ALL || option == CompressionOptions.NONE) continue; + this.CheckboxListCompressionOptions.Items.Add(option, settings.Compression.HasFlag(option)); + } + } + + private void CheckBoxDemoteRunes_CheckedChanged(object s, EventArgs e) => ApplicationSettings.Current.BuildCodes.DemoteRunes = this.CheckBoxDemoteRunes .Checked; + private void CheckBoxDemoteSigils_CheckedChanged(object s, EventArgs e) => ApplicationSettings.Current.BuildCodes.DemoteSigils = this.CheckBoxDemoteSigils.Checked; + + private void CheckboxListCompressionOptions_ItemCheck(object s, ItemCheckEventArgs e) + { + var compressionOption = (CompressionOptions)this.CheckboxListCompressionOptions.Items[e.Index]; + + if(e.NewValue == CheckState.Checked) + ApplicationSettings.Current.BuildCodes.Compression |= compressionOption; + else + ApplicationSettings.Current.BuildCodes.Compression &= ~compressionOption; + } + } +} diff --git a/Forms/FormHSBuildCodeCompressionSettings.resx b/Forms/FormHSBuildCodeCompressionSettings.resx new file mode 100644 index 0000000..18ecb3a --- /dev/null +++ b/Forms/FormHSBuildCodeCompressionSettings.resx @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + Change how BuildCodes for the '!buld' command are compressed. More is usually better because it shortens the link, but it does technically change some minute details about the build, so you can turn them off. + + \ No newline at end of file diff --git a/Forms/FormMain.cs b/Forms/FormMain.cs index c4c3861..b0da01a 100644 --- a/Forms/FormMain.cs +++ b/Forms/FormMain.cs @@ -6,6 +6,7 @@ using PlenBotLogUploader.DpsReport; using PlenBotLogUploader.GitHub; using PlenBotLogUploader.Gw2Api; +using PlenBotLogUploader.Properties; using PlenBotLogUploader.Tools; using System; using System.Collections.Generic; @@ -1111,7 +1112,7 @@ protected async void ReadMessagesAsync(object sender, IrcMessageEventArgs e) { _ = Task.Run(async () => { - foreach (var apiKey in ApplicationSettings.Current.GW2APIs.Where(x => x.Valid)) + foreach(var apiKey in ApplicationSettings.Current.GW2APIs.Where(x => x.Valid)) { await apiKey.GetCharacters(HttpClientController); } @@ -1125,7 +1126,19 @@ protected async void ReadMessagesAsync(object sender, IrcMessageEventArgs e) try { var code = await APILoader.LoadBuildCodeFromCurrentCharacter(trueApiKey.APIKey); - var message = $"Link to the build: https://hardstuck.gg/gw2/builds/?b={TextLoader.WriteBuildCode(code)}"; + if(ApplicationSettings.Current.BuildCodes.DemoteRunes) + { + code.Rune = Static.LegendaryToSuperior(code.Rune); + } + if(ApplicationSettings.Current.BuildCodes.DemoteSigils) + { + code.WeaponSet1.Sigil1 = Static.LegendaryToSuperior(code.WeaponSet1.Sigil1); + code.WeaponSet1.Sigil2 = Static.LegendaryToSuperior(code.WeaponSet1.Sigil2); + code.WeaponSet2.Sigil1 = Static.LegendaryToSuperior(code.WeaponSet2.Sigil1); + code.WeaponSet2.Sigil2 = Static.LegendaryToSuperior(code.WeaponSet2.Sigil2); + } + Static.Compress(code, ApplicationSettings.Current.BuildCodes.Compression); + var message = $"Link to the build: https://hardstuck.gg/gw2/builds/?b={TextLoader.WriteBuildCode(code)}"; await chatConnect.SendChatMessageAsync(ApplicationSettings.Current.Twitch.ChannelName, message); } catch (InvalidAccessTokenException) From 241519186edfa8a5d741417c0b7f9eda97f809f0 Mon Sep 17 00:00:00 2001 From: Sobrinth Date: Fri, 16 Dec 2022 13:46:14 +0100 Subject: [PATCH 2/4] Use PlenBot icon and make background white --- Forms/FormHSBuildCodeCompressionSettings.Designer.cs | 1 + Forms/FormHSBuildCodeCompressionSettings.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/Forms/FormHSBuildCodeCompressionSettings.Designer.cs b/Forms/FormHSBuildCodeCompressionSettings.Designer.cs index b0ed8fe..74f5fd4 100644 --- a/Forms/FormHSBuildCodeCompressionSettings.Designer.cs +++ b/Forms/FormHSBuildCodeCompressionSettings.Designer.cs @@ -90,6 +90,7 @@ private void InitializeComponent() this.Name = "FormHSBuildCodeCompressionSettings"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "BuildCode Compression Settings"; + this.BackColor = System.Drawing.Color.White; this.ResumeLayout(false); this.PerformLayout(); diff --git a/Forms/FormHSBuildCodeCompressionSettings.cs b/Forms/FormHSBuildCodeCompressionSettings.cs index 0d3eb69..2fe531b 100644 --- a/Forms/FormHSBuildCodeCompressionSettings.cs +++ b/Forms/FormHSBuildCodeCompressionSettings.cs @@ -10,6 +10,7 @@ public partial class FormHSBuildCodeCompressionSettings : Form public FormHSBuildCodeCompressionSettings() { InitializeComponent(); + Icon = Properties.Resources.AppIcon; var settings = ApplicationSettings.Current.BuildCodes; this.CheckBoxDemoteRunes .Checked = settings.DemoteRunes; From bcab8b7deee5eb39c3ce51dd20bbdd4fbfef469c Mon Sep 17 00:00:00 2001 From: Plenyx <1507236+Plenyx@users.noreply.github.com> Date: Fri, 16 Dec 2022 18:09:31 +0100 Subject: [PATCH 3/4] Updates + rename part 1 --- AppSettings/ApplicationSettings.cs | 8 +- AppSettings/ApplicationSettingsBuildCodes.cs | 6 +- Forms/FormGW2API.Designer.cs | 249 +++++++++--------- Forms/FormGW2API.cs | 22 +- ...HSBuildCodeCompressionSettings.Designer.cs | 106 -------- Forms/FormHSBuildCodeCompressionSettings.cs | 38 --- ...sBuildCodeCompressionSettings2.Designer.cs | 108 ++++++++ Forms/FormHsBuildCodeCompressionSettings2.cs | 45 ++++ ... FormHsBuildCodeCompressionSettings2.resx} | 5 +- Forms/FormMain.cs | 23 +- 10 files changed, 311 insertions(+), 299 deletions(-) delete mode 100644 Forms/FormHSBuildCodeCompressionSettings.Designer.cs delete mode 100644 Forms/FormHSBuildCodeCompressionSettings.cs create mode 100644 Forms/FormHsBuildCodeCompressionSettings2.Designer.cs create mode 100644 Forms/FormHsBuildCodeCompressionSettings2.cs rename Forms/{FormHSBuildCodeCompressionSettings.resx => FormHsBuildCodeCompressionSettings2.resx} (88%) diff --git a/AppSettings/ApplicationSettings.cs b/AppSettings/ApplicationSettings.cs index 168e059..d3004a5 100644 --- a/AppSettings/ApplicationSettings.cs +++ b/AppSettings/ApplicationSettings.cs @@ -108,8 +108,8 @@ private static ApplicationSettings DeserialiseFromFile(string loadLocation) [JsonProperty("upload")] internal ApplicationSettingsUpload Upload { get; set; } = new ApplicationSettingsUpload(); - [JsonProperty("buildCodes")] - internal ApplicationSettingsBuildCodes BuildCodes { get; set; } = new(); - #endregion - } + [JsonProperty("buildCodes")] + internal ApplicationSettingsBuildCodes BuildCodes { get; set; } = new(); + #endregion + } } diff --git a/AppSettings/ApplicationSettingsBuildCodes.cs b/AppSettings/ApplicationSettingsBuildCodes.cs index fa0e7f7..01b7eab 100644 --- a/AppSettings/ApplicationSettingsBuildCodes.cs +++ b/AppSettings/ApplicationSettingsBuildCodes.cs @@ -5,8 +5,8 @@ namespace PlenBotLogUploader.AppSettings { internal sealed class ApplicationSettingsBuildCodes { - [JsonProperty("demoteRunes")] internal bool DemoteRunes { get; set; } = true; - [JsonProperty("demoteSigils")] internal bool DemoteSigils { get; set; } = true; - [JsonProperty("compression")] internal CompressionOptions Compression { get; set; } = CompressionOptions.ALL; + [JsonProperty("demoteRunes")] internal bool DemoteRunes { get; set; } = true; + [JsonProperty("demoteSigils")] internal bool DemoteSigils { get; set; } = true; + [JsonProperty("compression")] internal CompressionOptions Compression { get; set; } = CompressionOptions.ALL; } } diff --git a/Forms/FormGW2API.Designer.cs b/Forms/FormGW2API.Designer.cs index 91427b3..ef89ab3 100644 --- a/Forms/FormGW2API.Designer.cs +++ b/Forms/FormGW2API.Designer.cs @@ -28,135 +28,136 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - this.labelAPIKeyInfo = new System.Windows.Forms.Label(); - this.listBoxAPIKeys = new System.Windows.Forms.ListBox(); - this.contextMenuStripEditAPIKeys = new System.Windows.Forms.ContextMenuStrip(this.components); - this.toolStripMenuItemEditKey = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuItemRemoveKey = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparatorOne = new System.Windows.Forms.ToolStripSeparator(); - this.toolStripMenuItemAddKey = new System.Windows.Forms.ToolStripMenuItem(); - this.buttonAddAPIKey = new System.Windows.Forms.Button(); - this.buttonGetHardstuckBuildLink = new System.Windows.Forms.Button(); - this.ButtonBuildCodeCompressionSettings = new System.Windows.Forms.Button(); - this.contextMenuStripEditAPIKeys.SuspendLayout(); - this.SuspendLayout(); - // - // labelAPIKeyInfo - // - this.labelAPIKeyInfo.Location = new System.Drawing.Point(7, 303); - this.labelAPIKeyInfo.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.labelAPIKeyInfo.Name = "labelAPIKeyInfo"; - this.labelAPIKeyInfo.Size = new System.Drawing.Size(491, 68); - this.labelAPIKeyInfo.TabIndex = 1; - this.labelAPIKeyInfo.Text = "API keys are used with \"!ign\" and \"!build\" Twitch commands.\r\nYou do not need to s" + + this.components = new System.ComponentModel.Container(); + this.labelAPIKeyInfo = new System.Windows.Forms.Label(); + this.listBoxAPIKeys = new System.Windows.Forms.ListBox(); + this.contextMenuStripEditAPIKeys = new System.Windows.Forms.ContextMenuStrip(this.components); + this.toolStripMenuItemEditKey = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItemRemoveKey = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparatorOne = new System.Windows.Forms.ToolStripSeparator(); + this.toolStripMenuItemAddKey = new System.Windows.Forms.ToolStripMenuItem(); + this.buttonAddAPIKey = new System.Windows.Forms.Button(); + this.buttonGetHardstuckBuildLink = new System.Windows.Forms.Button(); + this.ButtonBuildCodeCompressionSettings = new System.Windows.Forms.Button(); + this.contextMenuStripEditAPIKeys.SuspendLayout(); + this.SuspendLayout(); + // + // labelAPIKeyInfo + // + this.labelAPIKeyInfo.Location = new System.Drawing.Point(8, 404); + this.labelAPIKeyInfo.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.labelAPIKeyInfo.Name = "labelAPIKeyInfo"; + this.labelAPIKeyInfo.Size = new System.Drawing.Size(474, 91); + this.labelAPIKeyInfo.TabIndex = 1; + this.labelAPIKeyInfo.Text = "API keys are used with \"!ign\" and \"!build\" Twitch commands.\r\nYou do not need to s" + "et it unless you want to use these Twitch commands."; - this.labelAPIKeyInfo.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // listBoxAPIKeys - // - this.listBoxAPIKeys.BackColor = System.Drawing.Color.White; - this.listBoxAPIKeys.ContextMenuStrip = this.contextMenuStripEditAPIKeys; - this.listBoxAPIKeys.FormattingEnabled = true; - this.listBoxAPIKeys.ItemHeight = 15; - this.listBoxAPIKeys.Location = new System.Drawing.Point(10, 11); - this.listBoxAPIKeys.Name = "listBoxAPIKeys"; - this.listBoxAPIKeys.Size = new System.Drawing.Size(793, 289); - this.listBoxAPIKeys.TabIndex = 2; - this.listBoxAPIKeys.DoubleClick += new System.EventHandler(this.ListBoxAPIKeys_DoubleClick); - // - // contextMenuStripEditAPIKeys - // - this.contextMenuStripEditAPIKeys.ImageScalingSize = new System.Drawing.Size(20, 20); - this.contextMenuStripEditAPIKeys.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.labelAPIKeyInfo.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // listBoxAPIKeys + // + this.listBoxAPIKeys.BackColor = System.Drawing.Color.White; + this.listBoxAPIKeys.ContextMenuStrip = this.contextMenuStripEditAPIKeys; + this.listBoxAPIKeys.FormattingEnabled = true; + this.listBoxAPIKeys.ItemHeight = 20; + this.listBoxAPIKeys.Location = new System.Drawing.Point(11, 15); + this.listBoxAPIKeys.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.listBoxAPIKeys.Name = "listBoxAPIKeys"; + this.listBoxAPIKeys.Size = new System.Drawing.Size(906, 384); + this.listBoxAPIKeys.TabIndex = 2; + this.listBoxAPIKeys.DoubleClick += new System.EventHandler(this.ListBoxAPIKeys_DoubleClick); + // + // contextMenuStripEditAPIKeys + // + this.contextMenuStripEditAPIKeys.ImageScalingSize = new System.Drawing.Size(20, 20); + this.contextMenuStripEditAPIKeys.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripMenuItemEditKey, this.toolStripMenuItemRemoveKey, this.toolStripSeparatorOne, this.toolStripMenuItemAddKey}); - this.contextMenuStripEditAPIKeys.Name = "contextMenuStripEditAPIKeys"; - this.contextMenuStripEditAPIKeys.Size = new System.Drawing.Size(226, 76); - this.contextMenuStripEditAPIKeys.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripEditAPIKeys_Opening); - // - // toolStripMenuItemEditKey - // - this.toolStripMenuItemEditKey.Name = "toolStripMenuItemEditKey"; - this.toolStripMenuItemEditKey.Size = new System.Drawing.Size(225, 22); - this.toolStripMenuItemEditKey.Text = "Edit the selected API key"; - this.toolStripMenuItemEditKey.Click += new System.EventHandler(this.ToolStripMenuItemEditKey_Click); - // - // toolStripMenuItemRemoveKey - // - this.toolStripMenuItemRemoveKey.Name = "toolStripMenuItemRemoveKey"; - this.toolStripMenuItemRemoveKey.Size = new System.Drawing.Size(225, 22); - this.toolStripMenuItemRemoveKey.Text = "Remove the selected API key"; - this.toolStripMenuItemRemoveKey.Click += new System.EventHandler(this.ToolStripMenuItemRemoveKey_Click); - // - // toolStripSeparatorOne - // - this.toolStripSeparatorOne.Name = "toolStripSeparatorOne"; - this.toolStripSeparatorOne.Size = new System.Drawing.Size(222, 6); - // - // toolStripMenuItemAddKey - // - this.toolStripMenuItemAddKey.Name = "toolStripMenuItemAddKey"; - this.toolStripMenuItemAddKey.Size = new System.Drawing.Size(225, 22); - this.toolStripMenuItemAddKey.Text = "Add a new API key"; - this.toolStripMenuItemAddKey.Click += new System.EventHandler(this.ToolStripMenuItemAddKey_Click); - // - // buttonAddAPIKey - // - this.buttonAddAPIKey.Location = new System.Drawing.Point(671, 307); - this.buttonAddAPIKey.Margin = new System.Windows.Forms.Padding(4); - this.buttonAddAPIKey.Name = "buttonAddAPIKey"; - this.buttonAddAPIKey.Size = new System.Drawing.Size(132, 26); - this.buttonAddAPIKey.TabIndex = 3; - this.buttonAddAPIKey.Text = "Add a new API key"; - this.buttonAddAPIKey.UseVisualStyleBackColor = true; - this.buttonAddAPIKey.Click += new System.EventHandler(this.ButtonAddAPIKey_Click); - // - // buttonGetHardstuckBuildLink - // - this.buttonGetHardstuckBuildLink.Location = new System.Drawing.Point(478, 340); - this.buttonGetHardstuckBuildLink.Margin = new System.Windows.Forms.Padding(4); - this.buttonGetHardstuckBuildLink.Name = "buttonGetHardstuckBuildLink"; - this.buttonGetHardstuckBuildLink.Size = new System.Drawing.Size(325, 26); - this.buttonGetHardstuckBuildLink.TabIndex = 4; - this.buttonGetHardstuckBuildLink.Text = "Get Hardstuck build link for the current character"; - this.buttonGetHardstuckBuildLink.UseVisualStyleBackColor = true; - this.buttonGetHardstuckBuildLink.Click += new System.EventHandler(this.ButtonGetHardStuckCode_Click); - // - // ButtonBuildCodeCompressionSettings - // - this.ButtonBuildCodeCompressionSettings.Location = new System.Drawing.Point(478, 307); - this.ButtonBuildCodeCompressionSettings.Margin = new System.Windows.Forms.Padding(4); - this.ButtonBuildCodeCompressionSettings.Name = "ButtonBuildCodeCompressionSettings"; - this.ButtonBuildCodeCompressionSettings.Size = new System.Drawing.Size(185, 26); - this.ButtonBuildCodeCompressionSettings.TabIndex = 5; - this.ButtonBuildCodeCompressionSettings.Text = "\'!build\' compression settings"; - this.ButtonBuildCodeCompressionSettings.UseVisualStyleBackColor = true; - this.ButtonBuildCodeCompressionSettings.Click += new System.EventHandler(this.ButtonBuildCodeCompressionSettings_Click); - // - // FormGW2API - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(816, 380); - this.Controls.Add(this.ButtonBuildCodeCompressionSettings); - this.Controls.Add(this.buttonGetHardstuckBuildLink); - this.Controls.Add(this.buttonAddAPIKey); - this.Controls.Add(this.listBoxAPIKeys); - this.Controls.Add(this.labelAPIKeyInfo); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.Margin = new System.Windows.Forms.Padding(4); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "FormGW2API"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "GW2 API settings"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormGW2API_FormClosing); - this.contextMenuStripEditAPIKeys.ResumeLayout(false); - this.ResumeLayout(false); + this.contextMenuStripEditAPIKeys.Name = "contextMenuStripEditAPIKeys"; + this.contextMenuStripEditAPIKeys.Size = new System.Drawing.Size(269, 82); + this.contextMenuStripEditAPIKeys.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripEditAPIKeys_Opening); + // + // toolStripMenuItemEditKey + // + this.toolStripMenuItemEditKey.Name = "toolStripMenuItemEditKey"; + this.toolStripMenuItemEditKey.Size = new System.Drawing.Size(268, 24); + this.toolStripMenuItemEditKey.Text = "Edit the selected API key"; + this.toolStripMenuItemEditKey.Click += new System.EventHandler(this.ToolStripMenuItemEditKey_Click); + // + // toolStripMenuItemRemoveKey + // + this.toolStripMenuItemRemoveKey.Name = "toolStripMenuItemRemoveKey"; + this.toolStripMenuItemRemoveKey.Size = new System.Drawing.Size(268, 24); + this.toolStripMenuItemRemoveKey.Text = "Remove the selected API key"; + this.toolStripMenuItemRemoveKey.Click += new System.EventHandler(this.ToolStripMenuItemRemoveKey_Click); + // + // toolStripSeparatorOne + // + this.toolStripSeparatorOne.Name = "toolStripSeparatorOne"; + this.toolStripSeparatorOne.Size = new System.Drawing.Size(265, 6); + // + // toolStripMenuItemAddKey + // + this.toolStripMenuItemAddKey.Name = "toolStripMenuItemAddKey"; + this.toolStripMenuItemAddKey.Size = new System.Drawing.Size(268, 24); + this.toolStripMenuItemAddKey.Text = "Add a new API key"; + this.toolStripMenuItemAddKey.Click += new System.EventHandler(this.ToolStripMenuItemAddKey_Click); + // + // buttonAddAPIKey + // + this.buttonAddAPIKey.Location = new System.Drawing.Point(767, 409); + this.buttonAddAPIKey.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5); + this.buttonAddAPIKey.Name = "buttonAddAPIKey"; + this.buttonAddAPIKey.Size = new System.Drawing.Size(151, 35); + this.buttonAddAPIKey.TabIndex = 3; + this.buttonAddAPIKey.Text = "Add a new API key"; + this.buttonAddAPIKey.UseVisualStyleBackColor = true; + this.buttonAddAPIKey.Click += new System.EventHandler(this.ButtonAddAPIKey_Click); + // + // buttonGetHardstuckBuildLink + // + this.buttonGetHardstuckBuildLink.Location = new System.Drawing.Point(492, 453); + this.buttonGetHardstuckBuildLink.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5); + this.buttonGetHardstuckBuildLink.Name = "buttonGetHardstuckBuildLink"; + this.buttonGetHardstuckBuildLink.Size = new System.Drawing.Size(425, 35); + this.buttonGetHardstuckBuildLink.TabIndex = 4; + this.buttonGetHardstuckBuildLink.Text = "Get Hardstuck build link for the current character"; + this.buttonGetHardstuckBuildLink.UseVisualStyleBackColor = true; + this.buttonGetHardstuckBuildLink.Click += new System.EventHandler(this.ButtonGetHardStuckCode_Click); + // + // ButtonBuildCodeCompressionSettings + // + this.ButtonBuildCodeCompressionSettings.Location = new System.Drawing.Point(492, 409); + this.ButtonBuildCodeCompressionSettings.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5); + this.ButtonBuildCodeCompressionSettings.Name = "ButtonBuildCodeCompressionSettings"; + this.ButtonBuildCodeCompressionSettings.Size = new System.Drawing.Size(265, 35); + this.ButtonBuildCodeCompressionSettings.TabIndex = 5; + this.ButtonBuildCodeCompressionSettings.Text = "Hardstuck build compression settings"; + this.ButtonBuildCodeCompressionSettings.UseVisualStyleBackColor = true; + this.ButtonBuildCodeCompressionSettings.Click += new System.EventHandler(this.ButtonBuildCodeCompressionSettings_Click); + // + // FormGW2API + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.White; + this.ClientSize = new System.Drawing.Size(933, 507); + this.Controls.Add(this.ButtonBuildCodeCompressionSettings); + this.Controls.Add(this.buttonGetHardstuckBuildLink); + this.Controls.Add(this.buttonAddAPIKey); + this.Controls.Add(this.listBoxAPIKeys); + this.Controls.Add(this.labelAPIKeyInfo); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "FormGW2API"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "GW2 API settings"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormGW2API_FormClosing); + this.contextMenuStripEditAPIKeys.ResumeLayout(false); + this.ResumeLayout(false); } diff --git a/Forms/FormGW2API.cs b/Forms/FormGW2API.cs index 1df81be..b0186ac 100644 --- a/Forms/FormGW2API.cs +++ b/Forms/FormGW2API.cs @@ -92,16 +92,18 @@ private void ButtonGetHardStuckCode_Click(object sender, EventArgs e) try { var code = await APILoader.LoadBuildCodeFromCurrentCharacter(trueApiKey.APIKey); - if(settings.BuildCodes.DemoteRunes) { + if (settings.BuildCodes.DemoteRunes) + { code.Rune = Static.LegendaryToSuperior(code.Rune); - } - if(settings.BuildCodes.DemoteSigils) { - code.WeaponSet1.Sigil1 = Static.LegendaryToSuperior(code.WeaponSet1.Sigil1); - code.WeaponSet1.Sigil2 = Static.LegendaryToSuperior(code.WeaponSet1.Sigil2); - code.WeaponSet2.Sigil1 = Static.LegendaryToSuperior(code.WeaponSet2.Sigil1); - code.WeaponSet2.Sigil2 = Static.LegendaryToSuperior(code.WeaponSet2.Sigil2); - } - Static.Compress(code, settings.BuildCodes.Compression); + } + if (settings.BuildCodes.DemoteSigils) + { + code.WeaponSet1.Sigil1 = Static.LegendaryToSuperior(code.WeaponSet1.Sigil1); + code.WeaponSet1.Sigil2 = Static.LegendaryToSuperior(code.WeaponSet1.Sigil2); + code.WeaponSet2.Sigil1 = Static.LegendaryToSuperior(code.WeaponSet2.Sigil1); + code.WeaponSet2.Sigil2 = Static.LegendaryToSuperior(code.WeaponSet2.Sigil2); + } + Static.Compress(code, settings.BuildCodes.Compression); mainLink.AddToText($"https://hardstuck.gg/gw2/builds/?b={TextLoader.WriteBuildCode(code)}"); } catch (InvalidAccessTokenException) @@ -127,7 +129,7 @@ private void ButtonGetHardStuckCode_Click(object sender, EventArgs e) private void ButtonBuildCodeCompressionSettings_Click(object sender, EventArgs e) { - (new FormHSBuildCodeCompressionSettings()).Show(); + (new FormHsBuildCodeCompressionSettings2()).ShowDialog(); } } } diff --git a/Forms/FormHSBuildCodeCompressionSettings.Designer.cs b/Forms/FormHSBuildCodeCompressionSettings.Designer.cs deleted file mode 100644 index 74f5fd4..0000000 --- a/Forms/FormHSBuildCodeCompressionSettings.Designer.cs +++ /dev/null @@ -1,106 +0,0 @@ -namespace PlenBotLogUploader { - partial class FormHSBuildCodeCompressionSettings { - /// - /// 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() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormHSBuildCodeCompressionSettings)); - this.label1 = new System.Windows.Forms.Label(); - this.CheckBoxDemoteRunes = new System.Windows.Forms.CheckBox(); - this.CheckBoxDemoteSigils = new System.Windows.Forms.CheckBox(); - this.CheckboxListCompressionOptions = new System.Windows.Forms.CheckedListBox(); - this.SuspendLayout(); - // - // label1 - // - this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.label1.Location = new System.Drawing.Point(12, 9); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(564, 45); - this.label1.TabIndex = 0; - this.label1.Text = resources.GetString("label1.Text"); - // - // CheckBoxDemoteRunes - // - this.CheckBoxDemoteRunes.AutoSize = true; - this.CheckBoxDemoteRunes.Location = new System.Drawing.Point(12, 70); - this.CheckBoxDemoteRunes.Name = "CheckBoxDemoteRunes"; - this.CheckBoxDemoteRunes.Size = new System.Drawing.Size(251, 19); - this.CheckBoxDemoteRunes.TabIndex = 1; - this.CheckBoxDemoteRunes.Text = "Demote Runes from Legendary to Superior"; - this.CheckBoxDemoteRunes.UseVisualStyleBackColor = true; - this.CheckBoxDemoteRunes.CheckedChanged += new System.EventHandler(this.CheckBoxDemoteRunes_CheckedChanged); - // - // CheckBoxDemoteSigils - // - this.CheckBoxDemoteSigils.AutoSize = true; - this.CheckBoxDemoteSigils.Location = new System.Drawing.Point(12, 95); - this.CheckBoxDemoteSigils.Name = "CheckBoxDemoteSigils"; - this.CheckBoxDemoteSigils.Size = new System.Drawing.Size(246, 19); - this.CheckBoxDemoteSigils.TabIndex = 2; - this.CheckBoxDemoteSigils.Text = "Demote Sigils from Legendary to Superior"; - this.CheckBoxDemoteSigils.UseVisualStyleBackColor = true; - this.CheckBoxDemoteSigils.CheckedChanged += new System.EventHandler(this.CheckBoxDemoteSigils_CheckedChanged); - // - // CheckboxListCompressionOptions - // - this.CheckboxListCompressionOptions.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Right))); - this.CheckboxListCompressionOptions.FormattingEnabled = true; - this.CheckboxListCompressionOptions.Location = new System.Drawing.Point(311, 65); - this.CheckboxListCompressionOptions.Name = "CheckboxListCompressionOptions"; - this.CheckboxListCompressionOptions.Size = new System.Drawing.Size(265, 166); - this.CheckboxListCompressionOptions.TabIndex = 3; - this.CheckboxListCompressionOptions.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.CheckboxListCompressionOptions_ItemCheck); - // - // FormHSBuildCodeCompressionSettings - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(588, 254); - this.Controls.Add(this.CheckboxListCompressionOptions); - this.Controls.Add(this.CheckBoxDemoteSigils); - this.Controls.Add(this.CheckBoxDemoteRunes); - this.Controls.Add(this.label1); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "FormHSBuildCodeCompressionSettings"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "BuildCode Compression Settings"; - this.BackColor = System.Drawing.Color.White; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Label label1; - private System.Windows.Forms.CheckBox CheckBoxDemoteRunes; - private System.Windows.Forms.CheckBox CheckBoxDemoteSigils; - private System.Windows.Forms.CheckedListBox CheckboxListCompressionOptions; - } -} \ No newline at end of file diff --git a/Forms/FormHSBuildCodeCompressionSettings.cs b/Forms/FormHSBuildCodeCompressionSettings.cs deleted file mode 100644 index 2fe531b..0000000 --- a/Forms/FormHSBuildCodeCompressionSettings.cs +++ /dev/null @@ -1,38 +0,0 @@ -using PlenBotLogUploader.AppSettings; -using System; -using System.Windows.Forms; -using static Hardstuck.GuildWars2.BuildCodes.V2.Static; - -namespace PlenBotLogUploader -{ - public partial class FormHSBuildCodeCompressionSettings : Form - { - public FormHSBuildCodeCompressionSettings() - { - InitializeComponent(); - Icon = Properties.Resources.AppIcon; - - var settings = ApplicationSettings.Current.BuildCodes; - this.CheckBoxDemoteRunes .Checked = settings.DemoteRunes; - this.CheckBoxDemoteSigils.Checked = settings.DemoteSigils; - foreach(var option in Enum.GetValues()) - { - if(option == CompressionOptions.ALL || option == CompressionOptions.NONE) continue; - this.CheckboxListCompressionOptions.Items.Add(option, settings.Compression.HasFlag(option)); - } - } - - private void CheckBoxDemoteRunes_CheckedChanged(object s, EventArgs e) => ApplicationSettings.Current.BuildCodes.DemoteRunes = this.CheckBoxDemoteRunes .Checked; - private void CheckBoxDemoteSigils_CheckedChanged(object s, EventArgs e) => ApplicationSettings.Current.BuildCodes.DemoteSigils = this.CheckBoxDemoteSigils.Checked; - - private void CheckboxListCompressionOptions_ItemCheck(object s, ItemCheckEventArgs e) - { - var compressionOption = (CompressionOptions)this.CheckboxListCompressionOptions.Items[e.Index]; - - if(e.NewValue == CheckState.Checked) - ApplicationSettings.Current.BuildCodes.Compression |= compressionOption; - else - ApplicationSettings.Current.BuildCodes.Compression &= ~compressionOption; - } - } -} diff --git a/Forms/FormHsBuildCodeCompressionSettings2.Designer.cs b/Forms/FormHsBuildCodeCompressionSettings2.Designer.cs new file mode 100644 index 0000000..23139d9 --- /dev/null +++ b/Forms/FormHsBuildCodeCompressionSettings2.Designer.cs @@ -0,0 +1,108 @@ +namespace PlenBotLogUploader +{ + partial class FormHsBuildCodeCompressionSettings2 + { + /// + /// 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() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormHsBuildCodeCompressionSettings2)); + this.labelCompressionSettings = new System.Windows.Forms.Label(); + this.checkBoxDemoteRunes = new System.Windows.Forms.CheckBox(); + this.checkBoxDemoteSigils = new System.Windows.Forms.CheckBox(); + this.checkboxListCompressionOptions = new System.Windows.Forms.CheckedListBox(); + this.SuspendLayout(); + // + // labelCompressionSettings + // + this.labelCompressionSettings.Location = new System.Drawing.Point(14, 12); + this.labelCompressionSettings.Name = "labelCompressionSettings"; + this.labelCompressionSettings.Size = new System.Drawing.Size(645, 60); + this.labelCompressionSettings.TabIndex = 0; + this.labelCompressionSettings.Text = resources.GetString("labelCompressionSettings.Text"); + // + // checkBoxDemoteRunes + // + this.checkBoxDemoteRunes.AutoSize = true; + this.checkBoxDemoteRunes.Location = new System.Drawing.Point(14, 93); + this.checkBoxDemoteRunes.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.checkBoxDemoteRunes.Name = "checkBoxDemoteRunes"; + this.checkBoxDemoteRunes.Size = new System.Drawing.Size(315, 24); + this.checkBoxDemoteRunes.TabIndex = 1; + this.checkBoxDemoteRunes.Text = "Demote Runes from Legendary to Superior"; + this.checkBoxDemoteRunes.UseVisualStyleBackColor = true; + this.checkBoxDemoteRunes.CheckedChanged += new System.EventHandler(this.CheckBoxDemoteRunes_CheckedChanged); + // + // checkBoxDemoteSigils + // + this.checkBoxDemoteSigils.AutoSize = true; + this.checkBoxDemoteSigils.Location = new System.Drawing.Point(14, 127); + this.checkBoxDemoteSigils.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.checkBoxDemoteSigils.Name = "checkBoxDemoteSigils"; + this.checkBoxDemoteSigils.Size = new System.Drawing.Size(311, 24); + this.checkBoxDemoteSigils.TabIndex = 2; + this.checkBoxDemoteSigils.Text = "Demote Sigils from Legendary to Superior"; + this.checkBoxDemoteSigils.UseVisualStyleBackColor = true; + this.checkBoxDemoteSigils.CheckedChanged += new System.EventHandler(this.CheckBoxDemoteSigils_CheckedChanged); + // + // checkboxListCompressionOptions + // + this.checkboxListCompressionOptions.FormattingEnabled = true; + this.checkboxListCompressionOptions.Location = new System.Drawing.Point(355, 87); + this.checkboxListCompressionOptions.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.checkboxListCompressionOptions.Name = "checkboxListCompressionOptions"; + this.checkboxListCompressionOptions.Size = new System.Drawing.Size(302, 158); + this.checkboxListCompressionOptions.TabIndex = 3; + this.checkboxListCompressionOptions.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.CheckboxListCompressionOptions_ItemCheck); + // + // FormHsBuildCodeCompressionSettings + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.White; + this.ClientSize = new System.Drawing.Size(672, 259); + this.Controls.Add(this.checkboxListCompressionOptions); + this.Controls.Add(this.checkBoxDemoteSigils); + this.Controls.Add(this.checkBoxDemoteRunes); + this.Controls.Add(this.labelCompressionSettings); + this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "FormHsBuildCodeCompressionSettings"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "BuildCode Compression Settings"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label labelCompressionSettings; + private System.Windows.Forms.CheckBox checkBoxDemoteRunes; + private System.Windows.Forms.CheckBox checkBoxDemoteSigils; + private System.Windows.Forms.CheckedListBox checkboxListCompressionOptions; + } +} \ No newline at end of file diff --git a/Forms/FormHsBuildCodeCompressionSettings2.cs b/Forms/FormHsBuildCodeCompressionSettings2.cs new file mode 100644 index 0000000..8986dbd --- /dev/null +++ b/Forms/FormHsBuildCodeCompressionSettings2.cs @@ -0,0 +1,45 @@ +using PlenBotLogUploader.AppSettings; +using System; +using System.Windows.Forms; +using static Hardstuck.GuildWars2.BuildCodes.V2.Static; + +namespace PlenBotLogUploader +{ + public partial class FormHsBuildCodeCompressionSettings2 : Form + { + public FormHsBuildCodeCompressionSettings2() + { + InitializeComponent(); + Icon = Properties.Resources.AppIcon; + + var settings = ApplicationSettings.Current.BuildCodes; + checkBoxDemoteRunes.Checked = settings.DemoteRunes; + checkBoxDemoteSigils.Checked = settings.DemoteSigils; + foreach (var option in Enum.GetValues()) + { + if ((option == CompressionOptions.ALL) || (option == CompressionOptions.NONE)) + { + continue; + } + checkboxListCompressionOptions.Items.Add(option, settings.Compression.HasFlag(option)); + } + } + + private void CheckBoxDemoteRunes_CheckedChanged(object s, EventArgs e) => ApplicationSettings.Current.BuildCodes.DemoteRunes = checkBoxDemoteRunes.Checked; + private void CheckBoxDemoteSigils_CheckedChanged(object s, EventArgs e) => ApplicationSettings.Current.BuildCodes.DemoteSigils = checkBoxDemoteSigils.Checked; + + private void CheckboxListCompressionOptions_ItemCheck(object s, ItemCheckEventArgs e) + { + var compressionOption = (CompressionOptions)checkboxListCompressionOptions.Items[e.Index]; + + if (e.NewValue == CheckState.Checked) + { + ApplicationSettings.Current.BuildCodes.Compression |= compressionOption; + } + else + { + ApplicationSettings.Current.BuildCodes.Compression &= ~compressionOption; + } + } + } +} diff --git a/Forms/FormHSBuildCodeCompressionSettings.resx b/Forms/FormHsBuildCodeCompressionSettings2.resx similarity index 88% rename from Forms/FormHSBuildCodeCompressionSettings.resx rename to Forms/FormHsBuildCodeCompressionSettings2.resx index 18ecb3a..819525d 100644 --- a/Forms/FormHSBuildCodeCompressionSettings.resx +++ b/Forms/FormHsBuildCodeCompressionSettings2.resx @@ -57,7 +57,8 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Change how BuildCodes for the '!buld' command are compressed. More is usually better because it shortens the link, but it does technically change some minute details about the build, so you can turn them off. + + Change how Hardstuck build codes are compressed here. More compression is usually better because it shortens the URL link, but it does technically change some minute details about the build. If you want to preserve all build information, you can disable the compression here. + \ No newline at end of file diff --git a/Forms/FormMain.cs b/Forms/FormMain.cs index b0da01a..bd61f7a 100644 --- a/Forms/FormMain.cs +++ b/Forms/FormMain.cs @@ -6,7 +6,6 @@ using PlenBotLogUploader.DpsReport; using PlenBotLogUploader.GitHub; using PlenBotLogUploader.Gw2Api; -using PlenBotLogUploader.Properties; using PlenBotLogUploader.Tools; using System; using System.Collections.Generic; @@ -1112,7 +1111,7 @@ protected async void ReadMessagesAsync(object sender, IrcMessageEventArgs e) { _ = Task.Run(async () => { - foreach(var apiKey in ApplicationSettings.Current.GW2APIs.Where(x => x.Valid)) + foreach (var apiKey in ApplicationSettings.Current.GW2APIs.Where(x => x.Valid)) { await apiKey.GetCharacters(HttpClientController); } @@ -1126,19 +1125,19 @@ protected async void ReadMessagesAsync(object sender, IrcMessageEventArgs e) try { var code = await APILoader.LoadBuildCodeFromCurrentCharacter(trueApiKey.APIKey); - if(ApplicationSettings.Current.BuildCodes.DemoteRunes) - { - code.Rune = Static.LegendaryToSuperior(code.Rune); + if (ApplicationSettings.Current.BuildCodes.DemoteRunes) + { + code.Rune = Static.LegendaryToSuperior(code.Rune); } - if(ApplicationSettings.Current.BuildCodes.DemoteSigils) - { - code.WeaponSet1.Sigil1 = Static.LegendaryToSuperior(code.WeaponSet1.Sigil1); - code.WeaponSet1.Sigil2 = Static.LegendaryToSuperior(code.WeaponSet1.Sigil2); - code.WeaponSet2.Sigil1 = Static.LegendaryToSuperior(code.WeaponSet2.Sigil1); - code.WeaponSet2.Sigil2 = Static.LegendaryToSuperior(code.WeaponSet2.Sigil2); + if (ApplicationSettings.Current.BuildCodes.DemoteSigils) + { + code.WeaponSet1.Sigil1 = Static.LegendaryToSuperior(code.WeaponSet1.Sigil1); + code.WeaponSet1.Sigil2 = Static.LegendaryToSuperior(code.WeaponSet1.Sigil2); + code.WeaponSet2.Sigil1 = Static.LegendaryToSuperior(code.WeaponSet2.Sigil1); + code.WeaponSet2.Sigil2 = Static.LegendaryToSuperior(code.WeaponSet2.Sigil2); } Static.Compress(code, ApplicationSettings.Current.BuildCodes.Compression); - var message = $"Link to the build: https://hardstuck.gg/gw2/builds/?b={TextLoader.WriteBuildCode(code)}"; + var message = $"Link to the build: https://hardstuck.gg/gw2/builds/?b={TextLoader.WriteBuildCode(code)}"; await chatConnect.SendChatMessageAsync(ApplicationSettings.Current.Twitch.ChannelName, message); } catch (InvalidAccessTokenException) From d441a59e4391f95da11008c6f1db47ab836ffbb5 Mon Sep 17 00:00:00 2001 From: Plenyx <1507236+Plenyx@users.noreply.github.com> Date: Fri, 16 Dec 2022 18:10:11 +0100 Subject: [PATCH 4/4] Updates + rename part 2 --- Forms/FormGW2API.cs | 2 +- ...gner.cs => FormHsBuildCodeCompressionSettings.Designer.cs} | 4 ++-- ...sionSettings2.cs => FormHsBuildCodeCompressionSettings.cs} | 4 ++-- ...Settings2.resx => FormHsBuildCodeCompressionSettings.resx} | 0 4 files changed, 5 insertions(+), 5 deletions(-) rename Forms/{FormHsBuildCodeCompressionSettings2.Designer.cs => FormHsBuildCodeCompressionSettings.Designer.cs} (98%) rename Forms/{FormHsBuildCodeCompressionSettings2.cs => FormHsBuildCodeCompressionSettings.cs} (93%) rename Forms/{FormHsBuildCodeCompressionSettings2.resx => FormHsBuildCodeCompressionSettings.resx} (100%) diff --git a/Forms/FormGW2API.cs b/Forms/FormGW2API.cs index b0186ac..b46eaa0 100644 --- a/Forms/FormGW2API.cs +++ b/Forms/FormGW2API.cs @@ -129,7 +129,7 @@ private void ButtonGetHardStuckCode_Click(object sender, EventArgs e) private void ButtonBuildCodeCompressionSettings_Click(object sender, EventArgs e) { - (new FormHsBuildCodeCompressionSettings2()).ShowDialog(); + (new FormHsBuildCodeCompressionSettings()).ShowDialog(); } } } diff --git a/Forms/FormHsBuildCodeCompressionSettings2.Designer.cs b/Forms/FormHsBuildCodeCompressionSettings.Designer.cs similarity index 98% rename from Forms/FormHsBuildCodeCompressionSettings2.Designer.cs rename to Forms/FormHsBuildCodeCompressionSettings.Designer.cs index 23139d9..0b25f00 100644 --- a/Forms/FormHsBuildCodeCompressionSettings2.Designer.cs +++ b/Forms/FormHsBuildCodeCompressionSettings.Designer.cs @@ -1,6 +1,6 @@ namespace PlenBotLogUploader { - partial class FormHsBuildCodeCompressionSettings2 + partial class FormHsBuildCodeCompressionSettings { /// /// Required designer variable. @@ -28,7 +28,7 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormHsBuildCodeCompressionSettings2)); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormHsBuildCodeCompressionSettings)); this.labelCompressionSettings = new System.Windows.Forms.Label(); this.checkBoxDemoteRunes = new System.Windows.Forms.CheckBox(); this.checkBoxDemoteSigils = new System.Windows.Forms.CheckBox(); diff --git a/Forms/FormHsBuildCodeCompressionSettings2.cs b/Forms/FormHsBuildCodeCompressionSettings.cs similarity index 93% rename from Forms/FormHsBuildCodeCompressionSettings2.cs rename to Forms/FormHsBuildCodeCompressionSettings.cs index 8986dbd..0878c71 100644 --- a/Forms/FormHsBuildCodeCompressionSettings2.cs +++ b/Forms/FormHsBuildCodeCompressionSettings.cs @@ -5,9 +5,9 @@ namespace PlenBotLogUploader { - public partial class FormHsBuildCodeCompressionSettings2 : Form + public partial class FormHsBuildCodeCompressionSettings : Form { - public FormHsBuildCodeCompressionSettings2() + public FormHsBuildCodeCompressionSettings() { InitializeComponent(); Icon = Properties.Resources.AppIcon; diff --git a/Forms/FormHsBuildCodeCompressionSettings2.resx b/Forms/FormHsBuildCodeCompressionSettings.resx similarity index 100% rename from Forms/FormHsBuildCodeCompressionSettings2.resx rename to Forms/FormHsBuildCodeCompressionSettings.resx