예제 #1
0
            public override IData Parse(string excelString)
            {
                var splitter = Define.ARRAY_SPLITTER[ArrayLevel];

                string[] result = excelString.Split(splitter);
                if (FixedLength > 0)
                {
                    if (result.Length != FixedLength)
                    {
                        throw new Exception($"数组长度不符合定义的长度:{FixedLength}");
                    }
                }

                ArrayData arrayData;

                //basetype是pooled的,本层不写入pool
                //if (BaseType is IPooledColumnType)
                //{
                //    arrayData = new ArrayData(this);
                //}
                //else
                {
                    arrayData = new PooledArrayData(this);
                }
                foreach (var r in result)
                {
                    arrayData.Add(BaseType.Parse(r));
                }
                return(arrayData);
            }
예제 #2
0
 public override IData Parse(string excelString)
 {
     if (excelString == "")
     {
         PooledArrayData arrayData = new PooledArrayData(this);
         for (int i = 0; i < Fields.Count; i++)
         {
             var data = Fields[i].Key.Parse(Fields[i].Key.DefaultValue);
             arrayData.Add(data);
         }
         return(arrayData);
     }
     else
     {
         var      splitter = Define.ARRAY_SPLITTER[ArrayLevel];
         string[] result   = excelString.Split(splitter);
         if (result.Length != Fields.Count)
         {
             throw new Exception("参数数量和类型不符");
         }
         PooledArrayData arrayData = new PooledArrayData(this);
         for (int i = 0; i < result.Length; i++)
         {
             var data = Fields[i].Key.Parse(result[i]);
             arrayData.Add(data);
         }
         return(arrayData);
     }
 }