Пример #1
0
        public static ArgumentMap GetArguments(this Parameter.Choice.Option option)
        {
            if (option == null)
            {
                throw new ArgumentNullException("option");
            }

            // To readers: This field was originally _arguments but I decided to expose it in IL.
            return(option.arguments);
        }
        /// <summary>
        /// Construct a new <see cref="WrappedChoiceOption"/> from the given parent <see cref="WrappedChoice"/> and the given option within said choice.
        /// </summary>
        /// <param name="choice"></param>
        /// <param name="option"></param>
        /// <param name="args"></param>
        public WrappedChoiceOption(WrappedChoice choice, Parameter.Choice.Option option, ArgumentMap args = null)
        {
            Name         = option.name;
            ParentChoice = choice;
            BaseOption   = option;
            Arguments    = args ?? option.arguments;
            // _arguments was exposed via an IL edit that I did. This is not possible under normal OOO behavior.
            // I aim to undo this soon as a method is better for the sake of uniformity.

            List <WrappedDirect> newDirects = new List <WrappedDirect>();

            foreach (Parameter.Direct direct in choice.BaseChoice.directs)
            {
                Parameter.Direct newDirect = (Parameter.Direct)direct.clone();                 // Thank god for their DeepObject class.
                newDirects.Add(new WrappedDirect(choice.Config, newDirect, choice, Arguments));
            }
            Directs = newDirects.ToArray();
        }