From 4b3d18e6301e9a05aba4960d094836018ae20e6b Mon Sep 17 00:00:00 2001 From: Alessandro Attard Barbini <11708634+aleab@users.noreply.github.com> Date: Fri, 31 Aug 2018 18:53:08 +0200 Subject: [PATCH] Fix issue #92 --- InstallationScript/Install.nsi | 4 ++++ Toastify/src/App.xaml.cs | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/InstallationScript/Install.nsi b/InstallationScript/Install.nsi index c714956..764b9e5 100644 --- a/InstallationScript/Install.nsi +++ b/InstallationScript/Install.nsi @@ -92,6 +92,8 @@ Section "${APPNAME} (required)" File "Toastify.exe" File "Toastify.exe.config" File "Toastify.pdb" + File "Castle.Core.dll" + File "Castle.Windsor.dll" File "GoogleMeasurementProtocol.dll" File "log4net.dll" File "ManagedWinapi.dll" @@ -156,6 +158,8 @@ Section "un.Toastify" Delete "$INSTDIR\Toastify.pdb" Delete "$INSTDIR\ToastifyAPI.dll" Delete "$INSTDIR\ToastifyAPI.pdb" + Delete "$INSTDIR\Castle.Core.dll" + Delete "$INSTDIR\Castle.Windsor.dll" Delete "$INSTDIR\GoogleMeasurementProtocol.dll" Delete "$INSTDIR\log4net.dll" Delete "$INSTDIR\ManagedWinapi.dll" diff --git a/Toastify/src/App.xaml.cs b/Toastify/src/App.xaml.cs index 38c0bf4..cfb24d5 100644 --- a/Toastify/src/App.xaml.cs +++ b/Toastify/src/App.xaml.cs @@ -73,7 +73,14 @@ public static void Main(string[] args) catch (Exception e) { Debug.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss} - {e}\n"); - File.AppendAllText(Path.Combine(App.LocalApplicationData, "log.log"), $@"{DateTime.Now:yyyy-MM-dd HH:mm:ss} - {e}\n"); + try + { + File.AppendAllText(Path.Combine(App.LocalApplicationData, "log.log"), $@"{DateTime.Now:yyyy-MM-dd HH:mm:ss} - {e}{Environment.NewLine}"); + } + catch (Exception ee) + { + MessageBox.Show(ee.ToString(), "FATAL ERROR!", MessageBoxButton.OK, MessageBoxImage.Error); + } } logger.Info($"Architecture: IntPtr = {IntPtr.Size * 8}bit, Is64BitProcess = {Environment.Is64BitProcess}, Is64BitOS = {Environment.Is64BitOperatingSystem}"); @@ -103,11 +110,15 @@ private static void ProcessCommandLineArguments(string[] args) { try { + if (args != null) + File.AppendAllText(Path.Combine(App.LocalApplicationData, "log.log"), $@"{DateTime.Now:yyyy-MM-dd HH:mm:ss} - args: {string.Join(" ", args)}{Environment.NewLine}"); AppArgs = args != null && args.Length > 0 ? Args.Parse(args) : new MainArgs(); } catch (Exception e) { + File.AppendAllText(Path.Combine(App.LocalApplicationData, "log.log"), $@"{DateTime.Now:yyyy-MM-dd HH:mm:ss} - {e.Message}{Environment.NewLine}"); logger.Warn("Invalid command-line arguments. Toastify will ignore them all.", e); + MessageBox.Show("Invalid command-line arguments. Toastify will ignore them all.", "Invalid arguments", MessageBoxButton.OK, MessageBoxImage.Warning); AppArgs = new MainArgs(); }