mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-28 09:51:06 -06:00
SDA-2393 Adding/removing registry keys
This commit is contained in:
parent
b66d59d8cb
commit
8c98bd63b5
@ -11,6 +11,7 @@
|
||||
using WixSharp;
|
||||
using WixSharp.Forms;
|
||||
using Microsoft.Deployment.WindowsInstaller;
|
||||
using Microsoft.Win32;
|
||||
|
||||
class Script
|
||||
{
|
||||
@ -107,7 +108,10 @@ class Script
|
||||
// Add a launch condition to require Windows Server 2008 or later
|
||||
// The property values to compare against can be found here:
|
||||
// https://docs.microsoft.com/en-us/windows/win32/msi/operating-system-property-values
|
||||
new LaunchCondition("VersionNT>=600 AND WindowsBuild>=6001", "OS not supported")
|
||||
new LaunchCondition("VersionNT>=600 AND WindowsBuild>=6001", "OS not supported"),
|
||||
|
||||
// Add registry entry used by protocol handler to launch symphony when opening symphony:// URIs
|
||||
new RegValue(WixSharp.RegistryHive.ClassesRoot, productName + @"\shell\open\command", "", "\"[INSTALLDIR]Symphony.exe\" \"%1\"")
|
||||
);
|
||||
|
||||
// The build script which calls the wix# builder, will be run from a command environment which has %SYMVER% set.
|
||||
@ -164,7 +168,14 @@ class Script
|
||||
{
|
||||
// The UpdateConfig action needs the built-in property INSTALLDIR as well as most of the custom properties
|
||||
UsesProperties = "INSTALLDIR,POD_URL,MINIMIZE_ON_CLOSE,ALWAYS_ON_TOP,AUTO_START,BRING_TO_FRONT,MEDIA,LOCATION,NOTIFICATIONS,MIDI_SYSEX,POINTER_LOCK,FULL_SCREEN,OPEN_EXTERNAL,CUSTOM_TITLE_BAR,DEV_TOOLS_ENABLED,AUTO_LAUNCH_PATH"
|
||||
}
|
||||
},
|
||||
|
||||
// CleanRegistry
|
||||
//
|
||||
// We have some registry keys which are added by the SDA application when it is first launched. This custom
|
||||
// action will clean up those keys on uninstall. The name/location of keys have changed between different
|
||||
// versions of SDA, so we clean up all known variations, and ignore any missing ones.
|
||||
new ElevatedManagedAction(CustomActions.CleanRegistry, Return.ignore, When.After, Step.RemoveFiles, Condition.Installed )
|
||||
};
|
||||
|
||||
// Use our own Symphony branded bitmap for installation dialogs
|
||||
@ -177,6 +188,10 @@ class Script
|
||||
.Add(Dialogs.InstallDir)
|
||||
.Add(Dialogs.Progress)
|
||||
.Add<Symphony.ExitDlg>();
|
||||
project.ManagedUI.ModifyDialogs.Add(Dialogs.MaintenanceType)
|
||||
.Add(Dialogs.Progress)
|
||||
.Add<Symphony.ExitDlg>();
|
||||
|
||||
|
||||
|
||||
// Generate an MSI from all settings done above
|
||||
@ -265,4 +280,61 @@ public class CustomActions
|
||||
@"""" + name + @""":""" + value.Trim() + @"""");
|
||||
}
|
||||
|
||||
// CleanRegistry custom action
|
||||
[CustomAction]
|
||||
public static ActionResult CleanRegistry(Session session)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Remove registry keys added for auto-launch
|
||||
|
||||
using( var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true) )
|
||||
{
|
||||
if (key != null)
|
||||
{
|
||||
key.DeleteValue("Symphony", false);
|
||||
key.DeleteValue("com.symphony.electron-desktop", false);
|
||||
key.DeleteValue("electron.app.Symphony", false);
|
||||
}
|
||||
}
|
||||
using( var key = Registry.Users.OpenSubKey(@"\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Run", true) )
|
||||
{
|
||||
if (key != null)
|
||||
{
|
||||
key.DeleteValue("Symphony", false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Remove registry keys added by protocol handlers
|
||||
|
||||
using( var key = Registry.CurrentUser.OpenSubKey(@"Software\Classes", true) )
|
||||
{
|
||||
if (key != null)
|
||||
{
|
||||
key.DeleteSubKeyTree("symphony", false);
|
||||
}
|
||||
}
|
||||
using( var key = Registry.LocalMachine.OpenSubKey(@"Software\Classes", true) )
|
||||
{
|
||||
if (key != null)
|
||||
{
|
||||
key.DeleteSubKeyTree("symphony", false);
|
||||
}
|
||||
}
|
||||
using( var key = Registry.ClassesRoot.OpenSubKey(@"\", true) )
|
||||
{
|
||||
if (key != null)
|
||||
{
|
||||
key.DeleteSubKeyTree("symphony", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
session.Log("Error executing CleanRegistry: " + e.ToString() );
|
||||
return ActionResult.Success;
|
||||
}
|
||||
return ActionResult.Success;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user