private static async Task Version22Upgrade(int version, string filePath) { if (version < 22) { DesktopChannelSettings settings = await SerializerHelper.DeserializeFromFile <DesktopChannelSettings>(filePath); await ChannelSession.Services.Settings.Initialize(settings); PreMadeChatCommandSettings cSetting = settings.PreMadeChatCommandSettings.FirstOrDefault(c => c.Name.Equals("Ban")); if (cSetting != null) { cSetting.IsEnabled = false; } List <CommandBase> commands = new List <CommandBase>(); commands.AddRange(settings.ChatCommands); commands.AddRange(settings.EventCommands); commands.AddRange(settings.InteractiveCommands); commands.AddRange(settings.TimerCommands); commands.AddRange(settings.ActionGroupCommands); commands.AddRange(settings.GameCommands); foreach (CommandBase command in commands) { StoreCommandUpgrader.ChangeCounterActionsToUseSpecialIdentifiers(command.Actions); } await ChannelSession.Services.Settings.Save(settings); } }
public void Initialize(LoadingWindowBase window, PreMadeChatCommand command) { this.window = window; this.DataContext = this.command = command; this.PermissionsComboBox.SelectedItem = this.command.PermissionsString; this.setting = ChannelSession.Settings.PreMadeChatCommandSettings.FirstOrDefault(c => c.Name.Equals(this.command.Name)); if (this.setting == null) { this.setting = new PreMadeChatCommandSettings(this.command); ChannelSession.Settings.PreMadeChatCommandSettings.Add(this.setting); } }
public void Initialize(LoadingWindowBase window, PreMadeChatCommand command) { this.window = window; this.DataContext = this.command = command; this.PermissionsComboBox.SelectedItem = this.command.UserRoleRequirementString; this.CooldownTextBox.Text = this.command.Requirements.Cooldown.Amount.ToString(); this.setting = ChannelSession.Settings.PreMadeChatCommandSettings.FirstOrDefault(c => c.Name.Equals(this.command.Name)); if (this.setting == null) { this.setting = new PreMadeChatCommandSettings(this.command); ChannelSession.Settings.PreMadeChatCommandSettings.Add(this.setting); } }
public PreMadeChatCommandControlViewModel(PreMadeChatCommand command) { this.command = command; this.setting = ChannelSession.Settings.PreMadeChatCommandSettings.FirstOrDefault(c => c.Name.Equals(this.command.Name)); if (this.setting == null) { this.setting = new PreMadeChatCommandSettings(this.command); ChannelSession.Settings.PreMadeChatCommandSettings.Add(this.setting); } this.TestCommand = this.CreateCommand(async(parameter) => { UserViewModel currentUser = await ChannelSession.GetCurrentUser(); await command.Perform(currentUser, new List <string>() { "@" + currentUser.UserName }); }); }