Ejemplo n.º 1
0
        internal static void ReadOptions(ElaOptions cls)
        {
            foreach (var k in ConfigurationManager.AppSettings.AllKeys)
            {
                var value = ConfigurationManager.AppSettings[k];

                if (value.Contains(";"))
                {
                    var arr = value.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

                    foreach (var s in arr)
                    {
                        OptionMap <ElaOptions> .SetOption(k, s, cls);
                    }
                }
                else
                {
                    OptionMap <ElaOptions> .SetOption(k, value, cls);
                }
            }
        }
Ejemplo n.º 2
0
        private void ParseOptions(string[] args, int index)
        {
            var opt = String.Empty;

            for (var i = index; i < args.Length; i++)
            {
                var s = args[i];

                if (s[0] != '-')
                {
                    if (opt.Length == 0)
                    {
                        throw new ElaOptionException(String.Empty, ElaOptionError.InvalidFormat);
                    }
                    else
                    {
                        OptionMap <ElaOptions> .SetOption(opt.Substring(1), s, cls);

                        opt = String.Empty;
                    }
                }
                else
                {
                    if (opt.Length != 0)
                    {
                        OptionMap <ElaOptions> .SetOption(opt.Substring(1), null, cls);
                    }

                    opt = s;
                }
            }

            if (opt.Length != 0)
            {
                OptionMap <ElaOptions> .SetOption(opt.Substring(1), null, cls);
            }
        }