示例#1
0
        public static TestValue FromRecord(string v)
        {
            TestValue tv = new TestValue();

            string[] rs = StringUtil.Split(v, StringUtil.SPLITER_RECORD);

            foreach (string r in rs)
            {
                string[] fs = r.Split(':');
                if (fs.Length == 3)
                {
                    tv.AddField(fs[0], tv.GetValue(int.Parse(fs[1]), fs[2]));
                }
            }

            return(tv);
        }
示例#2
0
        public static TestValue[] RecordsFromString(string v)
        {
            List <TestValue> list = new List <TestValue>();

            string[] tvs = StringUtil.Split(v, StringUtil.SPLITER_RECORD);

            foreach (string t in tvs)
            {
                string[]  rs = StringUtil.Split(t, StringUtil.SPLITER_FIELD);
                TestValue tv = new TestValue();
                foreach (string r in rs)
                {
                    string[] fs = r.Split(':');
                    if (fs.Length == 3)
                    {
                        tv.AddField(fs[0], tv.GetValue(int.Parse(fs[1]), fs[2]));
                    }
                }

                list.Add(tv);
            }

            return(list.ToArray());
        }