Esempio n. 1
0
        public WrappedDirect(ParameterizedConfig cfg, Parameter.Direct direct, WrappedChoice parentChoice = null, ArgumentMap args = null)
        {
            Config       = cfg;
            BaseDirect   = direct;
            ParentChoice = parentChoice;
            Arguments    = args;

            foreach (string path in direct.paths)
            {
                TraverseDirectPath(path);
            }
        }
        /// <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();
        }