diff --git a/CHANGELOG.MD b/CHANGELOG.MD index cd41be1..762d0ea 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,3 +1,7 @@ +# 0.5.2 +- Fixed (hopefully) an issue where the settings manager would try to write to a closed stream +- Added a "see what's new" button to the automatic update form +- Set the correct version because apparently I'm a doof # 0.5.1 - Fixed some UI design issues - Added PDB files for each assembly diff --git a/WPlugins.Common/About.cs b/WPlugins.Common/About.cs index aaf6c16..c38d0a4 100644 --- a/WPlugins.Common/About.cs +++ b/WPlugins.Common/About.cs @@ -36,7 +36,7 @@ public static class Info static Info() { - Version = new SemanticVersion(0, 5, 0); + Version = new SemanticVersion(0, 5, 2); PluginDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); } } diff --git a/WPlugins.Common/AutoUpdateForm.Designer.cs b/WPlugins.Common/AutoUpdateForm.Designer.cs index 4ab6e72..6c369e8 100644 --- a/WPlugins.Common/AutoUpdateForm.Designer.cs +++ b/WPlugins.Common/AutoUpdateForm.Designer.cs @@ -38,6 +38,7 @@ private void InitializeComponent() this.skipButton = new System.Windows.Forms.Button(); this.disableButton = new System.Windows.Forms.Button(); this.privacyLink = new System.Windows.Forms.LinkLabel(); + this.showChangelogLink = new System.Windows.Forms.LinkLabel(); this.SuspendLayout(); // // label1 @@ -87,7 +88,7 @@ private void InitializeComponent() // this.visitUpdateButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.visitUpdateButton.Location = new System.Drawing.Point(12, 112); + this.visitUpdateButton.Location = new System.Drawing.Point(12, 134); this.visitUpdateButton.Name = "visitUpdateButton"; this.visitUpdateButton.Size = new System.Drawing.Size(153, 23); this.visitUpdateButton.TabIndex = 0; @@ -98,7 +99,7 @@ private void InitializeComponent() // ignoreButton // this.ignoreButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.ignoreButton.Location = new System.Drawing.Point(171, 112); + this.ignoreButton.Location = new System.Drawing.Point(171, 134); this.ignoreButton.Name = "ignoreButton"; this.ignoreButton.Size = new System.Drawing.Size(95, 23); this.ignoreButton.TabIndex = 1; @@ -109,7 +110,7 @@ private void InitializeComponent() // skipButton // this.skipButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.skipButton.Location = new System.Drawing.Point(171, 141); + this.skipButton.Location = new System.Drawing.Point(171, 163); this.skipButton.Name = "skipButton"; this.skipButton.Size = new System.Drawing.Size(95, 23); this.skipButton.TabIndex = 3; @@ -121,7 +122,7 @@ private void InitializeComponent() // this.disableButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.disableButton.Location = new System.Drawing.Point(12, 141); + this.disableButton.Location = new System.Drawing.Point(12, 163); this.disableButton.Name = "disableButton"; this.disableButton.Size = new System.Drawing.Size(153, 23); this.disableButton.TabIndex = 2; @@ -132,7 +133,7 @@ private void InitializeComponent() // privacyLink // this.privacyLink.LinkArea = new System.Windows.Forms.LinkArea(66, 26); - this.privacyLink.Location = new System.Drawing.Point(12, 79); + this.privacyLink.Location = new System.Drawing.Point(12, 101); this.privacyLink.Name = "privacyLink"; this.privacyLink.Size = new System.Drawing.Size(254, 30); this.privacyLink.TabIndex = 5; @@ -142,11 +143,23 @@ private void InitializeComponent() this.privacyLink.UseCompatibleTextRendering = true; this.privacyLink.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.privacyLink_LinkClicked); // + // showChangelogLink + // + this.showChangelogLink.Location = new System.Drawing.Point(12, 66); + this.showChangelogLink.Name = "showChangelogLink"; + this.showChangelogLink.Size = new System.Drawing.Size(254, 23); + this.showChangelogLink.TabIndex = 6; + this.showChangelogLink.TabStop = true; + this.showChangelogLink.Text = "What\'s new in this version?"; + this.showChangelogLink.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.showChangelogLink.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.showChangelogLink_LinkClicked); + // // AutoUpdateForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(278, 179); + this.ClientSize = new System.Drawing.Size(278, 201); + this.Controls.Add(this.showChangelogLink); this.Controls.Add(this.privacyLink); this.Controls.Add(this.disableButton); this.Controls.Add(this.skipButton); @@ -179,5 +192,6 @@ private void InitializeComponent() private System.Windows.Forms.Button skipButton; private System.Windows.Forms.Button disableButton; private System.Windows.Forms.LinkLabel privacyLink; + private System.Windows.Forms.LinkLabel showChangelogLink; } } \ No newline at end of file diff --git a/WPlugins.Common/AutoUpdateForm.cs b/WPlugins.Common/AutoUpdateForm.cs index 744130d..7d947c1 100644 --- a/WPlugins.Common/AutoUpdateForm.cs +++ b/WPlugins.Common/AutoUpdateForm.cs @@ -88,6 +88,11 @@ private void AutoUpdateForm_FormClosed(object sender, FormClosedEventArgs e) Settings.Save(); } + private void showChangelogLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + MessageBox.Show(VersionCheck.Description, "Changelog", MessageBoxButtons.OK); + } + private void privacyLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { string note = diff --git a/WPlugins.Common/Settings.cs b/WPlugins.Common/Settings.cs index c82082c..1e14f23 100644 --- a/WPlugins.Common/Settings.cs +++ b/WPlugins.Common/Settings.cs @@ -24,6 +24,8 @@ You should have received a copy of the GNU General Public License using System.Xml; using System.Xml.Serialization; +// TODO: Rewrite the code that opens/closes + namespace WPlugins.Common { public static class Settings @@ -63,8 +65,16 @@ public static SettingsData Import(string path) if (_stream == null) _stream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.ReadWrite); reader = XmlReader.Create(_stream); - - settings = (SettingsData)_serializer.Deserialize(reader); + try + { + settings = (SettingsData)_serializer.Deserialize(reader); + } + catch(ObjectDisposedException) + { + _stream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.ReadWrite); + reader = XmlReader.Create(_stream); + settings = (SettingsData)_serializer.Deserialize(reader); + } } catch (Exception ex) { @@ -100,7 +110,17 @@ public static void Export(string path, SettingsData settings) _stream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.ReadWrite); writer = XmlWriter.Create(_stream); - _serializer.Serialize(writer, settings); + try + { + _serializer.Serialize(writer, settings); + } + catch(ObjectDisposedException) + { + // This code is all kinds of fucked. I need to get a grip on streams. + _stream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.ReadWrite); + writer = XmlWriter.Create(_stream); + _serializer.Serialize(writer, settings); + } } catch (Exception ex) { diff --git a/WPlugins.Common/VersionCheck.cs b/WPlugins.Common/VersionCheck.cs index ef0193c..e77ab96 100644 --- a/WPlugins.Common/VersionCheck.cs +++ b/WPlugins.Common/VersionCheck.cs @@ -30,6 +30,19 @@ public static class VersionCheck { public const string RELEASE_URL = "https://api.github.com/repos/wampa842/wplugins/releases/latest"; + private static string _description; + public static string Description + { + get + { + if(string.IsNullOrEmpty(_description)) + { + GetLatestVersion(); + } + return _description; + } + } + // Extract the semver string from the JSON file from GitHub's web API. The return value indicates whether the operation was successful. private static bool GetVersionString(string content, out string version) { @@ -39,7 +52,13 @@ private static bool GetVersionString(string content, out string version) return false; } - Match regex = Regex.Match(content, "\"tag_name\"[\\s:]*\"([\\d.]*)\""); + Match regex = Regex.Match(content, "\"body\":.?\"(.*)\""); + if(regex.Success) + { + _description = regex.Groups[1].ToString().Replace("\\n", "\n").Replace("\\r", ""); + } + + regex = Regex.Match(content, "\"tag_name\"[\\s:]*\"([\\d.]*)\""); if(regex.Success) { version = regex.Groups[1].ToString();