From e548bfe90bc66ba2d6082847904c873fa4793eb7 Mon Sep 17 00:00:00 2001 From: AiiR <22158489+ImAiiR@users.noreply.github.com> Date: Sat, 15 Aug 2020 00:43:54 -0400 Subject: [PATCH] 0.9.9.21 - Added another debug option for Re-enabling disabled buttons and checkboxes, for if anything goes wrong and they don't get re-enabled automatically. - Added a Hide button in debug options - Added a way for users to change the max length for filenames. There's a limit at 110 to avoid errors. If you still get errors with 110, just lower the value to download, but still create an issue with the error, and provide a link to the release, so I can check what a new limit should be. - Added a line of code before grabbing tags to set composer to `null`, as sometimes QBDLX would keep the old value from another release and use it for another. --- QobuzDownloaderX/App.config | 3 + QobuzDownloaderX/Form1.Designer.cs | 111 ++++++++++++++++-- QobuzDownloaderX/Form1.cs | 95 +++++++++++++-- QobuzDownloaderX/Properties/AssemblyInfo.cs | 4 +- .../Properties/Settings.Designer.cs | 12 ++ QobuzDownloaderX/Properties/Settings.settings | 3 + 6 files changed, 205 insertions(+), 23 deletions(-) diff --git a/QobuzDownloaderX/App.config b/QobuzDownloaderX/App.config index 3d8dde4..61b970f 100644 --- a/QobuzDownloaderX/App.config +++ b/QobuzDownloaderX/App.config @@ -115,6 +115,9 @@ True + + 36 + diff --git a/QobuzDownloaderX/Form1.Designer.cs b/QobuzDownloaderX/Form1.Designer.cs index b1dd146..2870ecc 100644 --- a/QobuzDownloaderX/Form1.Designer.cs +++ b/QobuzDownloaderX/Form1.Designer.cs @@ -107,6 +107,12 @@ this.artSizeLabel = new System.Windows.Forms.Label(); this.typeCheckbox = new System.Windows.Forms.CheckBox(); this.aboutLabel = new System.Windows.Forms.Label(); + this.enableBtnsButton = new System.Windows.Forms.Button(); + this.hideDebugButton = new System.Windows.Forms.Button(); + this.maxLengthLabel = new System.Windows.Forms.Label(); + this.panel9 = new System.Windows.Forms.Panel(); + this.maxLengthTextbox = new System.Windows.Forms.TextBox(); + this.maxLengthWarnLabel = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.albumArtPicBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.logoBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.profilePictureBox)).BeginInit(); @@ -755,7 +761,7 @@ // this.mp3WarnLabel.AutoSize = true; this.mp3WarnLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(92)))), ((int)(((byte)(102))))); - this.mp3WarnLabel.Location = new System.Drawing.Point(744, 711); + this.mp3WarnLabel.Location = new System.Drawing.Point(744, 697); this.mp3WarnLabel.Name = "mp3WarnLabel"; this.mp3WarnLabel.Size = new System.Drawing.Size(182, 13); this.mp3WarnLabel.TabIndex = 85; @@ -863,7 +869,7 @@ this.streamableCheckbox.Checked = true; this.streamableCheckbox.CheckState = System.Windows.Forms.CheckState.Checked; this.streamableCheckbox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(92)))), ((int)(((byte)(102))))); - this.streamableCheckbox.Location = new System.Drawing.Point(243, 12); + this.streamableCheckbox.Location = new System.Drawing.Point(243, 41); this.streamableCheckbox.Name = "streamableCheckbox"; this.streamableCheckbox.Size = new System.Drawing.Size(113, 17); this.streamableCheckbox.TabIndex = 91; @@ -876,13 +882,14 @@ this.secretTextbox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); this.secretTextbox.BorderStyle = System.Windows.Forms.BorderStyle.None; this.secretTextbox.ForeColor = System.Drawing.Color.White; - this.secretTextbox.Location = new System.Drawing.Point(352, 35); + this.secretTextbox.Location = new System.Drawing.Point(412, 15); this.secretTextbox.Multiline = true; this.secretTextbox.Name = "secretTextbox"; this.secretTextbox.ReadOnly = true; - this.secretTextbox.Size = new System.Drawing.Size(209, 20); + this.secretTextbox.Size = new System.Drawing.Size(179, 20); this.secretTextbox.TabIndex = 92; this.secretTextbox.Visible = false; + this.secretTextbox.WordWrap = false; // // displaySecretButton // @@ -890,7 +897,7 @@ this.displaySecretButton.FlatAppearance.BorderSize = 0; this.displaySecretButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.displaySecretButton.ForeColor = System.Drawing.Color.White; - this.displaySecretButton.Location = new System.Drawing.Point(243, 32); + this.displaySecretButton.Location = new System.Drawing.Point(303, 12); this.displaySecretButton.Name = "displaySecretButton"; this.displaySecretButton.Size = new System.Drawing.Size(103, 23); this.displaySecretButton.TabIndex = 93; @@ -927,9 +934,9 @@ // hiddenTextPanel // this.hiddenTextPanel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(92)))), ((int)(((byte)(102))))); - this.hiddenTextPanel.Location = new System.Drawing.Point(352, 55); + this.hiddenTextPanel.Location = new System.Drawing.Point(412, 36); this.hiddenTextPanel.Name = "hiddenTextPanel"; - this.hiddenTextPanel.Size = new System.Drawing.Size(209, 1); + this.hiddenTextPanel.Size = new System.Drawing.Size(179, 1); this.hiddenTextPanel.TabIndex = 87; this.hiddenTextPanel.Visible = false; // @@ -954,7 +961,7 @@ "50"}); this.artSizeSelect.Location = new System.Drawing.Point(634, 538); this.artSizeSelect.Name = "artSizeSelect"; - this.artSizeSelect.Size = new System.Drawing.Size(121, 21); + this.artSizeSelect.Size = new System.Drawing.Size(87, 21); this.artSizeSelect.TabIndex = 96; this.artSizeSelect.SelectedIndexChanged += new System.EventHandler(this.artSizeSelect_SelectedIndexChanged); // @@ -964,9 +971,9 @@ this.artSizeLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(92)))), ((int)(((byte)(102))))); this.artSizeLabel.Location = new System.Drawing.Point(530, 541); this.artSizeLabel.Name = "artSizeLabel"; - this.artSizeLabel.Size = new System.Drawing.Size(246, 13); + this.artSizeLabel.Size = new System.Drawing.Size(210, 13); this.artSizeLabel.TabIndex = 97; - this.artSizeLabel.Text = "Embedded Art Size: px"; + this.artSizeLabel.Text = "Embedded Art Size: px"; // // typeCheckbox // @@ -975,7 +982,7 @@ this.typeCheckbox.CheckState = System.Windows.Forms.CheckState.Checked; this.typeCheckbox.FlatAppearance.BorderSize = 0; this.typeCheckbox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(92)))), ((int)(((byte)(102))))); - this.typeCheckbox.Location = new System.Drawing.Point(533, 563); + this.typeCheckbox.Location = new System.Drawing.Point(533, 676); this.typeCheckbox.Name = "typeCheckbox"; this.typeCheckbox.Size = new System.Drawing.Size(92, 17); this.typeCheckbox.TabIndex = 98; @@ -999,12 +1006,88 @@ this.aboutLabel.MouseLeave += new System.EventHandler(this.aboutLabel_MouseLeave); this.aboutLabel.MouseHover += new System.EventHandler(this.aboutLabel_MouseHover); // + // enableBtnsButton + // + this.enableBtnsButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(112)))), ((int)(((byte)(239))))); + this.enableBtnsButton.FlatAppearance.BorderSize = 0; + this.enableBtnsButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.enableBtnsButton.ForeColor = System.Drawing.Color.White; + this.enableBtnsButton.Location = new System.Drawing.Point(597, 28); + this.enableBtnsButton.Name = "enableBtnsButton"; + this.enableBtnsButton.Size = new System.Drawing.Size(120, 23); + this.enableBtnsButton.TabIndex = 100; + this.enableBtnsButton.Text = "Re-Enable Buttons"; + this.enableBtnsButton.UseVisualStyleBackColor = false; + this.enableBtnsButton.Visible = false; + this.enableBtnsButton.Click += new System.EventHandler(this.enableBtnsButton_Click); + // + // hideDebugButton + // + this.hideDebugButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(112)))), ((int)(((byte)(239))))); + this.hideDebugButton.FlatAppearance.BorderSize = 0; + this.hideDebugButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.hideDebugButton.ForeColor = System.Drawing.Color.White; + this.hideDebugButton.Location = new System.Drawing.Point(243, 12); + this.hideDebugButton.Name = "hideDebugButton"; + this.hideDebugButton.Size = new System.Drawing.Size(54, 23); + this.hideDebugButton.TabIndex = 101; + this.hideDebugButton.Text = "Hide"; + this.hideDebugButton.UseVisualStyleBackColor = false; + this.hideDebugButton.Visible = false; + this.hideDebugButton.Click += new System.EventHandler(this.hideDebugButton_Click); + // + // maxLengthLabel + // + this.maxLengthLabel.AutoSize = true; + this.maxLengthLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(92)))), ((int)(((byte)(102))))); + this.maxLengthLabel.Location = new System.Drawing.Point(530, 567); + this.maxLengthLabel.Name = "maxLengthLabel"; + this.maxLengthLabel.Size = new System.Drawing.Size(121, 13); + this.maxLengthLabel.TabIndex = 102; + this.maxLengthLabel.Text = "Max File Name Length**"; + // + // panel9 + // + this.panel9.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(92)))), ((int)(((byte)(102))))); + this.panel9.Location = new System.Drawing.Point(653, 586); + this.panel9.Name = "panel9"; + this.panel9.Size = new System.Drawing.Size(68, 1); + this.panel9.TabIndex = 92; + // + // maxLengthTextbox + // + this.maxLengthTextbox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); + this.maxLengthTextbox.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.maxLengthTextbox.ForeColor = System.Drawing.Color.White; + this.maxLengthTextbox.Location = new System.Drawing.Point(653, 567); + this.maxLengthTextbox.Multiline = true; + this.maxLengthTextbox.Name = "maxLengthTextbox"; + this.maxLengthTextbox.Size = new System.Drawing.Size(68, 17); + this.maxLengthTextbox.TabIndex = 91; + this.maxLengthTextbox.TextChanged += new System.EventHandler(this.maxLengthTextbox_TextChanged); + // + // maxLengthWarnLabel + // + this.maxLengthWarnLabel.AutoSize = true; + this.maxLengthWarnLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(92)))), ((int)(((byte)(102))))); + this.maxLengthWarnLabel.Location = new System.Drawing.Point(819, 711); + this.maxLengthWarnLabel.Name = "maxLengthWarnLabel"; + this.maxLengthWarnLabel.Size = new System.Drawing.Size(107, 13); + this.maxLengthWarnLabel.TabIndex = 103; + this.maxLengthWarnLabel.Text = "** = Max value is 110"; + // // QobuzDownloaderX // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); this.ClientSize = new System.Drawing.Size(938, 733); + this.Controls.Add(this.maxLengthWarnLabel); + this.Controls.Add(this.panel9); + this.Controls.Add(this.maxLengthTextbox); + this.Controls.Add(this.maxLengthLabel); + this.Controls.Add(this.hideDebugButton); + this.Controls.Add(this.enableBtnsButton); this.Controls.Add(this.aboutLabel); this.Controls.Add(this.typeCheckbox); this.Controls.Add(this.artSizeSelect); @@ -1170,6 +1253,12 @@ private System.Windows.Forms.Label artSizeLabel; private System.Windows.Forms.CheckBox typeCheckbox; private System.Windows.Forms.Label aboutLabel; + private System.Windows.Forms.Button enableBtnsButton; + private System.Windows.Forms.Button hideDebugButton; + private System.Windows.Forms.Label maxLengthLabel; + private System.Windows.Forms.Panel panel9; + private System.Windows.Forms.TextBox maxLengthTextbox; + private System.Windows.Forms.Label maxLengthWarnLabel; } } diff --git a/QobuzDownloaderX/Form1.cs b/QobuzDownloaderX/Form1.cs index 2afa402..107ea60 100644 --- a/QobuzDownloaderX/Form1.cs +++ b/QobuzDownloaderX/Form1.cs @@ -61,6 +61,7 @@ namespace QobuzDownloaderX public string finalTrackNameVersionPath { get; set; } public int MaxLength { get; set; } public int devClickEggThingValue { get; set; } + public int debugMode { get; set; } // Important strings public string loc { get; set; } @@ -114,8 +115,6 @@ namespace QobuzDownloaderX private void Form1_Load(object sender, EventArgs e) { - MaxLength = 36; - // Set main form size on launch and bring to center. this.Height = 533; this.CenterToScreen(); @@ -183,7 +182,10 @@ namespace QobuzDownloaderX formatIdString = Settings.Default.qualityFormat; audioFileType = Settings.Default.audioType; artSizeSelect.SelectedIndex = Settings.Default.savedArtSize; + MaxLength = Settings.Default.savedMaxLength; + artSize = artSizeSelect.Text; + maxLengthTextbox.Text = MaxLength.ToString(); #endregion // Check if there's no selected path saved. @@ -213,6 +215,16 @@ namespace QobuzDownloaderX devClickEggThingValue = 0; + // Debug mode for things that are only for testing, or shouldn't be on public releases. At the moment, does nothing. + if (!Debugger.IsAttached) + { + debugMode = 0; + } + else + { + debugMode = 1; + } + // Show app_secret value. //output.Invoke(new Action(() => output.AppendText("\r\n\r\napp_secret = " + appSecret))); @@ -672,6 +684,9 @@ namespace QobuzDownloaderX JObject joTrackResponse = JObject.Parse(trackIDResponseString); #region Get Information (Tags, Titles, etc.) + // Reset troublesome strings (strings that stick around if new value is null) + composerName = null; + // Grab tag strings albumArtist = (string)joTrackResponse["album"]["artist"]["name"]; albumArtist = DecodeEncodedNonAsciiCharacters(albumArtist); albumArtistPath = GetSafeFilename(albumArtist); @@ -1477,6 +1492,9 @@ namespace QobuzDownloaderX JObject joTrackResponse = JObject.Parse(trackIDResponseString); #region Get Information (Tags, Titles, etc.) + // Reset troublesome strings (strings that stick around if new value is null) + composerName = null; + // Grab tag strings albumArtist = (string)joTrackResponse["album"]["artist"]["name"]; albumArtist = DecodeEncodedNonAsciiCharacters(albumArtist); albumArtistPath = GetSafeFilename(albumArtist); @@ -2283,6 +2301,9 @@ namespace QobuzDownloaderX JObject joTrackResponse = JObject.Parse(trackIDResponseString); #region Get Information (Tags, Titles, etc.) + // Reset troublesome strings (strings that stick around if new value is null) + composerName = null; + // Grab tag strings albumArtist = (string)joTrackResponse["album"]["artist"]["name"]; albumArtist = DecodeEncodedNonAsciiCharacters(albumArtist); albumArtistPath = GetSafeFilename(albumArtist); @@ -3056,6 +3077,9 @@ namespace QobuzDownloaderX JObject joTrackResponse = JObject.Parse(trackIDResponseString); #region Get Information (Tags, Titles, etc.) + // Reset troublesome strings (strings that stick around if new value is null) + composerName = null; + // Grab tag strings albumArtist = (string)joTrackResponse["album"]["artist"]["name"]; albumArtist = DecodeEncodedNonAsciiCharacters(albumArtist); albumArtistPath = GetSafeFilename(albumArtist); @@ -3776,6 +3800,9 @@ namespace QobuzDownloaderX #endregion #region Get Information (Tags, Titles, etc.) + // Reset troublesome strings (strings that stick around if new value is null) + composerName = null; + // Grab tag strings albumArtist = (string)joResponse2["album"]["artist"]["name"]; albumArtist = DecodeEncodedNonAsciiCharacters(albumArtist); albumArtistPath = GetSafeFilename(albumArtist); @@ -4497,6 +4524,41 @@ namespace QobuzDownloaderX Settings.Default.commentText = commentTextbox.Text; Settings.Default.Save(); } + + private void artSizeSelect_SelectedIndexChanged(object sender, EventArgs e) + { + // Set artSize to selected value, and save selected option to settings. + artSize = artSizeSelect.Text; + Settings.Default.savedArtSize = artSizeSelect.SelectedIndex; + Settings.Default.Save(); + } + + private void maxLengthTextbox_TextChanged(object sender, EventArgs e) + { + if (maxLengthTextbox.Text != null) + { + try + { + if (Convert.ToInt32(maxLengthTextbox.Text) > 110) + { + maxLengthTextbox.Text = "110"; + } + Settings.Default.savedMaxLength = Convert.ToInt32(maxLengthTextbox.Text); + Settings.Default.Save(); + + MaxLength = Convert.ToInt32(maxLengthTextbox.Text); + } + catch (Exception ex) + { + MaxLength = 36; + } + } + else + { + MaxLength = 36; + } + + } #endregion #region Quality Options @@ -4678,6 +4740,8 @@ namespace QobuzDownloaderX if (devClickEggThingValue >= 3) { streamableCheckbox.Visible = true; + enableBtnsButton.Visible = true; + hideDebugButton.Visible = true; displaySecretButton.Visible = true; secretTextbox.Visible = true; hiddenTextPanel.Visible = true; @@ -4688,9 +4752,23 @@ namespace QobuzDownloaderX displaySecretButton.Visible = false; secretTextbox.Visible = false; hiddenTextPanel.Visible = false; + enableBtnsButton.Visible = false; + hideDebugButton.Visible = false; } } + private void hideDebugButton_Click(object sender, EventArgs e) + { + streamableCheckbox.Visible = false; + displaySecretButton.Visible = false; + secretTextbox.Visible = false; + hiddenTextPanel.Visible = false; + enableBtnsButton.Visible = false; + hideDebugButton.Visible = false; + + devClickEggThingValue = 0; + } + private void displaySecretButton_Click(object sender, EventArgs e) { secretTextbox.Text = appSecret; @@ -4713,18 +4791,15 @@ namespace QobuzDownloaderX Application.Exit(); } - private void artSizeSelect_SelectedIndexChanged(object sender, EventArgs e) - { - // Set artSize to selected value, and save selected option to settings. - artSize = artSizeSelect.Text; - Settings.Default.savedArtSize = artSizeSelect.SelectedIndex; - Settings.Default.Save(); - } - // For converting illegal filename characters to an underscore. public string GetSafeFilename(string filename) { return string.Join("_", filename.Split(Path.GetInvalidFileNameChars())); } + + private void enableBtnsButton_Click(object sender, EventArgs e) + { + enableBoxes(sender, e); + } } } diff --git a/QobuzDownloaderX/Properties/AssemblyInfo.cs b/QobuzDownloaderX/Properties/AssemblyInfo.cs index 0fcb6bd..20925d6 100644 --- a/QobuzDownloaderX/Properties/AssemblyInfo.cs +++ b/QobuzDownloaderX/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.9.9.20")] -[assembly: AssemblyFileVersion("0.9.9.20")] +[assembly: AssemblyVersion("0.9.9.21")] +[assembly: AssemblyFileVersion("0.9.9.21")] diff --git a/QobuzDownloaderX/Properties/Settings.Designer.cs b/QobuzDownloaderX/Properties/Settings.Designer.cs index 38370ff..05c6519 100644 --- a/QobuzDownloaderX/Properties/Settings.Designer.cs +++ b/QobuzDownloaderX/Properties/Settings.Designer.cs @@ -442,5 +442,17 @@ namespace QobuzDownloaderX.Properties { this["typeTag"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("36")] + public int savedMaxLength { + get { + return ((int)(this["savedMaxLength"])); + } + set { + this["savedMaxLength"] = value; + } + } } } diff --git a/QobuzDownloaderX/Properties/Settings.settings b/QobuzDownloaderX/Properties/Settings.settings index 3316b37..1ea3388 100644 --- a/QobuzDownloaderX/Properties/Settings.settings +++ b/QobuzDownloaderX/Properties/Settings.settings @@ -107,5 +107,8 @@ True + + 36 + \ No newline at end of file