private static bool GenerateVariableTypeAndNameList(string[] csvRow, ref List <CsvGridData> variableTypeList, ref List <CsvGridData> variableNameList, ref bool findVariableType, ref bool findVariableName) { ECsvTableRowType rowType = GetTableRowType(csvRow[0], ref findVariableType, ref findVariableName); if (rowType == ECsvTableRowType.BlankRow || rowType == ECsvTableRowType.Comment || rowType == ECsvTableRowType.MaxType) { return(false); } for (int col = 0; col < csvRow.Length; col++) { if (rowType == ECsvTableRowType.VariableType) { string type = CsvDataParser.RemoveStringBlankChar(csvRow[col]); if (string.IsNullOrEmpty(type)) { continue; } CsvGridData data = new CsvGridData(col, type, rowType); variableTypeList.Add(data); } if (rowType == ECsvTableRowType.VariableName) { string type = CsvDataParser.RemoveStringBlankChar(csvRow[col]); if (string.IsNullOrEmpty(type)) { continue; } CsvGridData data = new CsvGridData(col, type, rowType); variableNameList.Add(data); } } return(findVariableType && findVariableName); }
private static Dictionary <string, CsvVariableData> GenerateVariableNameToGridDataMap(List <CsvGridData> variableNameList, List <CsvGridData> variableTypeList) { Dictionary <string, CsvVariableData> map = new Dictionary <string, CsvVariableData>(); for (int i = 0; i < variableNameList.Count; i++) { CsvGridData variableNameData = variableNameList[i]; CsvGridData variableTypeData = variableTypeList[i]; if (!map.ContainsKey(variableNameData.content)) { CsvVariableData data = new CsvVariableData(variableNameData.content, variableTypeData.content); data.PushCol(variableNameData.col); map.Add(variableNameData.content, data); } else { CsvVariableData data = map[variableNameData.content]; data.PushCol(variableNameData.col); } } return(map); }