Ejemplo n.º 1
0
        private static void AddYesNoConfig()
        {
            var yesNoConfig = new SetupConfig
                {
                    Key = "YesNo",
                    AllowNone = false,
                    ConfigType = ConfigTypes.Value,
                    Help = "Answer Yes or No",
                    Default = "0"
                };

            yesNoConfig.SetupChoices.Add(new SetupAvailable
                {
                    Value = "false",
                    Help = null,
                    IsNull = false
                });

            yesNoConfig.SetupChoices.Add(new SetupAvailable
            {
                Value = "true",
                Help = null,
                IsNull = false
            });

            if (!_setupFile.SetupConfigs.ContainsKey(yesNoConfig.Key))
            {
                _setupFile.SetupConfigs.Add(yesNoConfig.Key, yesNoConfig);
            }
        }
Ejemplo n.º 2
0
 private static void AddEmptyChoice(SetupConfig setupConfig)
 {
     if (setupConfig.AllowNone)
     {
         var availableConfig = new SetupAvailable
         {
             Value = "None",
             Help = "None of the above",
             IsNull = true
         };
         setupConfig.SetupChoices.Add(availableConfig);
     }
 }
Ejemplo n.º 3
0
        private static void ExtractConfigs(XmlNode rootConfig)
        {
            var configs = rootConfig.GetChildrenByTag("config");
            for (int i = 0; i < configs.Count; i++)
            {
                var config = configs[i];
                ConfigTypes configType;
                if (!ConfigTypes.TryParse(config.GetAttribute("type"), true, out configType))
                {
                    configType = ConfigTypes.Value;
                }

                var setupConfig = new SetupConfig
                {
                    Key = config.GetAttribute("key"),
                    AllowNone = config.GetAttributeBool("allownone"),
                    ConfigType = configType,
                    Help = config.GetAttribute("help"),
                    Default = config.GetAttribute("default")
                };
                ExtractAvailableConfigs(config, setupConfig);
                _setupFile.SetupConfigs.Add(setupConfig.Key, setupConfig);
            }

            AddYesNoConfig();
        }
Ejemplo n.º 4
0
        private static void ExtractAvailableConfigs(XmlNode config, SetupConfig setupConfig)
        {
            var availables = config.GetChildrenByTag("available");
            for (int i = 0; i < availables.Count; i++)
            {
                var available = availables[i];

                var availableConfig = new SetupAvailable
                {
                    Value = available.GetAttribute("value"),
                    Help = available.GetAttribute("help"),
                    IsNull = false
                };

                ExtractWrokflow(available, availableConfig);
                setupConfig.SetupChoices.Add(availableConfig);
            }
            AddEmptyChoice(setupConfig);
        }