diff --git a/Discord Media Loader/Discord Media Loader.csproj b/Discord Media Loader/Discord Media Loader.csproj
index 3edf1f2..baf4c0f 100644
--- a/Discord Media Loader/Discord Media Loader.csproj
+++ b/Discord Media Loader/Discord Media Loader.csproj
@@ -57,6 +57,10 @@
..\packages\Nito.AsyncEx.3.0.1\lib\net45\Nito.AsyncEx.Enlightenment.dll
True
+
+ ..\packages\Octokit.0.24.1-alpha0001\lib\net45\Octokit.dll
+ True
+
..\packages\RestSharp.105.2.3\lib\net46\RestSharp.dll
True
@@ -78,6 +82,7 @@
+
Form
diff --git a/Discord Media Loader/Helper/VersionHelper.cs b/Discord Media Loader/Helper/VersionHelper.cs
new file mode 100644
index 0000000..2edd7de
--- /dev/null
+++ b/Discord Media Loader/Helper/VersionHelper.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using Newtonsoft.Json.Linq;
+using Octokit;
+
+namespace Discord_Media_Loader.Helper
+{
+ internal class VersionHelper
+ {
+ internal static Version CurrentVersion => Assembly.GetExecutingAssembly().GetName().Version;
+
+ internal static async Task GetLatestReleaseVersion(string owner, string repository)
+ {
+ var github = new GitHubClient(new ProductHeaderValue("DiscordMediaLoader"));
+ var tag =
+ (await github.Repository.Release.GetAll("Serraniel", "DiscordMediaLoader")).OrderBy(x => x.CreatedAt).First().TagName.Replace("v", "") ?? "";
+ var version = new Version(tag);
+ return version;
+ }
+ }
+}
diff --git a/Discord Media Loader/LoginForm.cs b/Discord Media Loader/LoginForm.cs
index 2286fe2..cf6f81e 100644
--- a/Discord Media Loader/LoginForm.cs
+++ b/Discord Media Loader/LoginForm.cs
@@ -1,5 +1,6 @@
using System;
using System.Windows.Forms;
+using Discord_Media_Loader.Helper;
namespace Discord_Media_Loader
{
diff --git a/Discord Media Loader/MainForm.Designer.cs b/Discord Media Loader/MainForm.Designer.cs
index 879ad82..d95e7f9 100644
--- a/Discord Media Loader/MainForm.Designer.cs
+++ b/Discord Media Loader/MainForm.Designer.cs
@@ -49,6 +49,7 @@
this.lbGithub = new System.Windows.Forms.LinkLabel();
this.lbAbout = new System.Windows.Forms.LinkLabel();
this.lbVersion = new System.Windows.Forms.Label();
+ this.button1 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.nupThreadCount)).BeginInit();
this.SuspendLayout();
//
@@ -246,11 +247,22 @@
this.lbVersion.Text = "version";
this.lbVersion.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
+ // button1
+ //
+ this.button1.Location = new System.Drawing.Point(294, 256);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(75, 23);
+ this.button1.TabIndex = 26;
+ this.button1.Text = "button1";
+ this.button1.UseVisualStyleBackColor = true;
+ this.button1.Click += new System.EventHandler(this.button1_Click);
+ //
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(439, 296);
+ this.Controls.Add(this.button1);
this.Controls.Add(this.lbVersion);
this.Controls.Add(this.lbAbout);
this.Controls.Add(this.lbGithub);
@@ -306,5 +318,6 @@
private System.Windows.Forms.LinkLabel lbGithub;
private System.Windows.Forms.LinkLabel lbAbout;
private System.Windows.Forms.Label lbVersion;
+ private System.Windows.Forms.Button button1;
}
}
\ No newline at end of file
diff --git a/Discord Media Loader/MainForm.cs b/Discord Media Loader/MainForm.cs
index 957aa1e..2f2bf0a 100644
--- a/Discord Media Loader/MainForm.cs
+++ b/Discord Media Loader/MainForm.cs
@@ -9,6 +9,7 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using Discord;
using Discord.Net;
+using Discord_Media_Loader.Helper;
using ConnectionState = Discord.ConnectionState;
namespace Discord_Media_Loader
@@ -287,6 +288,11 @@ namespace Discord_Media_Loader
{
MessageBox.Show(Properties.Resources.AboutString);
}
+
+ private async void button1_Click(object sender, EventArgs e)
+ {
+ await VersionHelper.GetLatestReleaseVersion("Serraniel", "DiscordMediaLoader");
+ }
}
internal class UpdateProgessEventArgs : EventArgs
diff --git a/Discord Media Loader/Program.cs b/Discord Media Loader/Program.cs
index 837140a..d1db98e 100644
--- a/Discord Media Loader/Program.cs
+++ b/Discord Media Loader/Program.cs
@@ -1,5 +1,6 @@
using System;
using System.Windows.Forms;
+using Discord_Media_Loader.Helper;
namespace Discord_Media_Loader
{
@@ -11,6 +12,7 @@ namespace Discord_Media_Loader
[STAThread]
static void Main()
{
+ var v = VersionHelper.GetLatestReleaseVersion("Serraniel", "DiscordMediaLoader");
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
diff --git a/Discord Media Loader/Properties/AssemblyInfo.cs b/Discord Media Loader/Properties/AssemblyInfo.cs
index 05ce28e..72ed5ee 100644
--- a/Discord Media Loader/Properties/AssemblyInfo.cs
+++ b/Discord Media Loader/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.1.1.58")]
-[assembly: AssemblyFileVersion("0.1.1.58")]
+[assembly: AssemblyVersion("0.1.1.78")]
+[assembly: AssemblyFileVersion("0.1.1.78")]
diff --git a/Discord Media Loader/packages.config b/Discord Media Loader/packages.config
index 0becf02..6f2b978 100644
--- a/Discord Media Loader/packages.config
+++ b/Discord Media Loader/packages.config
@@ -3,6 +3,7 @@
+
\ No newline at end of file