public static void UnpackFromFlex(FlexEvent mainFlex, ref CSVTableParser inittbl, ref List<CSVTableParser> tables, ref string name) { inittbl.Rows = new List<Row>(); for (int i = 0; i < tables.Count; i++) tables[i].Rows = new List<Row>(); try { var inittblFlex = (FlexEvent) mainFlex.Arguments[InitTblFlexName]; name = mainFlex.Operation.Split('.').Last(); foreach (var initTblPath in inittblFlex.Arguments) { var tbIndex = Int32.Parse(initTblPath.Key); var tbName = (string) initTblPath.Value; var tableFlex = (FlexEvent) mainFlex.Arguments[tbName]; var inittblRow = new Row(); inittblRow.Cell.Add(inittbl.Description[0].ColumnName, tbIndex); inittblRow.Cell.Add(inittbl.Description[1].ColumnName, tbName); inittbl.Rows.Add(inittblRow); foreach (var trfObj in tableFlex.Arguments) { var tableRowFlex = (FlexEvent) trfObj.Value; var tableRow = new Row(); foreach (var columnPath in tables[tbIndex].Description) tableRow.Cell.Add(columnPath.ColumnName, tableRowFlex.Arguments[columnPath.ColumnName]); tables[tbIndex].Rows.Add(tableRow); } } } catch (Exception e) { InstantLogger.err("CSVTP_FlexEventConverter.UnpackFromFlex:\n{0}", e.ToString()); } }
//private Row m_row = new Row(); public Row ColumnCreator() { var row = new Row(); foreach (ColumnPath columnPath in Description) { if (!row.Cell.ContainsKey(columnPath.ColumnName)) { //m_row.Cell.Add(columnPath.ColumnName, Activator.CreateInstance(columnPath.ColumnType)); if (columnPath.ColumnType == typeof (int)) row.Cell.Add(columnPath.ColumnName, 0); if (columnPath.ColumnType == typeof (double)) row.Cell.Add(columnPath.ColumnName, 0.0); if (columnPath.ColumnType == typeof (string)) row.Cell.Add(columnPath.ColumnName, ""); } } return row; }