Fix for automatic update. Versionhelper has loaded the application dll :/

This commit is contained in:
Serraniel 2017-12-16 16:04:01 +01:00
parent 219f4601cd
commit 3bbe5e72c5
3 changed files with 18 additions and 6 deletions

View file

@ -52,6 +52,7 @@ namespace Discord_Media_Loader
} }
File.Delete(tmpFile); File.Delete(tmpFile);
DialogResult = DialogResult.Cancel;
} }
} }
finally finally
@ -59,7 +60,7 @@ namespace Discord_Media_Loader
UseWaitCursor = false; UseWaitCursor = false;
} }
Close(); DialogResult = DialogResult.OK;
} }
} }
} }

View file

@ -13,7 +13,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()
{ {

View file

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Runtime; using System.Runtime;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
@ -20,10 +21,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");
} }
} }
} }