Example #1
0
        public Addon UpdateAddon(Addon addon)
        {
            _addonRepository.SaveItem(addon);

            AddonUpdated?.Invoke(this, new AddonEventArgs(addon, AddonChangeType.Updated));

            return(addon);
        }
Example #2
0
        public async Task InstallAddon(
            PotentialAddon potentialAddon,
            WowClientType clientType,
            Action <AddonInstallState, decimal> onUpdate = null)
        {
            var provider     = _providers.First(p => p.Name == potentialAddon.ProviderName);
            var searchResult = await provider.GetById(potentialAddon.ExternalId, clientType);

            var existingAddon = _addonRepository.GetByExternalId(searchResult.ExternalId, clientType);

            if (existingAddon != null)
            {
                throw new AddonAlreadyInstalledException();
            }

            var addon = GetAddon(searchResult.Folders.FirstOrDefault(), searchResult, clientType);

            _addonRepository.SaveItem(addon);

            await InstallAddon(addon.Id, onUpdate);
        }