コード例 #1
0
        public static string create(string name, string[] cmd, string[] arg)
        {
            string newCmd = name;

            for (int i = 0; i < cmd.Length; ++i)
            {
                //   newCmd += (partsSep + cmd[i] + cmdMark + arg[i]);
                newCmd += (partsSep + ArguemntItem.format(new ArguemntItem(cmd[i], arg[i])));
            }

            return(newCmd);
        }
コード例 #2
0
 public static string getArgValue(string pCmdLine, string pCmdArgName, string pDef)
 {
     string[] args = ToolString.explodeList(partsSep, pCmdLine);
     foreach (string arg in args)
     {
         ArguemntItem item_ = ArguemntItem.parse(arg);
         if (item_.name.ToLowerInvariant() == pCmdArgName.ToLowerInvariant())
         {
             return(item_.value);
         }
     }
     return(pDef);
 }
コード例 #3
0
        public static string setArgValue(string pCmdLine, string pCmdArgName, string pCmdArgValue)
        {
            string[] args = ToolString.explodeList(partsSep, pCmdLine);
            for (int i = 0; i < args.Length; ++i)
            {
                ArguemntItem item_ = ArguemntItem.parse(args[i]);
                if (item_.name.ToLowerInvariant() == pCmdArgName.ToLowerInvariant())
                {
                    args[i] = ArguemntItem.format(new ArguemntItem(pCmdArgName, pCmdArgValue));
                    return(ToolString.joinList(partsSep, args));
                }
            }

            return(addArgValue(pCmdLine, pCmdArgName, pCmdArgValue));
        }
コード例 #4
0
        public static ArguemntItem[] getArgs(string pCmdLine)
        {
            List <ArguemntItem> list_ = new List <ArguemntItem>();

            string[] args = ToolString.explodeList(partsSep, pCmdLine);
            foreach (string arg in args)
            {
                list_.Add(ArguemntItem.parse(arg));
            }

            if (list_.Count > 0)
            {
                list_.RemoveAt(0);
            }

            return(list_.ToArray());
        }
コード例 #5
0
            public static ArguemntItem parse(string pString)
            {
                ArguemntItem res_ = new ArguemntItem();

                pString = pString.Trim().Trim(argL, argR).Trim();

                //string[] arr_ = pString.Split(new string[] { cmdMark }, 2, StringSplitOptions.RemoveEmptyEntries);
                string[] arr_ = pString.Split(new string[] { cmdMark }, 2, StringSplitOptions.None);

                if (arr_.Length > 1)
                {
                    res_.name  = arr_[0];
                    res_.value = arr_[1];
                }
                else
                if (arr_.Length > 0)
                {
                    res_.value = arr_[0];
                }

                return(res_);
            }
コード例 #6
0
 public static string format(ArguemntItem pItem)
 {
     return(pItem.ToString());
 }
コード例 #7
0
 public static string addArgValue(string pCmdLine, string pCmdArgName, string pCmdArgValue)
 {
     return(pCmdLine + partsSep + ArguemntItem.format(new ArguemntItem(pCmdArgName, pCmdArgValue)));
 }