private static OOFormArray DataTable2OOFormArray(DataTable dt) { OOFormArray form = new OOFormArray(); // csv = ""; form = InitForm(dt); int colNum = dt.Columns.Count; int rowNum = dt.Rows.Count; for (int r = 0; r < rowNum; r++) { var dr = dt.Rows[r]; for (int c = 0; c < colNum; c++) { string cName = dt.Columns[c].ColumnName; int row = r + 1; int col = c; System.Type tp = dt.Columns[c].DataType; //print(tp); if (tp == typeof(int)) { int val = (int)dr[c]; bool bSet = form.SetInt(val, col, row); // print("Set Int:" + val.ToString() + " OK?" + bSet.ToString()); } else if (tp == typeof(Vector2)) { Vector2 val = (Vector2)dr[c]; bool bSet = form.SetVector2(val, col, row); //print("Set Vec2:" + val.ToString() + " OK?" + bSet.ToString()); } else if (tp == typeof(Vector3)) { Vector3 val = (Vector3)dr[c]; bool bSet = form.SetVector3(val, col, row); //print("Set Vec3:" + val.ToString() + " OK?" + bSet.ToString()); } else if (tp == typeof(Vector4)) { Vector4 val = (Vector4)dr[c]; bool bSet = form.SetVector4(val, col, row); //print("Set Vec4:" + val.ToString() + " OK?" + bSet.ToString()); } else if (tp == typeof(string)) { string val = (string)dr[c]; bool bSet = form.SetString(val, col, row); //print("Set String:" + val + " OK?" + bSet.ToString()); } else if (tp == typeof(float)) { float val = (float)dr[c]; bool bSet = form.SetFloat(val, col, row); // print("Set Float:" + val + " OK?" + bSet.ToString()); } else if (tp == typeof(Rect)) { Rect val = (Rect)dr[c]; bool bSet = form.SetRect(val, col, row); // print("Set Rect:" + val + " OK?" + bSet.ToString()); } else if (tp == typeof(bool)) { bool val = (bool)dr[c]; bool bSet = form.SetBool(val, col, row); //print("Set Bool:" + val + " OK?" + bSet.ToString()); } else { int val = (int)dr[c]; bool bSet = form.SetInt(val, col, row); } } } return(form); }