Exemplo n.º 1
0
        private void ParseParameter(string typeAndName, int index)
        {
            string[] split = typeAndName.Split(CSVConstant.STRUCT_DELIMITER);
            string   paramTypeName = "", paramFieldName = "";

            foreach (string item in split)
            {
                var correctedItem = Helper.CorrectHeadItemString(item);
                if (correctedItem == "")
                {
                    continue;
                }
                if (paramTypeName == "")
                {
                    paramTypeName = correctedItem;
                }
                else
                {
                    paramFieldName = Helper.GetValidScriptVariableName(correctedItem, true);
                }
            }

            if (paramTypeName == "")
            {
                throw new CSVParseException("Error type def when parsing struct: " + TypeName + ", type: " + typeAndName);
            }

            if (paramFieldName == "")
            {
                paramFieldName = "member_" + index.ToString();
            }

            var dataType = DataTypeFactory.GetBaseDataType(paramTypeName);

            parameterDataTypes.Add(dataType);
            parameterNames.Add(paramFieldName);
        }