Пример #1
0
        public static com.wd.free.para.exp.UnitPara[] Parse(string fields)
        {
            List <com.wd.free.para.exp.UnitPara> list = new List <com.wd.free.para.exp.UnitPara>();

            if (!StringUtil.IsNullOrEmpty(fields))
            {
                foreach (string f in Split(fields, 5))
                {
                    string   temp = f.Trim();
                    string[] vs   = Split(temp, 4);
                    com.wd.free.para.exp.UnitPara fp = new com.wd.free.para.exp.UnitPara();
                    if (vs.Length == 2)
                    {
                        fp.unit = vs[0].Trim();
                        fp.para = vs[1].Trim();
                    }
                    else
                    {
                        if (vs.Length == 1)
                        {
                            fp.unit = BaseEventArgs.DEFAULT;
                            fp.para = vs[0].Trim();
                        }
                    }
                    list.Add(fp);
                }
            }
            return(list.ToArray());
        }
Пример #2
0
 public static com.wd.free.para.exp.UnitPara ParseOne(string exp)
 {
     string[] vs = Split(exp, 4);
     com.wd.free.para.exp.UnitPara fp = new com.wd.free.para.exp.UnitPara();
     if (vs.Length == 2)
     {
         fp.unit = vs[0].Trim();
         fp.para = vs[1].Trim();
         if (fp.unit.Equals("0"))
         {
             fp.unit = string.Empty;
             fp.para = exp.Trim();
         }
     }
     else
     {
         if (vs.Length == 1)
         {
             fp.unit = BaseEventArgs.DEFAULT;
             fp.para = vs[0].Trim();
         }
         else
         {
             if (vs.Length == 3)
             {
                 fp.unit = vs[0].Trim();
                 fp.para = vs[1].Trim() + "." + vs[2].Trim();
             }
         }
     }
     return(fp);
 }