From 1296a228affb02f0b0fa2bc7f962e5a993332082 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 28 Sep 2008 18:19:47 +0000 Subject: [PATCH] WinGui: - AppcastReader.cs re-factored. Reduces number of connections to the server. - Few UI tweaks to the updater / downloader git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1781 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/Functions/AppcastReader.cs | 122 ++++++++++++------------- win/C#/Functions/Common.cs | 1 + win/C#/HandBrakeCS.csproj | 5 +- win/C#/Properties/Resources.resx | 6 +- win/C#/Properties/Settings.Designer.cs | 2 +- win/C#/Properties/Settings.settings | 2 +- win/C#/app.config | 2 +- win/C#/frmDownload.Designer.cs | 9 +- win/C#/frmDownload.cs | 11 +-- win/C#/frmMain.cs | 7 +- win/C#/frmUpdater.Designer.cs | 79 ++++------------ win/C#/frmUpdater.cs | 14 +-- 12 files changed, 107 insertions(+), 153 deletions(-) diff --git a/win/C#/Functions/AppcastReader.cs b/win/C#/Functions/AppcastReader.cs index 6e9d97ea7..dfe96eb74 100644 --- a/win/C#/Functions/AppcastReader.cs +++ b/win/C#/Functions/AppcastReader.cs @@ -6,30 +6,80 @@ using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; using System.IO; using System.Xml; using System.Text.RegularExpressions; namespace Handbrake.Functions { - class AppcastReader + public class AppcastReader { - XmlTextReader rssReader; XmlDocument rssDoc; XmlNode nodeRss; XmlNode nodeChannel; XmlNode nodeItem; - private string hb_versionInfo; + private string hb_description; private string hb_version; private string hb_build; private string hb_file; - // Rss Reading Code. + /// + /// Get the build information from the required appcasts. + /// This must be run before calling any of the public return functions. + /// + public void getInfo() + { + Match ver; + int stable_build, unstable_build = 0; + string input, unstable_description = "", stable_description, unstable_version = "", stable_version; + string stable_file, unstable_file = ""; + + // Check the stable appcast and get the stable build number + readRss(new XmlTextReader(Properties.Settings.Default.appcast)); + input = nodeItem.InnerXml; + ver = Regex.Match(input, @"sparkle:version=""([0-9]*)\"""); + stable_build = int.Parse(ver.ToString().Replace("sparkle:version=", "").Replace("\"", "")); + ver = Regex.Match(input, @"sparkle:shortVersionString=""([0-9].[0-9].[0-9]*)\"""); + stable_version = ver.ToString().Replace("sparkle:shortVersionString=", "").Replace("\"", ""); + stable_description = nodeItem["description"].InnerText; + stable_file = nodeItem["windows"].InnerText; + + // If this is a snapshot release, or the user wants to check for snapshot releases + if (Properties.Settings.Default.checkSnapshot == "Checked" || Properties.Settings.Default.hb_build.ToString().EndsWith("1")) + { + // Get the stable build + readRss(new XmlTextReader(Properties.Settings.Default.appcast_unstable)); + input = nodeItem.InnerXml; + ver = Regex.Match(input, @"sparkle:version=""([0-9]*)\"""); + unstable_build = int.Parse(ver.ToString().Replace("sparkle:version=", "").Replace("\"", "")); + ver = Regex.Match(input, @"sparkle:shortVersionString=""([0-9a-zA-Z.]*)\"""); + unstable_version = ver.ToString().Replace("sparkle:shortVersionString=", "").Replace("\"", ""); + unstable_description = nodeItem["description"].InnerText; + unstable_file = nodeItem["windows"].InnerText; + } + + + // Set the global version information + if (stable_build >= unstable_build) + { + hb_description = stable_description; + hb_version = stable_version; + hb_build = stable_build.ToString(); + hb_file = stable_file; + } + else + { + hb_description = unstable_description; + hb_version = unstable_version; + hb_build = unstable_build.ToString(); + hb_file = unstable_file; + } + } + + /// + /// Read the RSS file. + /// + /// private void readRss(XmlTextReader rssReader) { rssDoc = new XmlDocument(); @@ -54,62 +104,13 @@ namespace Handbrake.Functions } } - - // Get's the information required out the RSS file. - private void getInfo() - { - Match ver; - int unstable_build = 0; - string input; - - // Check the stable appcast and get the build nuber - rssReader = new XmlTextReader(Properties.Settings.Default.appcast); - readRss(rssReader); - input = nodeItem.InnerXml; - ver = Regex.Match(input, @"sparkle:version=""([0-9]*)\"""); - int stable_build = int.Parse(ver.ToString().Replace("sparkle:version=", "").Replace("\"", "")); - - // If the pref to enable unstable appcast checking is enabled OR - // this is a snapshot release, - // then check the unstable appcast. - if (Properties.Settings.Default.checkSnapshot == "Checked" || Properties.Settings.Default.hb_build.ToString().EndsWith("1")) - { - // Get the stable build - rssReader = new XmlTextReader(Properties.Settings.Default.appcast_unstable); - readRss(rssReader); - input = nodeItem.InnerXml; - ver = Regex.Match(input, @"sparkle:version=""([0-9]*)\"""); - unstable_build = int.Parse(ver.ToString().Replace("sparkle:version=", "").Replace("\"", "")); - } - - if (stable_build >= unstable_build) - rssReader = new XmlTextReader(Properties.Settings.Default.appcast); - else - rssReader = new XmlTextReader(Properties.Settings.Default.appcast_unstable); - - // Get the Version Information - hb_versionInfo = nodeItem["description"].InnerText; - - // Get the version - string inputNode = nodeItem.InnerXml; - ver = Regex.Match(inputNode, @"sparkle:shortVersionString=""([0-9].[0-9].[0-9]*)\"""); - hb_version = ver.ToString().Replace("sparkle:shortVersionString=", "").Replace("\"", ""); - - ver = Regex.Match(inputNode, @"sparkle:version=""([0-9]*)\"""); - hb_build = ver.ToString().Replace("sparkle:version=", "").Replace("\"", ""); - - // Get the update file - hb_file = nodeItem["windows"].InnerText; - } - /// /// Get Information about an update to HandBrake /// /// public string versionInfo() { - getInfo(); - return hb_versionInfo; + return hb_description; } /// @@ -118,7 +119,6 @@ namespace Handbrake.Functions /// public string version() { - getInfo(); return hb_version; } @@ -128,7 +128,6 @@ namespace Handbrake.Functions /// public string build() { - getInfo(); return hb_build; } @@ -138,7 +137,6 @@ namespace Handbrake.Functions /// public string downloadFile() { - getInfo(); return hb_file; } } diff --git a/win/C#/Functions/Common.cs b/win/C#/Functions/Common.cs index 708a7167e..48c131ed8 100644 --- a/win/C#/Functions/Common.cs +++ b/win/C#/Functions/Common.cs @@ -1172,6 +1172,7 @@ namespace Handbrake.Functions try { Functions.AppcastReader rssRead = new Functions.AppcastReader(); + rssRead.getInfo(); // Initializes the class. string build = rssRead.build(); int latest = int.Parse(build); diff --git a/win/C#/HandBrakeCS.csproj b/win/C#/HandBrakeCS.csproj index 801635c09..ce04fa177 100644 --- a/win/C#/HandBrakeCS.csproj +++ b/win/C#/HandBrakeCS.csproj @@ -34,6 +34,7 @@ 1.0.0.%2a false true + false true @@ -50,7 +51,7 @@ - full + pdbonly true bin\Release\ DEBUG;TRACE @@ -63,6 +64,8 @@ true false true + 512 + AnyCPU x86 diff --git a/win/C#/Properties/Resources.resx b/win/C#/Properties/Resources.resx index c2b74953d..c4f88cfed 100644 --- a/win/C#/Properties/Resources.resx +++ b/win/C#/Properties/Resources.resx @@ -121,9 +121,6 @@ ..\Resources\General Preferences.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Queue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\Pref_Small.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -187,4 +184,7 @@ ..\Resources\save.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Queue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/win/C#/Properties/Settings.Designer.cs b/win/C#/Properties/Settings.Designer.cs index f1ce04bcd..63a2b07cd 100644 --- a/win/C#/Properties/Settings.Designer.cs +++ b/win/C#/Properties/Settings.Designer.cs @@ -181,7 +181,7 @@ namespace Handbrake.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("http://handbrake.fr/appcast_unstable.xml")] + [global::System.Configuration.DefaultSettingValueAttribute("http://handbrake.fr/appcast_test.xml")] public string appcast_unstable { get { return ((string)(this["appcast_unstable"])); diff --git a/win/C#/Properties/Settings.settings b/win/C#/Properties/Settings.settings index 60694165d..a47faee27 100644 --- a/win/C#/Properties/Settings.settings +++ b/win/C#/Properties/Settings.settings @@ -42,7 +42,7 @@ http://handbrake.fr/appcast.xml - http://handbrake.fr/appcast_unstable.xml + http://handbrake.fr/appcast_test.xml Checked diff --git a/win/C#/app.config b/win/C#/app.config index ce66d92db..479fe2751 100644 --- a/win/C#/app.config +++ b/win/C#/app.config @@ -47,7 +47,7 @@ http://handbrake.fr/appcast.xml - http://handbrake.fr/appcast_unstable.xml + http://handbrake.fr/appcast_test.xml Checked diff --git a/win/C#/frmDownload.Designer.cs b/win/C#/frmDownload.Designer.cs index 48ba0831f..5d0f4523c 100644 --- a/win/C#/frmDownload.Designer.cs +++ b/win/C#/frmDownload.Designer.cs @@ -46,7 +46,7 @@ namespace Handbrake // this.lblProgress.AutoSize = true; this.lblProgress.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblProgress.Location = new System.Drawing.Point(90, 54); + this.lblProgress.Location = new System.Drawing.Point(93, 38); this.lblProgress.Name = "lblProgress"; this.lblProgress.Size = new System.Drawing.Size(115, 13); this.lblProgress.TabIndex = 10; @@ -54,7 +54,7 @@ namespace Handbrake // // progress_download // - this.progress_download.Location = new System.Drawing.Point(93, 28); + this.progress_download.Location = new System.Drawing.Point(93, 12); this.progress_download.Name = "progress_download"; this.progress_download.Size = new System.Drawing.Size(318, 23); this.progress_download.Style = System.Windows.Forms.ProgressBarStyle.Continuous; @@ -72,7 +72,6 @@ namespace Handbrake // // btn_cancel // - this.btn_cancel.BackColor = System.Drawing.Color.Silver; this.btn_cancel.FlatAppearance.BorderColor = System.Drawing.Color.Black; this.btn_cancel.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_cancel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); @@ -81,21 +80,19 @@ namespace Handbrake this.btn_cancel.Size = new System.Drawing.Size(90, 22); this.btn_cancel.TabIndex = 56; this.btn_cancel.Text = "Cancel"; - this.btn_cancel.UseVisualStyleBackColor = true; + this.btn_cancel.UseVisualStyleBackColor = false; this.btn_cancel.Click += new System.EventHandler(this.btn_cancel_Click); // // frmDownload // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.Silver; this.ClientSize = new System.Drawing.Size(426, 87); this.Controls.Add(this.btn_cancel); this.Controls.Add(this.PictureBox1); this.Controls.Add(this.lblProgress); this.Controls.Add(this.progress_download); this.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "frmDownload"; this.ShowIcon = false; diff --git a/win/C#/frmDownload.cs b/win/C#/frmDownload.cs index 872ec87e7..8fe53ba4f 100644 --- a/win/C#/frmDownload.cs +++ b/win/C#/frmDownload.cs @@ -6,10 +6,6 @@ using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; using System.Windows.Forms; using System.Net; using System.IO; @@ -30,20 +26,21 @@ namespace Handbrake private delegate void DownloadCompleteCallback(); private delegate void DownloadFailedCallback(); + private string file; - public frmDownload() + public frmDownload(string filename) { InitializeComponent(); + file = filename; downloadThread = new Thread(Download); downloadThread.Start(); } private void Download() { - Functions.AppcastReader rssRead = new Functions.AppcastReader(); string tempPath = Path.Combine(Path.GetTempPath(), "handbrake-setup.exe"); - string hbUpdate = rssRead.downloadFile(); + string hbUpdate = file; WebClient wcDownload = new WebClient(); try diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 88f26851c..18ba21460 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -21,14 +21,13 @@ namespace Handbrake { public partial class frmMain : Form { - // Declarations ******************************************************* Functions.Common hb_common_func = new Functions.Common(); Functions.x264Panel x264PanelFunctions = new Functions.x264Panel(); Functions.Encode cliObj = new Functions.Encode(); Functions.Queue encodeQueue = new Functions.Queue(); - Parsing.Title selectedTitle; Functions.Presets presetHandler = new Functions.Presets(); + Parsing.Title selectedTitle; internal Process hbProc; private Parsing.DVD thisDVD; private frmQueue queueWindow = new frmQueue(); @@ -69,7 +68,6 @@ namespace Handbrake Properties.Settings.Default.hb_version = "0"; } } - Thread.Sleep(100); // show the form, but leave disabled until preloading is complete then show the main form this.Enabled = false; @@ -83,7 +81,6 @@ namespace Handbrake Application.DoEvents(); Thread updateCheckThread = new Thread(startupUpdateCheck); updateCheckThread.Start(); - Thread.Sleep(100); } // Setup the GUI components @@ -100,12 +97,10 @@ namespace Handbrake if (Properties.Settings.Default.tooltipEnable == "Checked") ToolTip.Active = true; lbl_encode.Text = ""; - Thread.Sleep(100); //Finished Loading lblStatus.Text = "Loading Complete!"; Application.DoEvents(); - Thread.Sleep(100); //Close the splash screen splash.Close(); diff --git a/win/C#/frmUpdater.Designer.cs b/win/C#/frmUpdater.Designer.cs index b8b2bf82c..d51d50005 100644 --- a/win/C#/frmUpdater.Designer.cs +++ b/win/C#/frmUpdater.Designer.cs @@ -36,10 +36,6 @@ namespace Handbrake { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmUpdater)); this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.lbl_newVersion = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.lbl_oldVersion = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.wBrowser = new System.Windows.Forms.WebBrowser(); this.btn_skip = new System.Windows.Forms.Button(); @@ -47,6 +43,7 @@ namespace Handbrake this.btn_remindLater = new System.Windows.Forms.Button(); this.label3 = new System.Windows.Forms.Label(); this.PictureBox1 = new System.Windows.Forms.PictureBox(); + this.lbl_update_text = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.PictureBox1)).BeginInit(); this.SuspendLayout(); // @@ -60,46 +57,6 @@ namespace Handbrake this.label1.TabIndex = 25; this.label1.Text = "A New Version of Handbrake is available!"; // - // label2 - // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label2.Location = new System.Drawing.Point(91, 33); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(69, 13); - this.label2.TabIndex = 26; - this.label2.Text = "Handbrake"; - // - // lbl_newVersion - // - this.lbl_newVersion.AutoSize = true; - this.lbl_newVersion.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbl_newVersion.Location = new System.Drawing.Point(155, 33); - this.lbl_newVersion.Name = "lbl_newVersion"; - this.lbl_newVersion.Size = new System.Drawing.Size(120, 13); - this.lbl_newVersion.TabIndex = 27; - this.lbl_newVersion.Text = "0.0.0 (0000000000)"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label4.Location = new System.Drawing.Point(274, 33); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(98, 13); - this.label4.TabIndex = 28; - this.label4.Text = "is now available"; - // - // lbl_oldVersion - // - this.lbl_oldVersion.AutoSize = true; - this.lbl_oldVersion.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbl_oldVersion.Location = new System.Drawing.Point(370, 33); - this.lbl_oldVersion.Name = "lbl_oldVersion"; - this.lbl_oldVersion.Size = new System.Drawing.Size(103, 13); - this.lbl_oldVersion.TabIndex = 29; - this.lbl_oldVersion.Text = "(you have 0.0.0)"; - // // label6 // this.label6.AutoSize = true; @@ -112,10 +69,10 @@ namespace Handbrake // // wBrowser // - this.wBrowser.Location = new System.Drawing.Point(94, 82); + this.wBrowser.Location = new System.Drawing.Point(94, 88); this.wBrowser.MinimumSize = new System.Drawing.Size(20, 20); this.wBrowser.Name = "wBrowser"; - this.wBrowser.Size = new System.Drawing.Size(471, 155); + this.wBrowser.Size = new System.Drawing.Size(503, 155); this.wBrowser.TabIndex = 31; // // btn_skip @@ -125,7 +82,7 @@ namespace Handbrake this.btn_skip.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btn_skip.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_skip.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); - this.btn_skip.Location = new System.Drawing.Point(94, 244); + this.btn_skip.Location = new System.Drawing.Point(94, 250); this.btn_skip.Name = "btn_skip"; this.btn_skip.Size = new System.Drawing.Size(133, 22); this.btn_skip.TabIndex = 54; @@ -140,7 +97,7 @@ namespace Handbrake this.btn_installUpdate.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btn_installUpdate.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_installUpdate.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); - this.btn_installUpdate.Location = new System.Drawing.Point(432, 244); + this.btn_installUpdate.Location = new System.Drawing.Point(464, 250); this.btn_installUpdate.Name = "btn_installUpdate"; this.btn_installUpdate.Size = new System.Drawing.Size(133, 22); this.btn_installUpdate.TabIndex = 55; @@ -155,7 +112,7 @@ namespace Handbrake this.btn_remindLater.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btn_remindLater.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_remindLater.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); - this.btn_remindLater.Location = new System.Drawing.Point(293, 244); + this.btn_remindLater.Location = new System.Drawing.Point(325, 250); this.btn_remindLater.Name = "btn_remindLater"; this.btn_remindLater.Size = new System.Drawing.Size(133, 22); this.btn_remindLater.TabIndex = 56; @@ -167,7 +124,7 @@ namespace Handbrake // this.label3.AutoSize = true; this.label3.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label3.Location = new System.Drawing.Point(91, 66); + this.label3.Location = new System.Drawing.Point(91, 72); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(103, 13); this.label3.TabIndex = 57; @@ -183,21 +140,28 @@ namespace Handbrake this.PictureBox1.TabIndex = 24; this.PictureBox1.TabStop = false; // + // lbl_update_text + // + this.lbl_update_text.AutoSize = true; + this.lbl_update_text.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbl_update_text.Location = new System.Drawing.Point(91, 31); + this.lbl_update_text.Name = "lbl_update_text"; + this.lbl_update_text.Size = new System.Drawing.Size(489, 13); + this.lbl_update_text.TabIndex = 58; + this.lbl_update_text.Text = "HandBrake {0.0.0} (000000000) is now available. (You have: {0.0.0} (000000000))"; + // // frmUpdater // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(577, 272); + this.ClientSize = new System.Drawing.Size(609, 288); + this.Controls.Add(this.lbl_update_text); this.Controls.Add(this.label3); this.Controls.Add(this.btn_remindLater); this.Controls.Add(this.btn_installUpdate); this.Controls.Add(this.btn_skip); this.Controls.Add(this.wBrowser); this.Controls.Add(this.label6); - this.Controls.Add(this.lbl_oldVersion); - this.Controls.Add(this.label4); - this.Controls.Add(this.lbl_newVersion); - this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Controls.Add(this.PictureBox1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); @@ -214,15 +178,12 @@ namespace Handbrake internal System.Windows.Forms.PictureBox PictureBox1; private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label lbl_newVersion; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label lbl_oldVersion; private System.Windows.Forms.Label label6; private System.Windows.Forms.WebBrowser wBrowser; internal System.Windows.Forms.Button btn_skip; internal System.Windows.Forms.Button btn_installUpdate; internal System.Windows.Forms.Button btn_remindLater; private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label lbl_update_text; } } \ No newline at end of file diff --git a/win/C#/frmUpdater.cs b/win/C#/frmUpdater.cs index 6252bb9b8..271e17bc0 100644 --- a/win/C#/frmUpdater.cs +++ b/win/C#/frmUpdater.cs @@ -14,29 +14,31 @@ namespace Handbrake { public partial class frmUpdater : Form { - Functions.AppcastReader rssRead = new Functions.AppcastReader(); + Functions.AppcastReader appcast = new Functions.AppcastReader(); public frmUpdater() { InitializeComponent(); + appcast.getInfo(); // Initializes the appcast getRss(); setVersions(); } private void getRss() { - wBrowser.DocumentText = "" + rssRead.versionInfo() + ""; + wBrowser.DocumentText = "" + appcast.versionInfo() + ""; } private void setVersions() { - lbl_oldVersion.Text = "(you have: " + Properties.Settings.Default.hb_version + " / " + Properties.Settings.Default.hb_build + ")."; - lbl_newVersion.Text = rssRead.version() + " (" + rssRead.build() + ")"; + string old = "(You have: " + Properties.Settings.Default.hb_version.Trim() + " / " + Properties.Settings.Default.hb_build.ToString().Trim() + ")"; + string newBuild = appcast.version().Trim() + " (" + appcast.build() + ")"; + lbl_update_text.Text = "HandBrake " + newBuild + " is now available. " + old; } private void btn_installUpdate_Click(object sender, EventArgs e) { - frmDownload download = new frmDownload(); + frmDownload download = new frmDownload(appcast.downloadFile()); download.Show(); this.Close(); } @@ -48,7 +50,7 @@ namespace Handbrake private void btn_skip_Click(object sender, EventArgs e) { - Properties.Settings.Default.skipversion = int.Parse(rssRead.build()); + Properties.Settings.Default.skipversion = int.Parse(appcast.build()); Properties.Settings.Default.Save(); this.Close(); -- 2.40.0