Example #1
0
        public IProgramArgs Parse(string[] args)
        {
            var argsMtbl = new ProgramArgsMtbl();

            Parse(args, argsMtbl);

            var argsImmtbl = new ProgramArgsImmtbl(argsMtbl);

            return(argsImmtbl);
        }
Example #2
0
        private void SetIsSingleInstance(
            ProgramArgsMtbl argsMtbl,
            string itemStr)
        {
            bool isSingleInstance = true;

            if (!string.IsNullOrWhiteSpace(itemStr))
            {
                if (!bool.TryParse(itemStr, out isSingleInstance))
                {
                    isSingleInstance = false;
                }
            }

            argsMtbl.IsSingleInstance = isSingleInstance;
        }
Example #3
0
        private void ParseItem(
            ProgramArgsMtbl argsMtbl,
            string itemStr,
            int idx)
        {
            switch (idx)
            {
            case 0:
                SetInitialDirPath(argsMtbl, itemStr);
                break;

            case 1:
                SetIsSingleInstance(argsMtbl, itemStr);
                break;
            }
        }
Example #4
0
        private void Parse(string[] args, ProgramArgsMtbl argsMtbl)
        {
            for (int i = 0; i < args.Length; i++)
            {
                ParseItem(
                    argsMtbl,
                    args[i],
                    i);
            }

            for (int i = args.Length; i < ARGS_COUNT; i++)
            {
                ParseItem(
                    argsMtbl,
                    null,
                    i);
            }
        }
Example #5
0
 private void SetInitialDirPath(
     ProgramArgsMtbl argsMtbl,
     string itemStr)
 {
     argsMtbl.InitialDirPath = itemStr ?? string.Empty;
 }