diff --git a/RedditRandomNumberGiveawayHelper/App.config b/RedditRandomNumberGiveawayHelper/App.config
index 9c05822..b9ef0ea 100644
--- a/RedditRandomNumberGiveawayHelper/App.config
+++ b/RedditRandomNumberGiveawayHelper/App.config
@@ -1,6 +1,18 @@
+
+
+
+
+
+
+
+
+ V0.2.0
+
+
+
\ No newline at end of file
diff --git a/RedditRandomNumberGiveawayHelper/MainForm.Designer.cs b/RedditRandomNumberGiveawayHelper/MainForm.Designer.cs
index a67f254..f2a255f 100644
--- a/RedditRandomNumberGiveawayHelper/MainForm.Designer.cs
+++ b/RedditRandomNumberGiveawayHelper/MainForm.Designer.cs
@@ -35,13 +35,17 @@
this.button1 = new System.Windows.Forms.Button();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
+ this.menuStrip1 = new System.Windows.Forms.MenuStrip();
+ this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.checkForUpdatesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.randomMax)).BeginInit();
+ this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(12, 15);
+ this.label1.Location = new System.Drawing.Point(11, 41);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(100, 13);
this.label1.TabIndex = 0;
@@ -49,14 +53,14 @@
//
// textBox1
//
- this.textBox1.Location = new System.Drawing.Point(118, 12);
+ this.textBox1.Location = new System.Drawing.Point(117, 38);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(463, 20);
this.textBox1.TabIndex = 1;
//
// randomMax
//
- this.randomMax.Location = new System.Drawing.Point(118, 39);
+ this.randomMax.Location = new System.Drawing.Point(117, 65);
this.randomMax.Maximum = new decimal(new int[] {
100000,
0,
@@ -79,7 +83,7 @@
// label2
//
this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(12, 41);
+ this.label2.Location = new System.Drawing.Point(11, 67);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(57, 13);
this.label2.TabIndex = 3;
@@ -87,7 +91,7 @@
//
// button1
//
- this.button1.Location = new System.Drawing.Point(239, 38);
+ this.button1.Location = new System.Drawing.Point(238, 64);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(342, 23);
this.button1.TabIndex = 4;
@@ -97,7 +101,7 @@
//
// textBox2
//
- this.textBox2.Location = new System.Drawing.Point(13, 95);
+ this.textBox2.Location = new System.Drawing.Point(12, 121);
this.textBox2.Multiline = true;
this.textBox2.Name = "textBox2";
this.textBox2.ReadOnly = true;
@@ -107,17 +111,42 @@
// label3
//
this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(268, 79);
+ this.label3.Location = new System.Drawing.Point(267, 105);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(37, 13);
this.label3.TabIndex = 6;
this.label3.Text = "Result";
//
+ // menuStrip1
+ //
+ this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.fileToolStripMenuItem});
+ this.menuStrip1.Location = new System.Drawing.Point(0, 0);
+ this.menuStrip1.Name = "menuStrip1";
+ this.menuStrip1.Size = new System.Drawing.Size(593, 24);
+ this.menuStrip1.TabIndex = 7;
+ this.menuStrip1.Text = "menuStrip1";
+ //
+ // fileToolStripMenuItem
+ //
+ this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.checkForUpdatesToolStripMenuItem});
+ this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
+ this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
+ this.fileToolStripMenuItem.Text = "File";
+ //
+ // checkForUpdatesToolStripMenuItem
+ //
+ this.checkForUpdatesToolStripMenuItem.Name = "checkForUpdatesToolStripMenuItem";
+ this.checkForUpdatesToolStripMenuItem.Size = new System.Drawing.Size(170, 22);
+ this.checkForUpdatesToolStripMenuItem.Text = "Check for updates";
+ this.checkForUpdatesToolStripMenuItem.Click += new System.EventHandler(this.checkForUpdatesToolStripMenuItem_Click);
+ //
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(593, 247);
+ this.ClientSize = new System.Drawing.Size(593, 273);
this.Controls.Add(this.label3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.button1);
@@ -125,10 +154,14 @@
this.Controls.Add(this.randomMax);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1);
+ this.Controls.Add(this.menuStrip1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
+ this.MainMenuStrip = this.menuStrip1;
this.Name = "MainForm";
this.Text = "Reddit random giveaway helper";
((System.ComponentModel.ISupportInitialize)(this.randomMax)).EndInit();
+ this.menuStrip1.ResumeLayout(false);
+ this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -143,6 +176,9 @@
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.MenuStrip menuStrip1;
+ private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem checkForUpdatesToolStripMenuItem;
}
}
diff --git a/RedditRandomNumberGiveawayHelper/MainForm.cs b/RedditRandomNumberGiveawayHelper/MainForm.cs
index 6bc9d05..8f3329e 100644
--- a/RedditRandomNumberGiveawayHelper/MainForm.cs
+++ b/RedditRandomNumberGiveawayHelper/MainForm.cs
@@ -12,6 +12,7 @@ using RedditSharp.Things;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;
+using Octokit;
namespace RedditRandomNumberGiveawayHelper
{
@@ -119,5 +120,34 @@ namespace RedditRandomNumberGiveawayHelper
diff
);
}
+
+ private async void checkForUpdatesToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var github = new GitHubClient(new ProductHeaderValue("RedditRandomNumberGiveawayHelper"));
+ var releases = await github.Release.GetAll("gardient", "RedditRandomNumberGiveawayHelper");
+ var newestRelease = releases.OrderByDescending(x => x.Id).FirstOrDefault();
+ var versionRegex = new Regex(@"^v(?\d+)\.(?\d+)(\.(?\d+))?$", RegexOptions.IgnoreCase);
+ var tagMatch = versionRegex.Match(newestRelease.TagName);
+ if (tagMatch.Success)
+ {
+ var versionMatch = versionRegex.Match(Properties.Settings.Default.Version);
+ if (versionMatch.Success)
+ {
+ if (int.Parse(versionMatch.Result("${major}")) >= int.Parse(tagMatch.Result("${major}"))
+ && int.Parse(versionMatch.Result("${minor}")) >= int.Parse(tagMatch.Result("${minor}"))
+ && int.Parse(versionMatch.Result("${patch}") == "" ? "0" : versionMatch.Result("${patch}")) >= int.Parse(tagMatch.Result("${patch}") == "" ? "0" : tagMatch.Result("${patch}")))
+ {
+ MessageBox.Show("You have the latest version");
+ return;
+ }
+ else
+ {
+ MessageBox.Show("There is a new verion available");
+ System.Diagnostics.Process.Start(newestRelease.HtmlUrl);
+ return;
+ }
+ }
+ }
+ }
}
}
diff --git a/RedditRandomNumberGiveawayHelper/MainForm.resx b/RedditRandomNumberGiveawayHelper/MainForm.resx
index 1af7de1..d5494e3 100644
--- a/RedditRandomNumberGiveawayHelper/MainForm.resx
+++ b/RedditRandomNumberGiveawayHelper/MainForm.resx
@@ -117,4 +117,7 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 17, 17
+
\ No newline at end of file
diff --git a/RedditRandomNumberGiveawayHelper/Properties/Settings.Designer.cs b/RedditRandomNumberGiveawayHelper/Properties/Settings.Designer.cs
index f9ad36f..a031dcf 100644
--- a/RedditRandomNumberGiveawayHelper/Properties/Settings.Designer.cs
+++ b/RedditRandomNumberGiveawayHelper/Properties/Settings.Designer.cs
@@ -1,30 +1,35 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.34209
+// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------
-namespace RedditRandomNumberGiveawayHelper.Properties
-{
-
-
+namespace RedditRandomNumberGiveawayHelper.Properties {
+
+
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
- {
-
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default
- {
- get
- {
+
+ public static Settings Default {
+ get {
return defaultInstance;
}
}
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("V0.2.0")]
+ public string Version {
+ get {
+ return ((string)(this["Version"]));
+ }
+ }
}
}
diff --git a/RedditRandomNumberGiveawayHelper/Properties/Settings.settings b/RedditRandomNumberGiveawayHelper/Properties/Settings.settings
index 3964565..3688d9a 100644
--- a/RedditRandomNumberGiveawayHelper/Properties/Settings.settings
+++ b/RedditRandomNumberGiveawayHelper/Properties/Settings.settings
@@ -1,7 +1,9 @@
-
-
-
-
-
-
+
+
+
+
+ V0.2.0
+
+
+
\ No newline at end of file
diff --git a/RedditRandomNumberGiveawayHelper/RedditRandomNumberGiveawayHelper.csproj b/RedditRandomNumberGiveawayHelper/RedditRandomNumberGiveawayHelper.csproj
index 9f14623..dd8de7a 100644
--- a/RedditRandomNumberGiveawayHelper/RedditRandomNumberGiveawayHelper.csproj
+++ b/RedditRandomNumberGiveawayHelper/RedditRandomNumberGiveawayHelper.csproj
@@ -34,6 +34,10 @@
4
+
+ ..\packages\Octokit.0.14.0\lib\net45\Octokit.dll
+ True
+
@@ -109,8 +113,7 @@
-
- f.ItemSpec).Where(f => !excludedAssemblie
foreach (var item in filesToCleanup)
File.Delete(item);
-]]>
-
+]]>
+
diff --git a/RedditRandomNumberGiveawayHelper/Settings.cs b/RedditRandomNumberGiveawayHelper/Settings.cs
new file mode 100644
index 0000000..ab1ed38
--- /dev/null
+++ b/RedditRandomNumberGiveawayHelper/Settings.cs
@@ -0,0 +1,28 @@
+namespace RedditRandomNumberGiveawayHelper.Properties {
+
+
+ // This class allows you to handle specific events on the settings class:
+ // The SettingChanging event is raised before a setting's value is changed.
+ // The PropertyChanged event is raised after a setting's value is changed.
+ // The SettingsLoaded event is raised after the setting values are loaded.
+ // The SettingsSaving event is raised before the setting values are saved.
+ internal sealed partial class Settings {
+
+ public Settings() {
+ // // To add event handlers for saving and changing settings, uncomment the lines below:
+ //
+ // this.SettingChanging += this.SettingChangingEventHandler;
+ //
+ // this.SettingsSaving += this.SettingsSavingEventHandler;
+ //
+ }
+
+ private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
+ // Add code to handle the SettingChangingEvent event here.
+ }
+
+ private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
+ // Add code to handle the SettingsSaving event here.
+ }
+ }
+}
diff --git a/RedditRandomNumberGiveawayHelper/packages.config b/RedditRandomNumberGiveawayHelper/packages.config
index 79fc02e..fc8bbdf 100644
--- a/RedditRandomNumberGiveawayHelper/packages.config
+++ b/RedditRandomNumberGiveawayHelper/packages.config
@@ -2,4 +2,5 @@
+
\ No newline at end of file