Fix Release build

This commit is contained in:
CreepyCrafter24 2020-02-28 14:31:52 +01:00
parent fea9f80001
commit 44bf5ff322
2 changed files with 10 additions and 7 deletions

View File

@ -51,7 +51,7 @@ namespace UpTool2
} }
catch (Exception e1) catch (Exception e1)
{ {
if (!GlobalVariables.relE) if (!GlobalVariables.RelE)
throw; throw;
MessageBox.Show(e1.ToString(), "Install failed"); MessageBox.Show(e1.ToString(), "Install failed");
} }
@ -104,7 +104,7 @@ namespace UpTool2
} }
catch (Exception e1) catch (Exception e1)
{ {
if (!GlobalVariables.relE) if (!GlobalVariables.RelE)
throw; throw;
MessageBox.Show(e1.ToString(), "Install failed"); MessageBox.Show(e1.ToString(), "Install failed");
} }

View File

@ -15,6 +15,9 @@ using System.Windows.Forms;
using System.Xml; using System.Xml;
using System.Xml.Linq; using System.Xml.Linq;
using UpTool2.Tool; using UpTool2.Tool;
#if !DEBUG
using Shortcut = UpTool2.Tool.Shortcut;
#endif
namespace UpTool2 namespace UpTool2
{ {
@ -63,9 +66,9 @@ namespace UpTool2
Online = Ping(metaXml); Online = Ping(metaXml);
#if !DEBUG #if !DEBUG
if (Application.ExecutablePath != PathTool.GetProgPath("Install", "UpTool2.exe")) if (Application.ExecutablePath != PathTool.GetRelative("Install", "UpTool2.exe"))
{ {
if ((!online)) if (!Online)
throw new WebException("Could fetch Metadata (are you online?)"); throw new WebException("Could fetch Metadata (are you online?)");
if (MessageBox.Show(@"Thank you for downloading UpTool2. if (MessageBox.Show(@"Thank you for downloading UpTool2.
To prevent inconsistent behavior you will need to install this before running. To prevent inconsistent behavior you will need to install this before running.
@ -73,13 +76,13 @@ Files will be placed in %appdata%\UpTool2 and %appdata%\Microsoft\Windows\Start
Do you want to continue?", "UpTool2", MessageBoxButtons.YesNo) != DialogResult.Yes) Do you want to continue?", "UpTool2", MessageBoxButtons.YesNo) != DialogResult.Yes)
throw new Exception("Exiting..."); throw new Exception("Exiting...");
MessageBox.Show("Installing an Update. Please restart from your start menu!"); MessageBox.Show("Installing an Update. Please restart from your start menu!");
installUpdate(XDocument.Load(metaXML).Element("meta")); InstallUpdate(XDocument.Load(metaXml).Element("meta"));
Shortcut.Make(PathTool.GetProgPath("Install", "UpTool2.exe"), Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Programs), "UpTool2.lnk")); Shortcut.Make(PathTool.GetRelative("Install", "UpTool2.exe"), Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Programs), "UpTool2.lnk"));
mutex.ReleaseMutex(); mutex.ReleaseMutex();
Environment.Exit(0); Environment.Exit(0);
} }
if (!File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Programs), "UpTool2.lnk"))) if (!File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Programs), "UpTool2.lnk")))
Shortcut.Make(PathTool.GetProgPath("Install", "UpTool2.exe"), Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Programs), "UpTool2.lnk")); Shortcut.Make(PathTool.GetRelative("Install", "UpTool2.exe"), Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Programs), "UpTool2.lnk"));
#endif #endif
if (!Directory.Exists(PathTool.GetRelative("Apps"))) if (!Directory.Exists(PathTool.GetRelative("Apps")))
Directory.CreateDirectory(PathTool.GetRelative("Apps")); Directory.CreateDirectory(PathTool.GetRelative("Apps"));