From 77590fd9e45bd99af9fe846623918c09eb993377 Mon Sep 17 00:00:00 2001 From: Bitl Date: Sun, 25 Jul 2021 11:51:12 -0700 Subject: [PATCH] add downloader override url textbox. --- .../Forms/SDK/AssetSDK.Designer.cs | 51 ++++++++++++++++--- Novetus/NovetusLauncher/Forms/SDK/AssetSDK.cs | 15 ++++++ 2 files changed, 58 insertions(+), 8 deletions(-) diff --git a/Novetus/NovetusLauncher/Forms/SDK/AssetSDK.Designer.cs b/Novetus/NovetusLauncher/Forms/SDK/AssetSDK.Designer.cs index c013fee..c3e20bb 100644 --- a/Novetus/NovetusLauncher/Forms/SDK/AssetSDK.Designer.cs +++ b/Novetus/NovetusLauncher/Forms/SDK/AssetSDK.Designer.cs @@ -28,6 +28,9 @@ { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AssetSDK)); this.AssetDownloader = new System.Windows.Forms.GroupBox(); + this.CustomDLURLLabel = new System.Windows.Forms.Label(); + this.URLOverrideBox = new System.Windows.Forms.TextBox(); + this.URLListLabel = new System.Windows.Forms.Label(); this.AssetDownloaderBatch_Note = new System.Windows.Forms.Label(); this.AssetDownloaderBatch_Status = new System.Windows.Forms.Label(); this.AssetDownloader_BatchMode = new System.Windows.Forms.CheckBox(); @@ -68,6 +71,9 @@ // // AssetDownloader // + this.AssetDownloader.Controls.Add(this.CustomDLURLLabel); + this.AssetDownloader.Controls.Add(this.URLOverrideBox); + this.AssetDownloader.Controls.Add(this.URLListLabel); this.AssetDownloader.Controls.Add(this.AssetDownloaderBatch_Note); this.AssetDownloader.Controls.Add(this.AssetDownloaderBatch_Status); this.AssetDownloader.Controls.Add(this.AssetDownloader_BatchMode); @@ -88,12 +94,38 @@ this.AssetDownloader.TabStop = false; this.AssetDownloader.Text = "Asset Downloader"; // + // CustomDLURLLabel + // + this.CustomDLURLLabel.AutoSize = true; + this.CustomDLURLLabel.Location = new System.Drawing.Point(130, 60); + this.CustomDLURLLabel.Name = "CustomDLURLLabel"; + this.CustomDLURLLabel.Size = new System.Drawing.Size(118, 13); + this.CustomDLURLLabel.TabIndex = 26; + this.CustomDLURLLabel.Text = "Custom Download URL"; + // + // URLOverrideBox + // + this.URLOverrideBox.Location = new System.Drawing.Point(128, 76); + this.URLOverrideBox.Name = "URLOverrideBox"; + this.URLOverrideBox.Size = new System.Drawing.Size(121, 20); + this.URLOverrideBox.TabIndex = 25; + this.URLOverrideBox.Click += new System.EventHandler(this.URLOverrideBox_Click); + // + // URLListLabel + // + this.URLListLabel.AutoSize = true; + this.URLListLabel.Location = new System.Drawing.Point(37, 60); + this.URLListLabel.Name = "URLListLabel"; + this.URLListLabel.Size = new System.Drawing.Size(48, 13); + this.URLListLabel.TabIndex = 24; + this.URLListLabel.Text = "URL List"; + // // AssetDownloaderBatch_Note // this.AssetDownloaderBatch_Note.AutoSize = true; this.AssetDownloaderBatch_Note.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.AssetDownloaderBatch_Note.ForeColor = System.Drawing.Color.Red; - this.AssetDownloaderBatch_Note.Location = new System.Drawing.Point(6, 138); + this.AssetDownloaderBatch_Note.Location = new System.Drawing.Point(6, 156); this.AssetDownloaderBatch_Note.Name = "AssetDownloaderBatch_Note"; this.AssetDownloaderBatch_Note.Size = new System.Drawing.Size(237, 24); this.AssetDownloaderBatch_Note.TabIndex = 23; @@ -116,7 +148,7 @@ // // AssetDownloader_BatchMode // - this.AssetDownloader_BatchMode.Location = new System.Drawing.Point(157, 114); + this.AssetDownloader_BatchMode.Location = new System.Drawing.Point(157, 132); this.AssetDownloader_BatchMode.Name = "AssetDownloader_BatchMode"; this.AssetDownloader_BatchMode.Size = new System.Drawing.Size(96, 24); this.AssetDownloader_BatchMode.TabIndex = 22; @@ -127,11 +159,11 @@ // AssetDownloaderBatch_BatchIDBox // this.AssetDownloaderBatch_BatchIDBox.Enabled = false; - this.AssetDownloaderBatch_BatchIDBox.Location = new System.Drawing.Point(6, 167); + this.AssetDownloaderBatch_BatchIDBox.Location = new System.Drawing.Point(6, 183); this.AssetDownloaderBatch_BatchIDBox.Multiline = true; this.AssetDownloaderBatch_BatchIDBox.Name = "AssetDownloaderBatch_BatchIDBox"; this.AssetDownloaderBatch_BatchIDBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.AssetDownloaderBatch_BatchIDBox.Size = new System.Drawing.Size(242, 105); + this.AssetDownloaderBatch_BatchIDBox.Size = new System.Drawing.Size(242, 89); this.AssetDownloaderBatch_BatchIDBox.TabIndex = 0; // // AssetDownloader_AssetNameBox @@ -151,7 +183,7 @@ // // AssetDownloader_LoadHelpMessage // - this.AssetDownloader_LoadHelpMessage.Location = new System.Drawing.Point(6, 114); + this.AssetDownloader_LoadHelpMessage.Location = new System.Drawing.Point(6, 132); this.AssetDownloader_LoadHelpMessage.Name = "AssetDownloader_LoadHelpMessage"; this.AssetDownloader_LoadHelpMessage.Size = new System.Drawing.Size(145, 24); this.AssetDownloader_LoadHelpMessage.TabIndex = 19; @@ -167,9 +199,9 @@ "https://assetdelivery.roblox.com/", "https://www.roblox.com/catalog/", "https://www.roblox.com/library/"}); - this.AssetDownloader_URLSelection.Location = new System.Drawing.Point(7, 58); + this.AssetDownloader_URLSelection.Location = new System.Drawing.Point(8, 76); this.AssetDownloader_URLSelection.Name = "AssetDownloader_URLSelection"; - this.AssetDownloader_URLSelection.Size = new System.Drawing.Size(242, 21); + this.AssetDownloader_URLSelection.Size = new System.Drawing.Size(114, 21); this.AssetDownloader_URLSelection.TabIndex = 18; this.AssetDownloader_URLSelection.SelectedIndexChanged += new System.EventHandler(this.AssetDownloader_URLSelection_SelectedIndexChanged); // @@ -211,7 +243,7 @@ // // AssetDownloader_AssetDownloaderButton // - this.AssetDownloader_AssetDownloaderButton.Location = new System.Drawing.Point(7, 85); + this.AssetDownloader_AssetDownloaderButton.Location = new System.Drawing.Point(7, 103); this.AssetDownloader_AssetDownloaderButton.Name = "AssetDownloader_AssetDownloaderButton"; this.AssetDownloader_AssetDownloaderButton.Size = new System.Drawing.Size(242, 23); this.AssetDownloader_AssetDownloaderButton.TabIndex = 13; @@ -485,4 +517,7 @@ private System.Windows.Forms.TextBox AssetDownloaderBatch_BatchIDBox; private System.Windows.Forms.Label AssetDownloaderBatch_Status; private System.Windows.Forms.Label AssetDownloaderBatch_Note; + private System.Windows.Forms.Label CustomDLURLLabel; + private System.Windows.Forms.TextBox URLOverrideBox; + private System.Windows.Forms.Label URLListLabel; } \ No newline at end of file diff --git a/Novetus/NovetusLauncher/Forms/SDK/AssetSDK.cs b/Novetus/NovetusLauncher/Forms/SDK/AssetSDK.cs index 3207b3c..84851cc 100644 --- a/Novetus/NovetusLauncher/Forms/SDK/AssetSDK.cs +++ b/Novetus/NovetusLauncher/Forms/SDK/AssetSDK.cs @@ -19,6 +19,7 @@ public partial class AssetSDK : Form private string url = "https://assetdelivery.roblox.com/v1/asset/?id="; private bool isWebSite = false; private bool batchMode = false; + private bool hasOverrideWarningOpenedOnce = false; //obj2mesh private OpenFileDialog MeshConverter_OpenOBJDialog; #endregion @@ -103,6 +104,11 @@ public partial class AssetSDK : Form private void AssetDownloader_AssetDownloaderButton_Click(object sender, EventArgs e) { + if (!string.IsNullOrWhiteSpace(URLOverrideBox.Text)) + { + url = URLOverrideBox.Text; + } + if (batchMode == false) { SDKFuncs.StartItemDownload( @@ -245,6 +251,15 @@ public partial class AssetSDK : Form break; } } + + private void URLOverrideBox_Click(object sender, EventArgs e) + { + if (hasOverrideWarningOpenedOnce == false) + { + MessageBox.Show("By using the custom URL setting, you will override any selected entry in the default URL list. Keep this in mind before downloading anything with this option.\n\nAlso, the URL must be a asset url with 'asset/?id=' at the end of it in order for the Asset Downloader to work smoothly.", "Novetus Asset SDK | URL Override Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); + hasOverrideWarningOpenedOnce = true; + } + } #endregion #region Mesh Converter