コード例 #1
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);
 }
コード例 #2
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));
        }
コード例 #3
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());
        }