public async Task SetModuleState(string name, bool active) { if (!_data.Configuration.ModuleConfigurations.TryAdd(name, active)) { _data.Configuration.ModuleConfigurations[name] = active; } Type target = GetModuleTypeByName(name); if (active) { await _commands.AddModuleAsync(target, _services); } else { await _commands.RemoveModuleAsync(target); } _data.SaveConfiguration(); }
public void Save() => _data.SaveConfiguration();