/// <summary> Callback to parse the command line options. </summary>
        public override void Load()
        {
            var args     = CmdLineHelper.FilterArguments(Args);
            var switches = CmdLineHelper.FilterSwitches(Args);

            // with the above we split up all the switches and arguments into separate variables
            // switches - contains anything starting with a / - --
            // args - contains everything else

            Data = SplitLoadFunc(args, switches);
        }
示例#2
0
        /// <summary> Callback to parse the command line options. </summary>
        public override void Load()
        {
            var splitindex = Array.IndexOf(Args, "--");
            var arr1       = Args.Take(splitindex).ToList();
            var arr2       = Args.Skip(splitindex).ToList();

            var args1     = CmdLineHelper.FilterArguments(arr1);
            var switches1 = CmdLineHelper.FilterSwitches(arr1);

            var args2     = CmdLineHelper.FilterArguments(arr2);
            var switches2 = CmdLineHelper.FilterSwitches(arr2);

            // This is the same as the split provider
            // However we split the arguments and switches into two groups
            // seperated by wherever -- shows up on the command line
            // This is often used by apps that launch / act as a proxy for other apps and need to pass options across to them

            Data = DoubleSplitLoadFunc(args1, switches1, args2, switches2);
        }
示例#3
0
        /// <summary> Loads the given options into key value pairs. </summary>
        /// <param name="opts"> The Options to load. </param>
        /// <returns> The options in key / value pairs </returns>
        public static Dictionary <string, string> Load(string[] opts)
        {
            var data = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);

            // Get the arguments / switches
            var args_noswitches = CmdLineHelper.FilterArguments(opts);
            var switches        = CmdLineHelper.FilterSwitches(opts);

            // Make a note of the configuration file path if there is one
            if (switches.ContainsKey("cfgfile"))
            {
                data["cmdline:cfgfile"] = switches["cfgfile"];
            }

            // If --help is asked for
            if (switches.ContainsKey("help"))
            {
                data["cmdline:showhelp"] = "true";
            }



            return(data);
        }