Fixed PostInstaller application.

Added PostInstaller step to installation script.
Settings folder is now removed by the uninstaller.
This commit is contained in:
Lorenz Cuno Klopfenstein 2013-10-23 17:10:41 +02:00
parent 8aa867f41b
commit e1dc6e45c5
2 changed files with 39 additions and 9 deletions

View file

@ -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;
}
}

View file

@ -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