Merge branch 'develop'

* develop:
  Cleanup of uses directives
  Fix for automatic update. Versionhelper has loaded the application dll :/
This commit is contained in:
Serraniel 2017-12-16 16:05:51 +01:00
commit 90877b824c
11 changed files with 20 additions and 55 deletions

View file

@ -1,7 +1,4 @@
using System; using System.Threading.Tasks;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Discord; using Discord;
using Discord.WebSocket; using Discord.WebSocket;

View file

@ -6,7 +6,6 @@ using System.Runtime;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using Discord; using Discord;
using Discord.Net;
using Discord.WebSocket; using Discord.WebSocket;
using DML.AppCore.Classes; using DML.AppCore.Classes;
using DML.Application.Dialogs; using DML.Application.Dialogs;

View file

@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Net; using System.Net;

View file

@ -1,5 +1,4 @@
using System.Diagnostics; using SweetLib.Utils.Logger;
using SweetLib.Utils.Logger;
namespace DML.Application.Classes namespace DML.Application.Classes
{ {

View file

@ -1,11 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using DML.Application.Classes; using DML.Application.Classes;
using static SweetLib.Utils.Logger.Logger; using static SweetLib.Utils.Logger.Logger;

View file

@ -1,12 +1,4 @@
using System; using System.Windows.Forms;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DML.Application namespace DML.Application
{ {

View file

@ -2,11 +2,8 @@
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
using System.Windows.Forms; using System.Windows.Forms;
using Discord;
using Discord.WebSocket; using Discord.WebSocket;
using DML.AppCore;
using DML.AppCore.Classes; using DML.AppCore.Classes;
using DML.Application.Classes; using DML.Application.Classes;
using DML.Client; using DML.Client;

View file

@ -1,12 +1,7 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Globalization; using System.Globalization;
using System.Linq;
using System.Net; using System.Net;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;

View file

@ -1,13 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using Discord_Media_Loader.Helper; using Discord_Media_Loader.Helper;
@ -35,7 +28,7 @@ namespace Discord_Media_Loader
downloadManager.ShowDialog(); downloadManager.ShowDialog();
var tmpFolder = Path.GetTempFileName(); var tmpFolder = Path.GetTempFileName();
tmpFolder = Path.Combine(Path.GetFullPath(tmpFolder).Replace(Path.GetFileName(tmpFolder),""), Path.GetFileNameWithoutExtension(tmpFolder)); tmpFolder = Path.Combine(Path.GetFullPath(tmpFolder).Replace(Path.GetFileName(tmpFolder), ""), Path.GetFileNameWithoutExtension(tmpFolder));
var di = Directory.CreateDirectory(tmpFolder); var di = Directory.CreateDirectory(tmpFolder);
@ -52,6 +45,7 @@ namespace Discord_Media_Loader
} }
File.Delete(tmpFile); File.Delete(tmpFile);
DialogResult = DialogResult.Cancel;
} }
} }
finally finally
@ -59,7 +53,7 @@ namespace Discord_Media_Loader
UseWaitCursor = false; UseWaitCursor = false;
} }
Close(); DialogResult = DialogResult.OK;
} }
} }
} }

View file

@ -1,11 +1,7 @@
using System; using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using DML.Application.Classes;
using Octokit; using Octokit;
namespace Discord_Media_Loader.Helper namespace Discord_Media_Loader.Helper
@ -13,7 +9,8 @@ namespace Discord_Media_Loader.Helper
internal class VersionHelper internal class VersionHelper
{ {
internal static Version CurrentVersion => Assembly.GetExecutingAssembly().GetName().Version; internal static Version CurrentVersion => Assembly.GetExecutingAssembly().GetName().Version;
internal static Version AppVersion => typeof(Core).Assembly.GetName().Version;
internal static Version AppVersion => AssemblyName.GetAssemblyName("Discord Media Loader.Application.dll").Version;
internal static async Task<Version> GetReleaseVersion() internal static async Task<Version> GetReleaseVersion()
{ {
@ -35,7 +32,7 @@ namespace Discord_Media_Loader.Helper
{ {
var github = new GitHubClient(new ProductHeaderValue("DiscordMediaLoader")); var github = new GitHubClient(new ProductHeaderValue("DiscordMediaLoader"));
var releaseVersion = (from release in (await github.Repository.Release.GetAll("Serraniel", "DiscordMediaLoader")) where release.TagName == $"v{version.Major}.{version.Minor}.{version.Build}.{version.Revision}" select release).First(); var releaseVersion = (from release in (await github.Repository.Release.GetAll("Serraniel", "DiscordMediaLoader")) where release.TagName == $"v{version.Major}.{version.Minor}.{version.Build}.{version.Revision}" select release).First();
return releaseVersion.Assets.FirstOrDefault()?.BrowserDownloadUrl; return releaseVersion.Assets.FirstOrDefault()?.BrowserDownloadUrl;
} }
} }

View file

@ -1,11 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using Discord_Media_Loader.Helper;
using DML.Application;
using DML.Application.Classes; using DML.Application.Classes;
using Nito.AsyncEx; using Nito.AsyncEx;
@ -20,10 +14,19 @@ namespace Discord_Media_Loader
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
var splashScreen = new FrmSplash(); var splashScreen = new FrmSplash();
splashScreen.ShowDialog(); if (splashScreen.ShowDialog() == DialogResult.OK)
{
DoLaunch(paramStrings);
}
else
{
Application.Restart();
}
}
private static void DoLaunch(string[] paramStrings)
{
AsyncContext.Run(() => Core.Run(paramStrings)); AsyncContext.Run(() => Core.Run(paramStrings));
Console.WriteLine("Ende");
} }
} }
} }