LumiSoft.Net._ParamParser.Paramparser_NameValue C# (CSharp) Method

Paramparser_NameValue() public static method

Parses name-value params.
public static Paramparser_NameValue ( string source, string expressions ) : LumiSoft.Net._Parameter[]
source string Parse source.
expressions string Expressions importance order. NOTE: must contain param and value groups.
return LumiSoft.Net._Parameter[]
        public static _Parameter[] Paramparser_NameValue(string source,string[] expressions)
        {
            string tmp = source.Trim();
            ArrayList param = new ArrayList();
            foreach(string exp in expressions){
                Regex r = new Regex(exp,RegexOptions.IgnoreCase);
                Match m = r.Match(tmp);
                if(m.Success){
                    param.Add(new _Parameter(m.Result("${param}").Trim(),m.Result("${value}")));

                    // remove matched string part form tmp
                    tmp = tmp.Replace(m.ToString(),"").Trim();
                }
            }

            // There are some unparsed params, add them as UnParsed
            if(tmp.Trim().Length > 0){
                param.Add(new _Parameter("UNPARSED",tmp));
            }

            _Parameter[] retVal = new _Parameter[param.Count];
            param.CopyTo(retVal);

            return retVal;
        }