Beispiel #1
0
        /// <summary>
        ///     Sends a BAPSNet message to set an option to one of its choices.
        /// </summary>
        /// <param name="optionKey">The key of the option to set.</param>
        /// <param name="choiceKey">The choice to use.</param>
        /// <param name="index">If present and valid, the index of the option to set.</param>
        public void SetChoice(OptionKey optionKey, string choiceKey, int index = ConfigCache.NoIndex)
        {
            var optionId    = (uint)optionKey;
            var choiceIndex = _cache.ChoiceIndexFor(optionId, choiceKey);
            var cmd         = PossiblyIndexedConfigCommand(ConfigOp.SetConfigValue, index);

            Send(new MessageBuilder(cmd).Add(optionId).Add((uint)ConfigType.Choice).Add((uint)choiceIndex));
        }