private static async Task Version14Upgrade(int version, string filePath)
        {
            if (version < 14)
            {
                string  data     = File.ReadAllText(filePath);
                JObject dataJObj = JObject.Parse(data);
                if (dataJObj.ContainsKey("interactiveCommandsInternal"))
                {
                    JArray interactiveCommands = (JArray)dataJObj["interactiveCommandsInternal"];
                    foreach (JToken interactiveCommand in interactiveCommands)
                    {
                        interactiveCommand["$type"] = "MixItUp.Base.Commands.InteractiveButtonCommand, MixItUp.Base";
                    }
                }
                data = SerializerHelper.SerializeToString(dataJObj);

                DesktopChannelSettings settings = SerializerHelper.DeserializeFromString <DesktopChannelSettings>(data);
                await ChannelSession.Services.Settings.Initialize(settings);

                List <PermissionsCommandBase> permissionCommands = new List <PermissionsCommandBase>();
                permissionCommands.AddRange(settings.ChatCommands);
                permissionCommands.AddRange(settings.GameCommands);
                permissionCommands.AddRange(settings.InteractiveCommands);
                foreach (PermissionsCommandBase command in permissionCommands)
                {
                    command.Requirements.Role.MixerRole = ConvertLegacyRoles(command.Requirements.Role.MixerRole);
                }

                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);
                commands.AddRange(settings.RemoteCommands);
                foreach (CommandBase command in commands)
                {
                    foreach (ActionBase action in command.Actions)
                    {
                        if (action is InteractiveAction)
                        {
                            InteractiveAction iAction = (InteractiveAction)action;
                            iAction.RoleRequirement = ConvertLegacyRoles(iAction.RoleRequirement);
                        }
                    }
                }

                foreach (PreMadeChatCommandSettings preMadeCommandSettings in settings.PreMadeChatCommandSettings)
                {
                    preMadeCommandSettings.Permissions = ConvertLegacyRoles(preMadeCommandSettings.Permissions);
                }

                foreach (InteractiveUserGroupViewModel userGroup in settings.InteractiveUserGroups.Values.SelectMany(ug => ug))
                {
                    userGroup.AssociatedUserRole = ConvertLegacyRoles(userGroup.AssociatedUserRole);
                }

                foreach (GameCommandBase command in settings.GameCommands)
                {
                    if (command is OutcomeGameCommandBase)
                    {
                        OutcomeGameCommandBase outcomeGame = (OutcomeGameCommandBase)command;
                        foreach (GameOutcomeGroup group in outcomeGame.Groups)
                        {
                            group.Role = ConvertLegacyRoles(group.Role);
                        }
                    }
                }

                settings.ModerationFilteredWordsExcempt = ConvertLegacyRoles(settings.ModerationFilteredWordsExcempt);
                settings.ModerationChatTextExcempt      = ConvertLegacyRoles(settings.ModerationChatTextExcempt);
                settings.ModerationBlockLinksExcempt    = ConvertLegacyRoles(settings.ModerationBlockLinksExcempt);

                IEnumerable <InteractiveCommand> oldInteractiveCommand = settings.InteractiveCommands.ToList();
                settings.InteractiveCommands.Clear();
                foreach (InteractiveCommand command in oldInteractiveCommand)
                {
                    settings.InteractiveCommands.Add(new InteractiveButtonCommand()
                    {
                        ID        = command.ID,
                        Name      = command.Name,
                        Type      = command.Type,
                        Commands  = command.Commands,
                        Actions   = command.Actions,
                        IsEnabled = command.IsEnabled,
                        IsBasic   = command.IsBasic,
                        Unlocked  = command.Unlocked,

                        Requirements = command.Requirements,

                        GameID  = command.GameID,
                        SceneID = command.SceneID,
                        Control = command.Control,
                        Trigger = EnumHelper.GetEnumValueFromString <InteractiveButtonCommandTriggerType>(command.CommandsString),
                    });
                }

                await ChannelSession.Services.Settings.Save(settings);
            }
        }
        protected override async Task OnLoaded()
        {
            this.GameLowestRoleAllowedComboBox.ItemsSource   = ChatCommand.PermissionsAllowedValues;
            this.GameLowestRoleAllowedComboBox.SelectedIndex = 0;

            this.CurrencyTypeComboBox.ItemsSource            = ChannelSession.Settings.Currencies.Values;
            this.CurrencyRequirementTypeComboBox.ItemsSource = EnumHelper.GetEnumNames <CurrencyRequirementTypeEnum>();

            this.GameTypeComboBox.ItemsSource = EnumHelper.GetEnumNames <GameTypeEnum>();

            this.AddOutcomeRankGroupButton.IsEnabled = (ChannelSession.Settings.Currencies.Values.Where(c => c.IsRank).Count() > 0);

            this.OutcomeCommandsItemsControl.ItemsSource = this.outcomeCommandControls;
            this.OutcomeGroupsItemsControl.ItemsSource   = this.outcomeGroupControls;

            await this.GameStartedCommandControl.Initialize(this, null);

            await this.GameEndedCommandControl.Initialize(this, null);

            await this.UserJoinedCommandControl.Initialize(this, null);

            await this.NotEnoughUsersCommandControl.Initialize(this, null);

            await this.UserParticipatedCommandControl.Initialize(this, null);

            await this.LoseLeftoverProbabilityCommandControl.Initialize(this, null);

            if (this.command != null)
            {
                this.GameNameTextBox.Text        = this.command.Name;
                this.GameChatCommandTextBox.Text = this.command.CommandsString;

                this.GameCooldownTextBox.Text = this.command.Cooldown.ToString();
                this.GameLowestRoleAllowedComboBox.SelectedItem = EnumHelper.GetEnumName(this.command.Permissions);

                if (this.command is SinglePlayerGameCommand)
                {
                    this.GameTypeComboBox.SelectedItem = EnumHelper.GetEnumName(GameTypeEnum.SinglePlayer);
                }
                else if (this.command is IndividualProbabilityGameCommand)
                {
                    this.GameTypeComboBox.SelectedItem = EnumHelper.GetEnumName(GameTypeEnum.IndividualProbabilty);

                    IndividualProbabilityGameCommand ipCommand = (IndividualProbabilityGameCommand)this.command;

                    this.GameLengthTextBox.Text = ipCommand.GameLength.ToString();
                    this.GameMinimumParticipantsTextBox.Text = ipCommand.MinimumParticipants.ToString();

                    await this.GameStartedCommandControl.Initialize(this, ipCommand.GameStartedCommand);

                    await this.GameEndedCommandControl.Initialize(this, ipCommand.GameEndedCommand);

                    await this.UserJoinedCommandControl.Initialize(this, ipCommand.UserJoinedCommand);

                    await this.NotEnoughUsersCommandControl.Initialize(this, ipCommand.NotEnoughUsersCommand);
                }
                else if (this.command is OnlyOneWinnerGameCommand)
                {
                    this.GameTypeComboBox.SelectedItem = EnumHelper.GetEnumName(GameTypeEnum.OnlyOneWinner);

                    OnlyOneWinnerGameCommand oowCommand = (OnlyOneWinnerGameCommand)this.command;

                    this.GameLengthTextBox.Text = oowCommand.GameLength.ToString();
                    this.GameMinimumParticipantsTextBox.Text = oowCommand.MinimumParticipants.ToString();

                    await this.GameStartedCommandControl.Initialize(this, oowCommand.GameStartedCommand);

                    await this.GameEndedCommandControl.Initialize(this, oowCommand.GameEndedCommand);

                    await this.UserJoinedCommandControl.Initialize(this, oowCommand.UserJoinedCommand);

                    await this.NotEnoughUsersCommandControl.Initialize(this, oowCommand.NotEnoughUsersCommand);
                }
                else if (this.command is UserCharityGameCommand)
                {
                    this.GameTypeComboBox.SelectedItem = EnumHelper.GetEnumName(GameTypeEnum.UserCharity);

                    UserCharityGameCommand rucComand = (UserCharityGameCommand)this.command;

                    this.GiveToRandomUserCharityToggleButton.IsChecked = rucComand.GiveToRandomUser;

                    await this.UserParticipatedCommandControl.Initialize(this, rucComand.UserParticipatedCommand);
                }

                this.CurrencyTypeComboBox.SelectedItem            = this.command.CurrencyRequirement.GetCurrency();
                this.CurrencyRequirementTypeComboBox.SelectedItem = EnumHelper.GetEnumName(this.command.CurrencyRequirementType);
                this.CurrencyMinimumCostTextBox.Text = this.command.CurrencyRequirement.RequiredAmount.ToString();
                this.CurrencyMaximumCostTextBox.Text = this.command.CurrencyRequirement.MaximumAmount.ToString();

                if (this.command is OutcomeGameCommandBase)
                {
                    OutcomeGameCommandBase oCommand = (OutcomeGameCommandBase)this.command;

                    await this.LoseLeftoverProbabilityCommandControl.Initialize(this, oCommand.LoseLeftoverCommand);

                    this.outcomeCommandControls.Clear();
                    foreach (GameOutcome outcome in oCommand.Outcomes)
                    {
                        GameOutcomeCommandControl outcomeControl = new GameOutcomeCommandControl(outcome);
                        await outcomeControl.Initialize(this);

                        this.outcomeCommandControls.Add(outcomeControl);
                    }

                    this.outcomeGroupControls.Clear();
                    foreach (GameOutcomeGroup group in oCommand.Groups)
                    {
                        this.outcomeGroupControls.Add(new GameOutcomeGroupControl(group));
                    }
                }
            }
            else
            {
                this.GameCooldownTextBox.Text = "0";
            }
        }