From 2e44cbc5a3fc3eb1cbd7210f915ed9759cbda747 Mon Sep 17 00:00:00 2001 From: AiiR <22158489+ImAiiR@users.noreply.github.com> Date: Thu, 27 Feb 2020 16:55:41 -0500 Subject: [PATCH] 0.9.9.8 0.9.9.8 --- QobuzDownloaderX/Form1.Designer.cs | 100 +++++++-- QobuzDownloaderX/Form1.cs | 92 +++++++- QobuzDownloaderX/LoginForm-v2.Designer.cs | 74 ++++--- QobuzDownloaderX/LoginForm-v2.cs | 224 +++++++++++--------- QobuzDownloaderX/Properties/AssemblyInfo.cs | 4 +- 5 files changed, 326 insertions(+), 168 deletions(-) diff --git a/QobuzDownloaderX/Form1.Designer.cs b/QobuzDownloaderX/Form1.Designer.cs index f1157f2..aa12452 100644 --- a/QobuzDownloaderX/Form1.Designer.cs +++ b/QobuzDownloaderX/Form1.Designer.cs @@ -49,7 +49,7 @@ this.upcTextBox = new System.Windows.Forms.TextBox(); this.label5 = new System.Windows.Forms.Label(); this.albumArtPicBox = new System.Windows.Forms.PictureBox(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.logoBox = new System.Windows.Forms.PictureBox(); this.label6 = new System.Windows.Forms.Label(); this.totalTracksTextbox = new System.Windows.Forms.TextBox(); this.totalTracksLabel = new System.Windows.Forms.Label(); @@ -94,8 +94,14 @@ this.panel6 = new System.Windows.Forms.Panel(); this.panel7 = new System.Windows.Forms.Panel(); this.panel8 = new System.Windows.Forms.Panel(); + this.streamableCheckbox = new System.Windows.Forms.CheckBox(); + this.secretTextbox = new System.Windows.Forms.TextBox(); + this.displaySecretButton = new System.Windows.Forms.Button(); + this.profilePictureBox = new System.Windows.Forms.PictureBox(); + this.logoutLabel = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.albumArtPicBox)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.logoBox)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.profilePictureBox)).BeginInit(); this.SuspendLayout(); // // testURLBox @@ -313,16 +319,17 @@ this.albumArtPicBox.TabIndex = 39; this.albumArtPicBox.TabStop = false; // - // pictureBox1 + // logoBox // - this.pictureBox1.Image = global::QobuzDownloaderX.Properties.Resources.qbdlx_white; - this.pictureBox1.Location = new System.Drawing.Point(12, 12); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(207, 52); - this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.pictureBox1.TabIndex = 36; - this.pictureBox1.TabStop = false; - this.pictureBox1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseMove); + this.logoBox.Image = global::QobuzDownloaderX.Properties.Resources.qbdlx_white; + this.logoBox.Location = new System.Drawing.Point(12, 12); + this.logoBox.Name = "logoBox"; + this.logoBox.Size = new System.Drawing.Size(207, 52); + this.logoBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.logoBox.TabIndex = 36; + this.logoBox.TabStop = false; + this.logoBox.Click += new System.EventHandler(this.logoBox_Click); + this.logoBox.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseMove); // // label6 // @@ -842,12 +849,71 @@ this.panel8.Size = new System.Drawing.Size(112, 1); this.panel8.TabIndex = 90; // + // streamableCheckbox + // + this.streamableCheckbox.AutoSize = true; + 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.Name = "streamableCheckbox"; + this.streamableCheckbox.Size = new System.Drawing.Size(113, 17); + this.streamableCheckbox.TabIndex = 91; + this.streamableCheckbox.Text = "Streamable Check"; + this.streamableCheckbox.UseVisualStyleBackColor = true; + this.streamableCheckbox.Visible = false; + // + // secretTextbox + // + this.secretTextbox.Location = new System.Drawing.Point(352, 34); + this.secretTextbox.Name = "secretTextbox"; + this.secretTextbox.Size = new System.Drawing.Size(209, 20); + this.secretTextbox.TabIndex = 92; + this.secretTextbox.Visible = false; + // + // displaySecretButton + // + this.displaySecretButton.Location = new System.Drawing.Point(243, 32); + this.displaySecretButton.Name = "displaySecretButton"; + this.displaySecretButton.Size = new System.Drawing.Size(103, 23); + this.displaySecretButton.TabIndex = 93; + this.displaySecretButton.Text = "Display appSecret"; + this.displaySecretButton.UseVisualStyleBackColor = true; + this.displaySecretButton.Visible = false; + this.displaySecretButton.Click += new System.EventHandler(this.displaySecretButton_Click); + // + // profilePictureBox + // + this.profilePictureBox.Location = new System.Drawing.Point(15, 501); + this.profilePictureBox.Name = "profilePictureBox"; + this.profilePictureBox.Size = new System.Drawing.Size(20, 20); + this.profilePictureBox.TabIndex = 94; + this.profilePictureBox.TabStop = false; + // + // logoutLabel + // + this.logoutLabel.AutoSize = true; + this.logoutLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(92)))), ((int)(((byte)(102))))); + this.logoutLabel.Location = new System.Drawing.Point(41, 506); + this.logoutLabel.Name = "logoutLabel"; + this.logoutLabel.Size = new System.Drawing.Size(161, 13); + this.logoutLabel.TabIndex = 95; + this.logoutLabel.Text = "Logged in as %name%, Log out?"; + this.logoutLabel.Click += new System.EventHandler(this.logoutLabel_Click); + this.logoutLabel.MouseLeave += new System.EventHandler(this.logoutLabel_MouseLeave); + this.logoutLabel.MouseHover += new System.EventHandler(this.logoutLabel_MouseHover); + // // 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, 533); + this.Controls.Add(this.logoutLabel); + this.Controls.Add(this.profilePictureBox); + this.Controls.Add(this.displaySecretButton); + this.Controls.Add(this.secretTextbox); + this.Controls.Add(this.streamableCheckbox); this.Controls.Add(this.panel8); this.Controls.Add(this.panel7); this.Controls.Add(this.panel6); @@ -899,7 +965,7 @@ this.Controls.Add(this.label1); this.Controls.Add(this.albumArtPicBox); this.Controls.Add(this.verNumLabel); - this.Controls.Add(this.pictureBox1); + this.Controls.Add(this.logoBox); this.Controls.Add(this.imageURLTextbox); this.Controls.Add(this.downloadButton); this.Controls.Add(this.albumUrl); @@ -917,7 +983,8 @@ this.Load += new System.EventHandler(this.Form1_Load); this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.QobuzDownloaderX_MouseMove); ((System.ComponentModel.ISupportInitialize)(this.albumArtPicBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.logoBox)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.profilePictureBox)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -933,7 +1000,7 @@ private System.Windows.Forms.Button downloadButton; private System.Windows.Forms.TextBox albumUrl; private System.Windows.Forms.TextBox imageURLTextbox; - private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.PictureBox logoBox; private System.Windows.Forms.Label verNumLabel; private System.Windows.Forms.PictureBox albumArtPicBox; private System.Windows.Forms.Label label1; @@ -989,6 +1056,11 @@ private System.Windows.Forms.Panel panel6; private System.Windows.Forms.Panel panel7; private System.Windows.Forms.Panel panel8; + private System.Windows.Forms.CheckBox streamableCheckbox; + private System.Windows.Forms.TextBox secretTextbox; + private System.Windows.Forms.Button displaySecretButton; + private System.Windows.Forms.PictureBox profilePictureBox; + private System.Windows.Forms.Label logoutLabel; } } diff --git a/QobuzDownloaderX/Form1.cs b/QobuzDownloaderX/Form1.cs index 9d767a1..c6498e0 100644 --- a/QobuzDownloaderX/Form1.cs +++ b/QobuzDownloaderX/Form1.cs @@ -45,6 +45,7 @@ namespace QobuzDownloaderX public string appid { get; set; } public string password { get; set; } public string userAuth { get; set; } + public string profilePic { get; set; } public string displayName { get; set; } public string accountType { get; set; } public string appSecret { get; set; } @@ -52,6 +53,7 @@ namespace QobuzDownloaderX public string trackIdString { get; set; } public string formatIdString { get; set; } public string audioFileType { get; set; } + public int devClickEggThingValue { get; set; } searchForm searchF = new searchForm(); @@ -72,6 +74,11 @@ namespace QobuzDownloaderX // Set a placeholder image for Cover Art box. albumArtPicBox.ImageLocation = "https://static.qobuz.com/images/covers/01/00/2013072600001_150.jpg"; + profilePictureBox.ImageLocation = profilePic; + + // Change account info for logout button + string oldText = logoutLabel.Text; + logoutLabel.Text = oldText.Replace("%name%", displayName); #region Load Saved Settings // Set saved settings to correct places. @@ -126,11 +133,15 @@ namespace QobuzDownloaderX private void debuggingEvents(object sender, EventArgs e) { #region Debug Events, For Testing + + devClickEggThingValue = 0; + // Show app_secret value. //output.Invoke(new Action(() => output.AppendText("\r\n\r\napp_secret = " + appSecret))); // Show format_id value. //output.Invoke(new Action(() => output.AppendText("\r\n\r\nformat_id = " + formatIdString))); + #endregion } @@ -211,6 +222,7 @@ namespace QobuzDownloaderX Int32 unixTimestamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds; string time = unixTimestamp.ToString(); + // Generate the string that will be hashed using MD5 (utf-8). Example string - "trackgetFileUrlformat_id27intentstreamtrack_id6891469115724574501b4d2f1aca8d4c8ef4z07984c5aa6712" (example shows a fake app_secret) string md5HashMe = "trackgetFileUrlformat_id" + formatIdString + "intentstreamtrack_id" + trackIdString + time + appSecret; @@ -759,9 +771,16 @@ namespace QobuzDownloaderX if (streamCheck != "true") { - output.Invoke(new Action(() => output.AppendText("Track " + trackNumber + " \"" + trackName + "\" is not available for streaming. Skipping track...\r\n"))); - System.Threading.Thread.Sleep(800); - continue; + if (streamableCheckbox.Checked == true) + { + output.Invoke(new Action(() => output.AppendText("Track " + trackNumber + " \"" + trackName + "\" is not available for streaming. Skipping track...\r\n"))); + System.Threading.Thread.Sleep(800); + continue; + } + else + { + output.Invoke(new Action(() => output.AppendText("\r\nTrack " + trackNumber + " \"" + trackName + "\" is not available for streaming. But stremable check is being ignored for debugging, or messed up releases. Attempting to download...\r\n"))); + } } #endregion @@ -1807,9 +1826,16 @@ namespace QobuzDownloaderX if (streamCheck != "true") { - output.Invoke(new Action(() => output.AppendText("Track " + trackNumber + " \"" + trackName + "\" is not available for streaming. Skipping track...\r\n"))); - System.Threading.Thread.Sleep(800); - continue; + if (streamableCheckbox.Checked == true) + { + output.Invoke(new Action(() => output.AppendText("Track " + trackNumber + " \"" + trackName + "\" is not available for streaming. Skipping track...\r\n"))); + System.Threading.Thread.Sleep(800); + continue; + } + else + { + output.Invoke(new Action(() => output.AppendText("\r\nTrack " + trackNumber + " \"" + trackName + "\" is not available for streaming. But stremable check is being ignored for debugging, or messed up releases. Attempting to download...\r\n"))); + } } #endregion @@ -2787,9 +2813,17 @@ namespace QobuzDownloaderX if (streamCheck != "true") { - output.Invoke(new Action(() => output.AppendText("Track is not available for streaming. Unable to download.\r\n"))); - System.Threading.Thread.Sleep(800); - return; + if (streamableCheckbox.Checked == true) + { + output.Invoke(new Action(() => output.AppendText("Track is not available for streaming. Unable to download.\r\n"))); + System.Threading.Thread.Sleep(800); + downloadButton.Invoke(new Action(() => downloadButton.Enabled = true)); + return; + } + else + { + output.Invoke(new Action(() => output.AppendText("Track is not available for streaming. But stremable check is being ignored for debugging, or messed up releases. Attempting to download...\r\n"))); + } } #endregion @@ -3690,5 +3724,45 @@ namespace QobuzDownloaderX Application.Exit(); } #endregion + + private void logoBox_Click(object sender, EventArgs e) + { + devClickEggThingValue = devClickEggThingValue + 1; + + if (devClickEggThingValue >= 3) + { + streamableCheckbox.Visible = true; + displaySecretButton.Visible = true; + secretTextbox.Visible = true; + } + else + { + streamableCheckbox.Visible = false; + displaySecretButton.Visible = false; + secretTextbox.Visible = false; + } + } + + private void displaySecretButton_Click(object sender, EventArgs e) + { + secretTextbox.Text = appSecret; + } + + private void logoutLabel_MouseHover(object sender, EventArgs e) + { + logoutLabel.ForeColor = Color.FromArgb(0, 112, 239); + } + + private void logoutLabel_MouseLeave(object sender, EventArgs e) + { + logoutLabel.ForeColor = Color.FromArgb(88, 92, 102); + } + + private void logoutLabel_Click(object sender, EventArgs e) + { + // Could use some work, but this works. + Process.Start("QobuzDownloaderX.exe"); + Application.Exit(); + } } } diff --git a/QobuzDownloaderX/LoginForm-v2.Designer.cs b/QobuzDownloaderX/LoginForm-v2.Designer.cs index b2598d7..ee44d92 100644 --- a/QobuzDownloaderX/LoginForm-v2.Designer.cs +++ b/QobuzDownloaderX/LoginForm-v2.Designer.cs @@ -33,17 +33,17 @@ this.verNumLabel2 = new System.Windows.Forms.Label(); this.exitLabel = new System.Windows.Forms.Label(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.panel2 = new System.Windows.Forms.Panel(); this.loginButton = new System.Windows.Forms.Button(); this.panel3 = new System.Windows.Forms.Panel(); this.panel4 = new System.Windows.Forms.Panel(); - this.appidTextbox = new System.Windows.Forms.TextBox(); this.emailTextbox = new System.Windows.Forms.TextBox(); this.passwordTextbox = new System.Windows.Forms.TextBox(); this.md5Button = new System.Windows.Forms.Button(); this.loginText = new System.Windows.Forms.Label(); this.getSecretBG = new System.ComponentModel.BackgroundWorker(); this.loginBG = new System.ComponentModel.BackgroundWorker(); + this.visableCheckbox = new System.Windows.Forms.CheckBox(); + this.disableLogin = new System.Windows.Forms.CheckBox(); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); @@ -51,6 +51,7 @@ // panel1 // this.panel1.BackgroundImage = global::QobuzDownloaderX.Properties.Resources.login_frame; + this.panel1.Controls.Add(this.disableLogin); this.panel1.Controls.Add(this.verNumLabel2); this.panel1.Controls.Add(this.exitLabel); this.panel1.Controls.Add(this.pictureBox1); @@ -100,15 +101,6 @@ this.pictureBox1.TabStop = false; this.pictureBox1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseMove); // - // panel2 - // - this.panel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(92)))), ((int)(((byte)(102))))); - this.panel2.Location = new System.Drawing.Point(12, 226); - this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(258, 1); - this.panel2.TabIndex = 1; - this.panel2.Click += new System.EventHandler(this.panel2_Click); - // // loginButton // this.loginButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(112)))), ((int)(((byte)(239))))); @@ -116,7 +108,7 @@ this.loginButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.loginButton.Font = new System.Drawing.Font("Trebuchet MS", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.loginButton.ForeColor = System.Drawing.Color.White; - this.loginButton.Location = new System.Drawing.Point(12, 359); + this.loginButton.Location = new System.Drawing.Point(12, 293); this.loginButton.Name = "loginButton"; this.loginButton.Size = new System.Drawing.Size(258, 30); this.loginButton.TabIndex = 2; @@ -127,7 +119,7 @@ // panel3 // this.panel3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(92)))), ((int)(((byte)(102))))); - this.panel3.Location = new System.Drawing.Point(12, 287); + this.panel3.Location = new System.Drawing.Point(12, 221); this.panel3.Name = "panel3"; this.panel3.Size = new System.Drawing.Size(258, 1); this.panel3.TabIndex = 2; @@ -136,34 +128,19 @@ // panel4 // this.panel4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(92)))), ((int)(((byte)(102))))); - this.panel4.Location = new System.Drawing.Point(12, 343); + this.panel4.Location = new System.Drawing.Point(12, 277); this.panel4.Name = "panel4"; this.panel4.Size = new System.Drawing.Size(258, 1); this.panel4.TabIndex = 2; this.panel4.Click += new System.EventHandler(this.panel4_Click); // - // appidTextbox - // - this.appidTextbox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); - this.appidTextbox.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.appidTextbox.Font = new System.Drawing.Font("Trebuchet MS", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.appidTextbox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(92)))), ((int)(((byte)(102))))); - this.appidTextbox.Location = new System.Drawing.Point(12, 200); - this.appidTextbox.Multiline = true; - this.appidTextbox.Name = "appidTextbox"; - this.appidTextbox.Size = new System.Drawing.Size(258, 27); - this.appidTextbox.TabIndex = 6; - this.appidTextbox.Text = "app_id"; - this.appidTextbox.Click += new System.EventHandler(this.appIdTextbox_Click); - this.appidTextbox.Leave += new System.EventHandler(this.appIdTextbox_Leave); - // // emailTextbox // this.emailTextbox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); this.emailTextbox.BorderStyle = System.Windows.Forms.BorderStyle.None; this.emailTextbox.Font = new System.Drawing.Font("Trebuchet MS", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.emailTextbox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(92)))), ((int)(((byte)(102))))); - this.emailTextbox.Location = new System.Drawing.Point(12, 265); + this.emailTextbox.Location = new System.Drawing.Point(12, 199); this.emailTextbox.Multiline = true; this.emailTextbox.Name = "emailTextbox"; this.emailTextbox.Size = new System.Drawing.Size(258, 23); @@ -178,7 +155,7 @@ this.passwordTextbox.BorderStyle = System.Windows.Forms.BorderStyle.None; this.passwordTextbox.Font = new System.Drawing.Font("Trebuchet MS", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.passwordTextbox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(92)))), ((int)(((byte)(102))))); - this.passwordTextbox.Location = new System.Drawing.Point(12, 321); + this.passwordTextbox.Location = new System.Drawing.Point(12, 255); this.passwordTextbox.Multiline = true; this.passwordTextbox.Name = "passwordTextbox"; this.passwordTextbox.Size = new System.Drawing.Size(209, 23); @@ -194,7 +171,7 @@ this.md5Button.FlatAppearance.BorderSize = 2; this.md5Button.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.md5Button.ForeColor = System.Drawing.Color.White; - this.md5Button.Location = new System.Drawing.Point(227, 316); + this.md5Button.Location = new System.Drawing.Point(227, 250); this.md5Button.Name = "md5Button"; this.md5Button.Size = new System.Drawing.Size(43, 27); this.md5Button.TabIndex = 9; @@ -206,7 +183,7 @@ // this.loginText.Font = new System.Drawing.Font("Trebuchet MS", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.loginText.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(92)))), ((int)(((byte)(102))))); - this.loginText.Location = new System.Drawing.Point(12, 399); + this.loginText.Location = new System.Drawing.Point(12, 333); this.loginText.Name = "loginText"; this.loginText.Size = new System.Drawing.Size(258, 23); this.loginText.TabIndex = 30; @@ -221,20 +198,41 @@ // this.loginBG.DoWork += new System.ComponentModel.DoWorkEventHandler(this.loginBG_DoWork); // + // visableCheckbox + // + this.visableCheckbox.AutoSize = true; + this.visableCheckbox.Location = new System.Drawing.Point(206, 257); + this.visableCheckbox.Name = "visableCheckbox"; + this.visableCheckbox.Size = new System.Drawing.Size(15, 14); + this.visableCheckbox.TabIndex = 31; + this.visableCheckbox.UseVisualStyleBackColor = true; + this.visableCheckbox.CheckedChanged += new System.EventHandler(this.visableCheckbox_CheckedChanged); + // + // disableLogin + // + this.disableLogin.AutoSize = true; + this.disableLogin.ForeColor = System.Drawing.Color.Transparent; + this.disableLogin.Location = new System.Drawing.Point(12, 155); + this.disableLogin.Name = "disableLogin"; + this.disableLogin.Size = new System.Drawing.Size(90, 17); + this.disableLogin.TabIndex = 34; + this.disableLogin.Text = "Disable Login"; + this.disableLogin.UseVisualStyleBackColor = true; + this.disableLogin.Visible = false; + // // LoginFrm // 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(282, 431); + this.ClientSize = new System.Drawing.Size(282, 377); + this.Controls.Add(this.visableCheckbox); this.Controls.Add(this.loginText); this.Controls.Add(this.md5Button); this.Controls.Add(this.panel4); this.Controls.Add(this.panel3); - this.Controls.Add(this.panel2); this.Controls.Add(this.passwordTextbox); this.Controls.Add(this.emailTextbox); - this.Controls.Add(this.appidTextbox); this.Controls.Add(this.loginButton); this.Controls.Add(this.panel1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; @@ -254,11 +252,9 @@ private System.Windows.Forms.Panel panel1; private System.Windows.Forms.PictureBox pictureBox1; - private System.Windows.Forms.Panel panel2; private System.Windows.Forms.Button loginButton; private System.Windows.Forms.Panel panel3; private System.Windows.Forms.Panel panel4; - private System.Windows.Forms.TextBox appidTextbox; private System.Windows.Forms.TextBox emailTextbox; private System.Windows.Forms.TextBox passwordTextbox; private System.Windows.Forms.Label exitLabel; @@ -267,5 +263,7 @@ private System.ComponentModel.BackgroundWorker getSecretBG; private System.ComponentModel.BackgroundWorker loginBG; private System.Windows.Forms.Label verNumLabel2; + private System.Windows.Forms.CheckBox visableCheckbox; + private System.Windows.Forms.CheckBox disableLogin; } } \ No newline at end of file diff --git a/QobuzDownloaderX/LoginForm-v2.cs b/QobuzDownloaderX/LoginForm-v2.cs index 7e97419..471f8e3 100644 --- a/QobuzDownloaderX/LoginForm-v2.cs +++ b/QobuzDownloaderX/LoginForm-v2.cs @@ -46,6 +46,7 @@ namespace QobuzDownloaderX QobuzDownloaderX qbdlx = new QobuzDownloaderX(); public string appSecret { get; set; } + public string appID { get; set; } string errorLog = Path.GetDirectoryName(Application.ExecutablePath) + "\\Latest_Error.log"; string dllCheck = Path.GetDirectoryName(Application.ExecutablePath) + "\\taglib-sharp.dll"; @@ -160,21 +161,9 @@ namespace QobuzDownloaderX } // Set saved settings to correct places. - appidTextbox.Text = Settings.Default.savedAppID.ToString(); emailTextbox.Text = Settings.Default.savedEmail.ToString(); passwordTextbox.Text = Settings.Default.savedPassword.ToString(); - if (appidTextbox.Text != "app_id") - { - appidTextbox.ForeColor = Color.FromArgb(186, 186, 186); - } - - if (appidTextbox.Text == null | appidTextbox.Text == "") - { - appidTextbox.ForeColor = Color.FromArgb(88, 92, 102); - appidTextbox.Text = "app_id"; - } - if (emailTextbox.Text != "Email") { emailTextbox.ForeColor = Color.FromArgb(186, 186, 186); @@ -203,13 +192,13 @@ namespace QobuzDownloaderX private void loginButton_Click(object sender, EventArgs e) { - if (appidTextbox.Text == "app_id" | appidTextbox.Text == null | appidTextbox.Text == "") - { - // If there's no app_id typed in. - loginText.Invoke(new Action(() => loginText.Text = "No app_id, please input app_id first.")); - return; - } - else if (emailTextbox.Text == "Email" | emailTextbox.Text == null | emailTextbox.Text == "") + //if (appidTextbox.Text == "app_id" | appidTextbox.Text == null | appidTextbox.Text == "") + //{ + // // If there's no app_id typed in. + // loginText.Invoke(new Action(() => loginText.Text = "No app_id, please input app_id first.")); + // return; + //} + if (emailTextbox.Text == "Email" | emailTextbox.Text == null | emailTextbox.Text == "") { // If there's no email typed in. loginText.Invoke(new Action(() => loginText.Text = "No email, please input email first.")); @@ -227,46 +216,45 @@ namespace QobuzDownloaderX // Save info locally to be used on next launch. Settings.Default.savedEmail = emailTextbox.Text; - Settings.Default.savedAppID = appidTextbox.Text; Settings.Default.savedPassword = passwordTextbox.Text; Settings.Default.Save(); - loginText.Text = "Logging in + obtaining app_secret..."; + loginText.Text = "Getting App ID and Secret..."; loginButton.Enabled = false; - loginBG.RunWorkerAsync(); + getSecretBG.RunWorkerAsync(); } #region Textbox Focous & Text Change - #region app_id Textbox - private void appIdTextbox_Click(object sender, EventArgs e) - { - if (appidTextbox.Text == "app_id") - { - appidTextbox.Text = null; - appidTextbox.ForeColor = Color.FromArgb(186, 186, 186); - } - } + #region app_id Textbox (Removed) + //private void appIdTextbox_Click(object sender, EventArgs e) + //{ + // if (appidTextbox.Text == "app_id") + // { + // appidTextbox.Text = null; + // appidTextbox.ForeColor = Color.FromArgb(186, 186, 186); + // } + //} - private void panel2_Click(object sender, EventArgs e) - { - appidTextbox.Focus(); + //private void panel2_Click(object sender, EventArgs e) + //{ + // appidTextbox.Focus(); - if (appidTextbox.Text == "app_id") - { - appidTextbox.Text = null; - appidTextbox.ForeColor = Color.FromArgb(186, 186, 186); - } - } + // if (appidTextbox.Text == "app_id") + // { + // appidTextbox.Text = null; + // appidTextbox.ForeColor = Color.FromArgb(186, 186, 186); + // } + //} - private void appIdTextbox_Leave(object sender, EventArgs e) - { - if (appidTextbox.Text == null | appidTextbox.Text == "") - { - appidTextbox.ForeColor = Color.FromArgb(88, 92, 102); - appidTextbox.Text = "app_id"; - } - } + //private void appIdTextbox_Leave(object sender, EventArgs e) + //{ + // if (appidTextbox.Text == null | appidTextbox.Text == "") + // { + // appidTextbox.ForeColor = Color.FromArgb(88, 92, 102); + // appidTextbox.Text = "app_id"; + // } + //} #endregion #region Email Textbox @@ -339,6 +327,18 @@ namespace QobuzDownloaderX #endregion + private void visableCheckbox_CheckedChanged(object sender, EventArgs e) + { + if (visableCheckbox.Checked == true) + { + passwordTextbox.UseSystemPasswordChar = true; + } + else + { + passwordTextbox.UseSystemPasswordChar = false; + } + } + private void exitLabel_Click(object sender, EventArgs e) { Application.Exit(); @@ -401,62 +401,12 @@ namespace QobuzDownloaderX } } - private void loginBG_DoWork(object sender, DoWorkEventArgs e) - { - loginBG.WorkerSupportsCancellation = true; - - // Create WebRequest to login using login information from input textboxes. - WebRequest wr = WebRequest.Create("https://www.qobuz.com/api.json/0.2/user/login?email=" + emailTextbox.Text + "&password=" + passwordTextbox.Text + "&app_id=" + appidTextbox.Text); - - try - { - // Grab info to be displayed and used. - WebResponse ws = wr.GetResponse(); - StreamReader sr = new StreamReader(ws.GetResponseStream()); - - string loginRequest = sr.ReadToEnd(); - string text = loginRequest; - - // Grab display name - var displayNameLog = Regex.Match(loginRequest, "\"display_name\":\"(?.*?)\",\\\"").Groups; - var displayName = displayNameLog[1].Value; - qbdlx.displayName = displayName; - - // Grab account type - var accountTypeLog = Regex.Match(loginRequest, "short_label\":\"(?\\w+)").Groups; - var accountType = accountTypeLog[1].Value; - qbdlx.accountType = accountType; - - // Grab authentication token - var userAuth = Regex.Match(loginRequest, "\"user_auth_token\":\"(?.*?)\\\"}").Groups; - var userAuthToken = userAuth[1].Value; - - // Set user_auth_token - qbdlx.userAuth = userAuthToken; - loginText.Invoke(new Action(() => loginText.Text = "Login Successful! Getting app_secret...")); - } - catch (Exception ex) - { - // If connection to API fails, show error info. - string error = ex.ToString(); - loginText.Invoke(new Action(() => loginText.Text = "Login Failed. Error Log saved")); - System.IO.File.WriteAllText(errorLog, error); - wr.Abort(); - loginButton.Invoke(new Action(() => loginButton.Enabled = true)); - return; - } - - wr.Abort(); - getSecretBG.RunWorkerAsync(); - loginBG.CancelAsync(); - } - private void getSecretBG_DoWork(object sender, DoWorkEventArgs e) { getSecretBG.WorkerSupportsCancellation = true; WebClient bundleURLClient = new WebClient(); - string bundleHTML = bundleURLClient.DownloadString("https://play.qobuz.com/"); + string bundleHTML = bundleURLClient.DownloadString("https://play.qobuz.com/login"); // Grab link to bundle.js var bundleLog = Regex.Match(bundleHTML, "