Пример #1
0
        public MainForm(StartupArgs startupArgs)
        {
            if (startupArgs == null)
                throw new ArgumentNullException("startupArgs");

            this.startupArgs = startupArgs;

            InitializeComponent();
        }
Пример #2
0
        public static StartupArgs Parse(string[] arguments, StartupArgs[] args,
                                        StartupArgs @default)
        {
            if (@default == null)
            {
                throw new ArgumentNullException("default");
            }

            // return default arg if no successfully parsed arg was found
            return(Parse(arguments, args) ?? @default);
        }
Пример #3
0
        public static StartupArgs Parse(string[] arguments, StartupArgs[] args)
        {
            if (arguments == null)
                throw new ArgumentNullException("arguments");

            if (args == null)
                throw new ArgumentNullException("args");

            // find first successfully parsed arg
            return args.FirstOrDefault(a => a.Parse(arguments));
        }
Пример #4
0
        public static StartupArgs Parse(string[] arguments, StartupArgs[] args, 
            Func<string[], StartupArgs> resolveDefault)
        {
            if (resolveDefault == null)
                throw new ArgumentNullException("resolveDefault");

            // return resolver result if no successfully parsed arg was found
            return Parse(arguments, args) ?? resolveDefault(arguments);
        }
Пример #5
0
        public static StartupArgs Parse(string[] arguments, StartupArgs[] args, 
            StartupArgs @default)
        {
            if (@default == null)
                throw new ArgumentNullException("default");

            // return default arg if no successfully parsed arg was found
            return Parse(arguments, args) ?? @default;
        }