diff --git a/Installer/PostInstaller/PostInstaller/Program.cs b/Installer/PostInstaller/PostInstaller/Program.cs index d6bc03d..82f0010 100644 --- a/Installer/PostInstaller/PostInstaller/Program.cs +++ b/Installer/PostInstaller/PostInstaller/Program.cs @@ -8,7 +8,11 @@ using System.Threading.Tasks; namespace PostInstaller { class Program { static int Main(string[] args) { - return Run(args) ? 0 : 1; + var success = Run(args); + + Console.Read(); + + return success ? 0 : 1; } private static bool Run(string[] args) { @@ -40,22 +44,37 @@ namespace PostInstaller { Console.WriteLine("AppUserModel.ID value: {0} (type {1})", oldValue, oldValue.GetType().AssemblyQualifiedName); } - catch (Exception) { + catch (Exception ex) { #if DEBUG throw; +#else + Console.WriteLine("Unable to get value of AppUserModel.ID property."); + Console.WriteLine(ex); #endif - return false; } - Console.WriteLine("Attempting to set property 'System.AppUserModel.ID' to {0}...", args[1]); - - propStore.SetValue(ref appUserModelKey, new BStrWrapper(args[1])); - propStore.Commit(); + try { + Console.WriteLine("Attempting to set property 'System.AppUserModel.ID' to {0}...", args[1]); - //Store - ((IPersistFile)link).Save(args[0], false); + propStore.SetValue(ref appUserModelKey, new BStrWrapper(args[1])); + propStore.Commit(); + + //Store + ((IPersistFile)link).Save(args[0], false); + } + catch (Exception ex) { +#if DEBUG + throw; +#else + Console.WriteLine("Unable to set value of AppUserModel.ID property."); + Console.WriteLine(ex); + + return false; +#endif + } Console.WriteLine("Done."); + return true; } } diff --git a/Installer/script.nsi b/Installer/script.nsi index 611c9c3..a97f521 100644 --- a/Installer/script.nsi +++ b/Installer/script.nsi @@ -82,6 +82,10 @@ Function RegisterApplication CreateDirectory "${START_LINK_DIR}" CreateShortCut "${START_LINK_RUN}" "$INSTDIR\OnTopReplica.exe" CreateShortCut "${START_LINK_UNINSTALLER}" "$INSTDIR\${UNINSTALLER_NAME}" + + ;Fix link with AppID + ExecWait '"$INSTDIR\PostInstaller.exe" "${START_LINK_RUN}" "LorenzCunoKlopfenstein.OnTopReplica.MainForm"' $0 + DetailPrint "Post installation shortcut fix (returned $0)." FunctionEnd Function un.DeregisterApplication @@ -112,6 +116,10 @@ Section "!OnTopReplica" OnTopReplica File "..\OnTopReplica\bin\Release\CREDITS.txt" File "..\OnTopReplica\bin\Release\LICENSE.txt" + ;Post installer + File "PostInstaller\PostInstaller\bin\Release\PostInstaller.exe" + File "PostInstaller\PostInstaller\bin\Release\PostInstaller.exe.config" + ;Install localization files SetOutPath "$INSTDIR\it" File "..\OnTopReplica\bin\Release\it\OnTopReplica.resources.dll" @@ -135,6 +143,9 @@ Section "Uninstall" ;Remove whole directory (no data is stored there anyway) RMDir /r "$INSTDIR" + ;Remove roaming AppData folder (settings and logs) + RMDir /r "$APPDATA\OnTopReplica" + ;Remove uninstaller Call un.DeregisterApplication SectionEnd