Some experimental stuff

This commit is contained in:
Serraniel 2017-03-08 18:30:57 +01:00
parent a1b880836f
commit 4a1ec5853b
8 changed files with 57 additions and 2 deletions

View file

@ -57,6 +57,10 @@
<HintPath>..\packages\Nito.AsyncEx.3.0.1\lib\net45\Nito.AsyncEx.Enlightenment.dll</HintPath> <HintPath>..\packages\Nito.AsyncEx.3.0.1\lib\net45\Nito.AsyncEx.Enlightenment.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Octokit, Version=0.24.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Octokit.0.24.1-alpha0001\lib\net45\Octokit.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.105.2.3\lib\net46\RestSharp.dll</HintPath> <HintPath>..\packages\RestSharp.105.2.3\lib\net46\RestSharp.dll</HintPath>
<Private>True</Private> <Private>True</Private>
@ -78,6 +82,7 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Helper\VersionHelper.cs" />
<Compile Include="LoginForm.cs"> <Compile Include="LoginForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>

View file

@ -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<Version> 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;
}
}
}

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using Discord_Media_Loader.Helper;
namespace Discord_Media_Loader namespace Discord_Media_Loader
{ {

View file

@ -49,6 +49,7 @@
this.lbGithub = new System.Windows.Forms.LinkLabel(); this.lbGithub = new System.Windows.Forms.LinkLabel();
this.lbAbout = new System.Windows.Forms.LinkLabel(); this.lbAbout = new System.Windows.Forms.LinkLabel();
this.lbVersion = new System.Windows.Forms.Label(); this.lbVersion = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.nupThreadCount)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nupThreadCount)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -246,11 +247,22 @@
this.lbVersion.Text = "version"; this.lbVersion.Text = "version";
this.lbVersion.TextAlign = System.Drawing.ContentAlignment.TopRight; 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 // MainForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(439, 296); this.ClientSize = new System.Drawing.Size(439, 296);
this.Controls.Add(this.button1);
this.Controls.Add(this.lbVersion); this.Controls.Add(this.lbVersion);
this.Controls.Add(this.lbAbout); this.Controls.Add(this.lbAbout);
this.Controls.Add(this.lbGithub); this.Controls.Add(this.lbGithub);
@ -306,5 +318,6 @@
private System.Windows.Forms.LinkLabel lbGithub; private System.Windows.Forms.LinkLabel lbGithub;
private System.Windows.Forms.LinkLabel lbAbout; private System.Windows.Forms.LinkLabel lbAbout;
private System.Windows.Forms.Label lbVersion; private System.Windows.Forms.Label lbVersion;
private System.Windows.Forms.Button button1;
} }
} }

View file

@ -9,6 +9,7 @@ using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using Discord; using Discord;
using Discord.Net; using Discord.Net;
using Discord_Media_Loader.Helper;
using ConnectionState = Discord.ConnectionState; using ConnectionState = Discord.ConnectionState;
namespace Discord_Media_Loader namespace Discord_Media_Loader
@ -287,6 +288,11 @@ namespace Discord_Media_Loader
{ {
MessageBox.Show(Properties.Resources.AboutString); MessageBox.Show(Properties.Resources.AboutString);
} }
private async void button1_Click(object sender, EventArgs e)
{
await VersionHelper.GetLatestReleaseVersion("Serraniel", "DiscordMediaLoader");
}
} }
internal class UpdateProgessEventArgs : EventArgs internal class UpdateProgessEventArgs : EventArgs

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using Discord_Media_Loader.Helper;
namespace Discord_Media_Loader namespace Discord_Media_Loader
{ {
@ -11,6 +12,7 @@ namespace Discord_Media_Loader
[STAThread] [STAThread]
static void Main() static void Main()
{ {
var v = VersionHelper.GetLatestReleaseVersion("Serraniel", "DiscordMediaLoader");
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm()); Application.Run(new MainForm());

View file

@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben: // übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.1.58")] [assembly: AssemblyVersion("0.1.1.78")]
[assembly: AssemblyFileVersion("0.1.1.58")] [assembly: AssemblyFileVersion("0.1.1.78")]

View file

@ -3,6 +3,7 @@
<package id="Discord.Net" version="0.9.6" targetFramework="net461" /> <package id="Discord.Net" version="0.9.6" targetFramework="net461" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net461" /> <package id="Newtonsoft.Json" version="8.0.3" targetFramework="net461" />
<package id="Nito.AsyncEx" version="3.0.1" targetFramework="net461" /> <package id="Nito.AsyncEx" version="3.0.1" targetFramework="net461" />
<package id="Octokit" version="0.24.1-alpha0001" targetFramework="net46" />
<package id="RestSharp" version="105.2.3" targetFramework="net461" /> <package id="RestSharp" version="105.2.3" targetFramework="net461" />
<package id="WebSocket4Net" version="0.14.1" targetFramework="net461" /> <package id="WebSocket4Net" version="0.14.1" targetFramework="net461" />
</packages> </packages>