Common.StartupArgs.Parse C# (CSharp) Method

Parse() public method

public Parse ( string args ) : bool
args string
return bool
        public bool Parse(string[] args)
        {
            if (args == null)
                return false;

            // validate first arg as key symbol
            if (useKey)
            {
                if (args.Length == 0 || args[0] == null)
                    return false;

                var firstArg = args[0].ToLower().TrimStart(keyPrefixes);
                if (firstArg[0] != Key)
                    return false;
            }

            // validate min rest args count
            var restArgs = args.Skip(useKey ? 1 : 0).Take((int)MinOptionsCount).ToArray();
            if (useMinOptionsCount)
            {
                if (restArgs.Length < MinOptionsCount || restArgs.Any(a => a == null))
                    return false;
            }

            // call child class parsing logic
            return InnerParse(restArgs);
        }