Пример #1
0
        public void RemoveAddon(string name)
        {
            var addon = _configDb.GetAddonByName(name);

            if (addon == null)
            {
                throw LogAndException("Failed to find the Add-on in the database.");
            }

            _logger.Information("Saving the remove token to disk. The Add-on will be delete after a reboot.");
            try
            {
                using (File.Create(Path.Combine(WellKnownData.ProgramDataPath, addon.Manifest.DestinationFolder,
                                                WellKnownData.AddonDeleteFile)))
                {}
            }
            catch
            {
                _logger.Warning("Unable to create Add-on delete file.");
            }

            // Stop the addon service before undeploying the addon.
            _addonManager().ShutdownAddon(addon);

            // Deleting the addon renders the asset accounts useless since the vault is being
            //  deleted as well.
            _safeguardLogic.DeleteAssetAccounts(null, _configDb.AssetId ?? 0);

            UndeployAddon(addon);
        }