private void ProcessVariable(string fieldName, string typeInfo) { fieldName = Helper.CorrectHeadItemString(fieldName); string variableName = Helper.GetValidScriptVariableName(fieldName, true); if (variableName.Contains(CSVConstant.IDENTIFIER_OMIT_COLUMN)) { return; } IDataType dataType = dataTypeFactory.GetDataType(typeInfo, fieldName); classWriter.ProcessVariable(fieldName, variableName, dataType); }
/// <summary> /// Given a string element in the csv and target type /// Deserialize it into an object of the target type /// </summary> /// <param name="item"></param> /// <param name="typeInfo"></param> /// <param name="expectedItemType"></param> /// <returns></returns> public object DeserializeItem(string item, string typeInfo, string csvFieldName, Type expectedItemType, Type dataEntryType) { IDataType dataType = dataTypeFactory.GetDataType(typeInfo, csvFieldName); dataType.deserializeExtraInfo = new DataTypeDeserializeExtraInfo(csvFieldName, dataEntryType); try { return(dataType.Deserialize(Helper.CorrectDataItemString(item), expectedItemType)); } catch (CSVParseException e) { throw new CSVParseException(e.ToString(), currentRow, currentColumn); } catch (Exception e) { throw new CSVParseException("Unknown exception: " + e.ToString(), currentRow, currentColumn); } }