Ejemplo n.º 1
0
        public void ParsePositionalOption_WithDefaultInputArguments_ReturnsMultipleStrings()
        {
            // arrange
            string inputArgument1 = "input";
            string inputArgument2 = "input2";
            Func <string, string, string, IParsingResult <Tuple <string, string, string> > > parse = (value1, value2, value3) => ParsingResult <Tuple <string, string, string> > .SuccessfulResult(Tuple.Create(value1, value2, value3));

            var option1           = StringOption.CreateRequired("value1 option", "value1");
            var option2           = StringOption.CreateRequired("value2 option", "value2");
            var option3           = StringOption.Create("value3 option", "value2");
            var multiStringOption = new PositionalOption <string, string, string, Tuple <string, string, string> >(parse, true, true, "", option1, option2, option3, "positional-option");

            string[] stringInputArgument =
            {
                "--positional-option", inputArgument1, inputArgument2
            };

            // act
            var result = multiStringOption.Parse(stringInputArgument);

            // assert
            Assert.True(result.Success);
            Assert.Equal(inputArgument1, result.Result[0].Item1);
            Assert.Equal(inputArgument2, result.Result[0].Item2);
            Assert.Null(result.Result[0].Item3);
        }
Ejemplo n.º 2
0
        public void ParseSinglePositionalOption_WithMultipleStringInputArgumentsAndMultipleValues_ReturnsFailedResult()
        {
            // arrange
            string inputArgument1  = "input";
            string inputArgument2  = "input2";
            string inputArgument3  = "input3";
            string inputArgumentB1 = "inputB";
            string inputArgumentB2 = "inputB2";
            string inputArgumentB3 = "inputB3";
            Func <string, string, string, IParsingResult <Tuple <string, string, string> > > parse = (value1, value2, value3) => ParsingResult <Tuple <string, string, string> > .SuccessfulResult(Tuple.Create(value1, value2, value3));

            var option1           = StringOption.CreateRequired("value1 option", "value1");
            var option2           = StringOption.CreateRequired("value2 option", "value2");
            var option3           = StringOption.CreateRequired("value3 option", "value2");
            var multiStringOption = new SinglePositionalOption <string, string, string, Tuple <string, string, string> >(parse, true, "", option1, option2, option3, "positional-option");

            string[] stringInputArgument =
            {
                "--positional-option", inputArgument1,  inputArgument2,  inputArgument3,
                "--positional-option", inputArgumentB1, inputArgumentB2, inputArgumentB3
            };

            // act
            var result = multiStringOption.Parse(stringInputArgument);

            // assert
            Assert.False(result.Success);
            Assert.Contains("only once", result.ErrorMessage);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the Options class with the specified command
        /// line arguments.
        /// </summary>
        /// <param name="args">The arguments passed on the command line.</param>
        public Options(string[] args)
        {
            // Initialize the options
            _StartDateOption = new DateOption("s", "startdate");
            _BuildOption     = new StringOption("b", "build", "Fixed");
            _PinOption       = new StringOption("p", "pin", "0.0.0.0");
            _RevisionOption  = new StringOption("r", "revision", "Automatic");
            _InputFile       = new StringOption("i", "inputfile");
            _OutputFile      = new StringOption("o", "outputfile");
            _Input           = new StringOption("in", "input");
            _VersionOption   = new StringOption("v", "version");

            // Create a new command line parser and add our options
            CmdLineParser parser = new CmdLineParser();

            parser.AddOption(_StartDateOption);
            parser.AddOption(_BuildOption);
            parser.AddOption(_PinOption);
            parser.AddOption(_RevisionOption);
            parser.AddOption(_InputFile);
            parser.AddOption(_OutputFile);
            parser.AddOption(_VersionOption);

            // Try to parse our options
            try
            {
                parser.Parse(args);
                ValidatePinOption();
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 4
0
        public void ParsePositionalOption_WithTooManyInputArguments_ReturnsFailedResult()
        {
            Func <string, string, string, IParsingResult <Tuple <string, string, string> > > parse = (value1, value2, value3) => ParsingResult <Tuple <string, string, string> > .SuccessfulResult(Tuple.Create(value1, value2, value3));

            var option1           = StringOption.Create("value1 option", "value1");
            var option2           = StringOption.Create("value2 option", "value2");
            var option3           = StringOption.Create("value3 option", "value2");
            var multiStringOption = new PositionalOption <string, string, string, Tuple <string, string, string> >(parse, true, true, "", option1, option2, option3, "positional-option");
            OptionCollection <Tuple <Tuple <string, string, string>, string> > collection = new OptionCollection <Tuple <Tuple <string, string, string>, string> >();

            collection.Add(multiStringOption);
            collection.Add(option1);
            string[] stringInputArgument =
            {
                "--positional-option", "1", "2", "3", "4", "--value1", "value"
            };

            // act
            var result = collection.Parse(stringInputArgument);

            // assert
            IParsingResult <Tuple <Tuple <string, string, string>, string> > failedResult;

            Assert.False(result.Validate(out failedResult));
        }
Ejemplo n.º 5
0
        public static void Postfix(GameOptionsMenu __instance)
        {
            var template = UnityEngine.Object.FindObjectsOfType <StringOption>().FirstOrDefault();

            if (template == null)
            {
                return;
            }

            List <OptionBehaviour> allOptions = __instance.MCAHCPOHNFI.ToList();

            for (int i = 0; i < CustomOption.options.Count; i++)
            {
                CustomOption option = CustomOption.options[i];
                if (option.optionBehaviour == null)
                {
                    StringOption stringOption = UnityEngine.Object.Instantiate(template, template.transform.parent);
                    allOptions.Add(stringOption);

                    stringOption.OnValueChanged = new Action <OptionBehaviour>((o) => {});
                    stringOption.TitleText.text = option.name;
                    stringOption.Value          = stringOption.LCDAKOCANPH = option.selection;
                    stringOption.ValueText.text = option.selections[option.selection].ToString();

                    option.optionBehaviour = stringOption;
                }
                option.optionBehaviour.gameObject.SetActive(true);
            }
            __instance.MCAHCPOHNFI = allOptions.ToArray();
        }
Ejemplo n.º 6
0
        public static void Postfix(GameOptionsMenu __instance)
        {
            var template = UnityEngine.Object.FindObjectsOfType <StringOption>().FirstOrDefault();

            if (template == null)
            {
                return;
            }

            List <OptionBehaviour> allOptions = __instance.IGFJIPMAJHF.ToList();

            for (int i = 0; i < CustomOption.options.Count; i++)
            {
                CustomOption option = CustomOption.options[i];
                if (option.optionBehaviour == null)
                {
                    StringOption stringOption = UnityEngine.Object.Instantiate(template, template.transform.parent);
                    allOptions.Add(stringOption);
                    stringOption.transform.localPosition = new Vector3(template.transform.localPosition.x, -7.85f - (i + 1) * 0.5F, template.transform.localPosition.z);

                    stringOption.OnValueChanged = new Action <OptionBehaviour>((o) => {});
                    stringOption.TitleText.Text = option.name;
                    stringOption.Value          = stringOption.IOFLMCGMJBA = option.selection;
                    stringOption.ValueText.Text = option.selections[option.selection].ToString();

                    option.optionBehaviour = stringOption;
                }
                option.optionBehaviour.gameObject.SetActive(true);
            }
            __instance.IGFJIPMAJHF = allOptions.ToArray();
        }
        private void SwagItemsControl_Add(object sender, RoutedEventArgs e)
        {
            FrameworkElement         fe  = (FrameworkElement)e.OriginalSource;
            ICollection <SwagOption> col = (ICollection <SwagOption>)fe.DataContext;

            SwagOption opt = null;
            String     tag = (fe.Tag ?? "").ToString();

            switch (tag)
            {
            case "GROUP":
                opt = new SwagOptionGroup();
                break;

            case "STRING":
                opt = new StringOption();
                break;

            case "DATE":
                opt = new DateOption();
                break;

            case "BOOL":
                opt = new BooleanOption();
                break;
            }

            col.Add(opt);
            CollectionViewSource.GetDefaultView(col).Refresh();
        }
Ejemplo n.º 8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="value"></param>
        /// <param name="language">Ensure language is installed manually with NAPS GUI or via <see cref="InstallOcr(string)"/></param>
        /// <returns></returns>
        public Naps2ScanJob ToggleOcr(bool value, string language = "eng")
        {
            var disable = new BooleanOption(OcrFlags.OcrDisable);
            // Implies enabled
            var lang = new StringOption(OcrFlags.OcrLang, language);

            Args.Toggle(lang, value);
            Args.Toggle(disable, !value);
            return(this);
        }
Ejemplo n.º 9
0
        private Naps2ScanJob AddStringOption(
            string key,
            string value,
            bool quotes  = true,
            bool enabled = true)
        {
            var option = new StringOption(key, value, quotes);

            return(AddOption(option, enabled));
        }
Ejemplo n.º 10
0
        public static bool Prefix(StringOption __instance)
        {
            CustomOption option = CustomOption.options.FirstOrDefault(option => option.optionBehaviour == __instance);

            if (option == null)
            {
                return(true);
            }
            option.updateSelection(option.selection - 1);
            return(false);
        }
Ejemplo n.º 11
0
        public void Description_RequiredMultiStringOption_ShouldIncludeMultipleOccurrencesAllowedAndRequired()
        {
            // arrange
            var multiStringOption = new MultiValueOption <string>(StringOption.CreateRequired("value option", "value"));

            // act
            var description = multiStringOption.Info.Description;

            // assert
            Assert.Equal("value option. Option can be specified multiple times. (required)", description);
        }
Ejemplo n.º 12
0
            public static bool Prefix(StringOption __instance)
            {
                CustomOption option = CustomOption.AllOptions.FirstOrDefault(option => option.Setting == __instance); // Works but may need to change to gameObject.name check

                if (option is CustomStringOption str)
                {
                    str.Decrease();
                    return(false);
                }

                return(true);
            }
        internal ConnectionOptions()
        {
            odbc                = new BooleanOption();
            host                = new ListOption();
            uid                 = new StringOption();
            pwd                 = new StringOption();
            database            = new StringOption();
            charset             = new StringOption();
            encrypt             = new StringOption();
            persistSecurityInfo = new BooleanOption();
            connectionTimeout   = new IntegerOption();
            connectionLifetime  = new IntegerOption();
            minPoolSize         = new IntegerOption();
            maxPoolSize         = new IntegerOption();
            pooling             = new BooleanOption();
            enlist              = new BooleanOption();
            roundrobin          = new BooleanOption();
            Reset();

            options = CollectionsUtil.CreateCaseInsensitiveHashtable(23);
            options.Add(ODBC, odbc);
            options.Add(HOST, host);
            options.Add(DATASOURCE, host);
            options.Add(SERVER, host);
            options.Add(ADDRESS, host);
            options.Add(NETWORKADDRESS, host);
            options.Add(UID, uid);
            options.Add(USER_ID, uid);
            options.Add(USERID, uid);
            options.Add(PWD, pwd);
            options.Add(PASSWORD, pwd);
            options.Add(DATABASE, database);
            options.Add(INITIALCATALOG, database);
            options.Add(CHARSET, charset);
            options.Add(ENCRYPT, encrypt);
            options.Add(PERSISTSECURITYINFO, persistSecurityInfo);
            options.Add(PERSIST_SECURITY_INFO, persistSecurityInfo);
            options.Add(CONNECTTIMEOUT, connectionTimeout);
            options.Add(CONNECT_TIMEOUT, connectionTimeout);
            options.Add(CONNECTIONTIMEOUT, connectionTimeout);
            options.Add(CONNECTION_TIMEOUT, connectionTimeout);
            options.Add(CONNECTIONLIFETIME, connectionLifetime);
            options.Add(CONNECTION_LIFETIME, connectionLifetime);
            options.Add(MINPOOLSIZE, minPoolSize);
            options.Add(MIN_POOL_SIZE, minPoolSize);
            options.Add(MAXPOOLSIZE, maxPoolSize);
            options.Add(MAX_POOL_SIZE, maxPoolSize);
            options.Add(POOLING, pooling);
            options.Add(ENLIST, enlist);
            options.Add(ROUNDROBIN, roundrobin);
            options.Add(ROUND_ROBIN, roundrobin);
        }
Ejemplo n.º 14
0
            public static bool Prefix(StringOption __instance)
            {
                var option = Options.FirstOrDefault(option => option.GameSetting == __instance);

                if (option is CustomStringOption str)
                {
                    str.Increase();

                    return(false);
                }

                return(true);
            }
Ejemplo n.º 15
0
            public static void Postfix(StringOption __instance)
            {
                var name = __instance.gameObject.name;

                if (name == "JesterOption")
                {
                    if (__instance.oldValue != __instance.Value)
                    {
                        __instance.oldValue = __instance.Value;
                    }
                    __instance.ValueText.Text = ((JesterModes)__instance.Value).ToString();
                }
            }
Ejemplo n.º 16
0
        public DMSEnableOption(string displayName, BoolOption enableOption, StringOption defaultOption) 
        {
            DisplayName = displayName;
            Name = displayName;

            _enableOption = enableOption;
            _enableOption.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(_enableOption_PropertyChanged);

            _defaultOption = defaultOption;
            _defaultOption.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(_defaultOption_PropertyChanged);
            CanBecomeDefault = Value && !IsDefault;

			Deploy = false;
        }
            public static bool Prefix(StringOption __instance)
            {
                CustomOption option = Options.FirstOrDefault(option => option.GameSetting == __instance);

                if (option is CustomStringOption str)
                {
                    str.Increase();

                    //EssentialsPlugin.Logger.LogInfo($"Option \"{str.Name}\" was \"{str.GetText(str.GetOldValue())}\" now \"{str.GetText()}\"");

                    return(false);
                }

                return(true);
            }
Ejemplo n.º 18
0
        public void ParseOptionInfo_WithStringInputArgument_ReturnsStringInputArgument()
        {
            // arrange
            string       inputArgument = "input";
            StringOption valueOption   = StringOption.Create("value option", "value");

            string[] stringInputArgument =
            {
                "--value", inputArgument
            };
            // act
            string parsedResult = valueOption.Parse(stringInputArgument).Result;

            // assert
            Assert.Equal(inputArgument, parsedResult);
        }
Ejemplo n.º 19
0
        public static bool Prefix(StringOption __instance)
        {
            CustomOption option = CustomOption.options.FirstOrDefault(option => option.optionBehaviour == __instance);

            if (option == null)
            {
                return(true);
            }

            __instance.OnValueChanged = new Action <OptionBehaviour>((o) => {});
            __instance.TitleText.text = option.name;
            __instance.Value          = __instance.LCDAKOCANPH = option.selection;
            __instance.ValueText.text = option.selections[option.selection].ToString();

            return(false);
        }
Ejemplo n.º 20
0
        public void ParseOptionInfo_WithMissingInputArgument_ReturnsFailedResult()
        {
            // arrange
            StringOption valueOption = StringOption.Create("value option", "value");

            string[] stringInputArgument =
            {
                "--value"
            };

            // act
            ParsingResult <string> result = valueOption.Parse(stringInputArgument);

            // assert
            Assert.False(result.Success);
            Assert.Contains("required", result.ErrorMessage);
        }
Ejemplo n.º 21
0
        private static void StringPostfix(StringOption __instance, int increment)
        {
            if (__instance.gameObject.name != "JesterOption")
            {
                return;
            }
            __instance.Value = Mathf.Clamp(__instance.Value + increment, 0, __instance.Values.Count - 1);
            JesterMode       = (JesterModes)__instance.Value;

            var localPlayer = PlayerControl.LocalPlayer;

            if (localPlayer == null)
            {
                return;
            }

            localPlayer.RpcSyncSettings(PlayerControl.GameOptions);
        }
Ejemplo n.º 22
0
        public void ParseRequiredPositionalOption_WithNoInputArguments_ReturnsFailedResult()
        {
            Func <string, string, string, IParsingResult <Tuple <string, string, string> > > parse = (value1, value2, value3) => ParsingResult <Tuple <string, string, string> > .SuccessfulResult(Tuple.Create(value1, value2, value3));

            var option1           = StringOption.Create("value1 option", "value1");
            var option2           = StringOption.Create("value2 option", "value2");
            var option3           = StringOption.Create("value3 option", "value2");
            var multiStringOption = new PositionalOption <string, string, string, Tuple <string, string, string> >(parse, true, true, "", option1, option2, option3, "positional-option");

            string[] stringInputArgument =
            {
            };

            // act
            var result = multiStringOption.Parse(stringInputArgument);

            // assert
            Assert.False(result.Success);
        }
Ejemplo n.º 23
0
        public void ParseMultiStringOption_WithMultipleStringInputArguments_ReturnsMultipleStrings()
        {
            // arrange
            string inputArgument1    = "input";
            string inputArgument2    = "input2";
            var    multiStringOption = new MultiValueOption <string>(StringOption.Create("value option", "value"));

            string[] stringInputArgument =
            {
                "--value", inputArgument1, "--value", inputArgument2
            };

            // act
            var result = multiStringOption.Parse(stringInputArgument);

            // assert
            Assert.True(result.Success);
            Assert.Equal(inputArgument1, result.Result[0]);
            Assert.Equal(inputArgument2, result.Result[1]);
        }
Ejemplo n.º 24
0
            public static void Postfix(ref GameOptionsMenu __instance)
            {
                float        lowestY      = __instance.GetComponentsInChildren <OptionBehaviour>().Min(o => o.transform.position.y) - 0.2f;
                ToggleOption togglePrefab = __instance.Children.Where(o => o.TryCast <ToggleOption>() != null).First(o => o.Title != StringNames.GameRecommendedSettings).Cast <ToggleOption>(); // GameRecommendedSettings has a specific design
                NumberOption numberPrefab = __instance.GetComponentInChildren <NumberOption>();
                StringOption stringPrefab = __instance.GetComponentInChildren <StringOption>();
                byte         optionsAdded = 0;

                foreach (var baseOption in
                         OptionsManager.LimitOptions.Values
                         .Concat(OptionsManager.CustomOptions.SelectMany(p => p.Value))
                         )
                {
                    var option = Object.Instantiate <OptionBehaviour>(
                        baseOption switch
                    {
                        CustomToggleOption => togglePrefab,
                        CustomNumberOption => numberPrefab,
                        CustomStringOption => stringPrefab,
                        _ => throw new InvalidCastException($"{nameof(baseOption)} was unknown type")
                    },
 public StringOption(StringOption option, string value) : base(option, value)
 {
 }
Ejemplo n.º 26
0
        private static List <OptionBehaviour> GetGameOptions(float lowestY)
        {
            List <OptionBehaviour> options = new List <OptionBehaviour>();

            /*EssentialsPlugin.Logger.LogInfo($"toggles {Object.FindObjectsOfType<ToggleOption>().Count}");
             * EssentialsPlugin.Logger.LogInfo($"numbers {Object.FindObjectsOfType<NumberOption>().Count}");
             * EssentialsPlugin.Logger.LogInfo($"strings {Object.FindObjectsOfType<StringOption>().Count}");
             * EssentialsPlugin.Logger.LogInfo($"keyvalues {Object.FindObjectsOfType<KeyValueOption>().Count}");*/
            ToggleOption toggleOption = Object.FindObjectsOfType <ToggleOption>().FirstOrDefault();
            NumberOption numberOption = Object.FindObjectsOfType <NumberOption>().FirstOrDefault();
            StringOption stringOption = Object.FindObjectsOfType <StringOption>().FirstOrDefault();
            //KeyValueOption kvOption = Object.FindObjectsOfType<KeyValueOption>().FirstOrDefault();

            int i = 0;

            foreach (CustomOption option in Options)
            {
                if (option.GameSetting != null)
                {
                    option.GameSetting.gameObject.SetActive(option.MenuVisible);

                    options.Add(option.GameSetting);

                    continue;
                }

                if (option.Type == CustomOptionType.Toggle && AmongUsClient.Instance?.AmHost == true)
                {
                    if (toggleOption == null)
                    {
                        continue;
                    }

                    ToggleOption toggle = Object.Instantiate(toggleOption, toggleOption.transform.parent);//.DontDestroy();

                    if (!option.OnGameOptionCreated(toggle))
                    {
                        toggle.Destroy();

                        continue;
                    }

                    options.Add(toggle);

                    if (Debug)
                    {
                        EssentialsPlugin.Logger.LogInfo($"Option \"{option.Name}\" was created");
                    }
                }
                else if (option.Type == CustomOptionType.Number)
                {
                    if (numberOption == null)
                    {
                        continue;
                    }

                    NumberOption number = Object.Instantiate(numberOption, numberOption.transform.parent);//.DontDestroy();

                    if (!option.OnGameOptionCreated(number))
                    {
                        number.Destroy();

                        continue;
                    }

                    options.Add(number);

                    if (Debug)
                    {
                        EssentialsPlugin.Logger.LogInfo($"Option \"{option.Name}\" was created");
                    }
                }
                else if (option.Type == CustomOptionType.String || option.Type == CustomOptionType.Toggle && AmongUsClient.Instance?.AmHost != true)
                {
                    //if (option is IKeyValueOption)
                    //{
                    //    //if (kvOption == null) continue;

                    //    Transform parent = kvOption?.transform?.parent ?? toggleOption?.transform?.parent ?? numberOption?.transform?.parent ?? stringOption?.transform?.parent;

                    //    if (parent == null) continue;

                    //    KeyValueOption kv = kvOption == null ? new KeyValueOption().DontDestroy() : Object.Instantiate(kvOption);

                    //    if (kv == null) continue;

                    //    kv.transform.SetParent(/*kvOption.transform.*/parent);

                    //    option.OnGameOptionCreated(kv);

                    //    options.Add(kv);

                    //    if (Debug)EssentialsPlugin.Logger.LogInfo($"Option \"{option.Name}\" was created");
                    //}

                    if (stringOption == null)
                    {
                        continue;
                    }

                    StringOption str = Object.Instantiate(stringOption, stringOption.transform.parent);//.DontDestroy();

                    if (!option.OnGameOptionCreated(str))
                    {
                        str.Destroy();

                        continue;
                    }

                    options.Add(str);

                    if (Debug)
                    {
                        EssentialsPlugin.Logger.LogInfo($"Option \"{option.Name}\" was created");
                    }
                }

                if (!option.GameSetting)
                {
                    continue;
                }

                if (option.MenuVisible)
                {
                    option.GameSetting.transform.localPosition = new Vector3(option.GameSetting.transform.localPosition.x, lowestY - ++i * 0.5F, option.GameSetting.transform.localPosition.z);
                }

                option.GameSetting.gameObject.SetActive(option.MenuVisible);
            }

            return(options);
        }
Ejemplo n.º 27
0
 public static void Postfix(StringOption __instance)
 {
     StringPostfix(__instance, -1);
 }
Ejemplo n.º 28
0
 public static bool Prefix(StringOption __instance)
 {
     return(__instance.gameObject.name != "JesterOption");
 }
 private static bool Prefix(StringOption __instance)
 {
     return(OnEnable(__instance));
 }
Ejemplo n.º 30
0
 private ConfigurationVariableAttribute(StringOption s)
 {
     string_option = s;
 }
Ejemplo n.º 31
0
		private static IOption CreateShellOptionInternal(Category shellSubCategory, OptionDefType uiOption,
		                                                 string defaultValue)
		{
			IOption shellOption = null;
			string s = !string.IsNullOrEmpty(string.Concat(uiOption.Text)) ? string.Concat(uiOption.Text) : defaultValue;

			if (string.IsNullOrEmpty(s))
			{
				s = string.Empty;
			}

			bool canOverride = uiOption.IsOverrideAllowed;
			switch (uiOption.DataType)
			{
				case OptionDataTypeEnum.Boolean:
					{
						bool val = GetBool(s);
						shellOption = new BoolOption(uiOption.Name, val, val, canOverride)
						              	{
						              		DisplayName = uiOption.DisplayText,
						              		Description = uiOption.DisplayText,
						              		Category = shellSubCategory == null ? null : shellSubCategory.Parent,
						              		SubCategory = shellSubCategory
						              	};
						break;
					}
				case OptionDataTypeEnum.Integer:
					{
						int val = GetInt(s);
						shellOption = new IntegerOption(uiOption.Name, val, val, canOverride)
						              	{
						              		DisplayName = uiOption.DisplayText,
						              		Description = uiOption.DisplayText,
						              		Category = shellSubCategory == null ? null : shellSubCategory.Parent,
						              		SubCategory = shellSubCategory
						              	};
						break;
					}
				case OptionDataTypeEnum.String:
					{
						if (uiOption.Encrypted)
						{
							shellOption = new EncryptionOption(uiOption.Name, s, s, canOverride)
							              	{
							              		DisplayName = uiOption.DisplayText,
							              		Description = uiOption.DisplayText,
							              		Category = shellSubCategory == null ? null : shellSubCategory.Parent,
							              		SubCategory = shellSubCategory
							              	};
						}
						else
						{
							shellOption = new StringOption(uiOption.Name, s, s, canOverride)
							              	{
							              		DisplayName = uiOption.DisplayText,
							              		Description = uiOption.DisplayText,
							              		Category = shellSubCategory == null ? null : shellSubCategory.Parent,
							              		SubCategory = shellSubCategory,
							              		IsPrimaryKey = uiOption.IsPrimaryKey
							              	};
						}
						break;
					}
				case OptionDataTypeEnum.Color:
					{
						var val = GetColor(s);
						shellOption = new ColorOption(uiOption.Name, val, val, canOverride)
						              	{
						              		DisplayName = uiOption.DisplayText,
						              		Description = uiOption.DisplayText,
						              		Category = shellSubCategory == null ? null : shellSubCategory.Parent,
						              		SubCategory = shellSubCategory
						              	};
						break;
					}
				case OptionDataTypeEnum.KeyValueRange:
					{
						int val = GetInt(s);
						shellOption = new EnumOption(uiOption.Name, val, val, canOverride, GetEnumValues(uiOption))
						              	{
						              		DisplayName = uiOption.DisplayText,
						              		Description = uiOption.DisplayText,
						              		Category = shellSubCategory == null ? null : shellSubCategory.Parent,
						              		SubCategory = shellSubCategory
						              	};

						break;
					}
				case OptionDataTypeEnum.Format:
				case OptionDataTypeEnum.Range:
				default:
					{
						// do nothing. these need to be converted
#if DEBUG
						throw new NotImplementedException();
#else
						break;
#endif
					}
			}

			return shellOption;
		}
		internal ConnectionOptions ()
		{
			odbc = new BooleanOption ();
			host = new ListOption ();
			uid = new StringOption ();
			pwd = new StringOption ();
			database = new StringOption ();
			charset = new StringOption ();
			encrypt = new StringOption ();
			persistSecurityInfo = new BooleanOption ();
			connectionTimeout = new IntegerOption ();
			connectionLifetime = new IntegerOption ();
			minPoolSize = new IntegerOption ();
			maxPoolSize = new IntegerOption ();
			pooling = new BooleanOption ();
			enlist = new BooleanOption ();
			roundrobin = new BooleanOption ();
			Reset ();

			options = CollectionsUtil.CreateCaseInsensitiveHashtable (23);
			options.Add (ODBC, odbc);
			options.Add (HOST, host);
			options.Add (DATASOURCE, host);
			options.Add (SERVER, host);
			options.Add (ADDRESS, host);
			options.Add (NETWORKADDRESS, host);
			options.Add (UID, uid);
			options.Add (USER_ID, uid);
			options.Add (USERID, uid);
			options.Add (PWD, pwd);
			options.Add (PASSWORD, pwd);
			options.Add (DATABASE, database);
			options.Add (INITIALCATALOG, database);
			options.Add (CHARSET, charset);
			options.Add (ENCRYPT, encrypt);
			options.Add (PERSISTSECURITYINFO, persistSecurityInfo);
			options.Add (PERSIST_SECURITY_INFO, persistSecurityInfo);
			options.Add (CONNECTTIMEOUT, connectionTimeout);
			options.Add (CONNECT_TIMEOUT, connectionTimeout);
			options.Add (CONNECTIONTIMEOUT, connectionTimeout);
			options.Add (CONNECTION_TIMEOUT, connectionTimeout);
			options.Add (CONNECTIONLIFETIME, connectionLifetime);
			options.Add (CONNECTION_LIFETIME, connectionLifetime);
			options.Add (MINPOOLSIZE, minPoolSize);
			options.Add (MIN_POOL_SIZE, minPoolSize);
			options.Add (MAXPOOLSIZE, maxPoolSize);
			options.Add (MAX_POOL_SIZE, maxPoolSize);
			options.Add (POOLING, pooling);
			options.Add (ENLIST, enlist);
			options.Add (ROUNDROBIN, roundrobin);
			options.Add (ROUND_ROBIN, roundrobin);
		}