public override void WriteReaders(StringBuilder sb) { if (_cols[ColumnId].IsBoolType) { sb.AppendLine($"#warning generator error: the definition for this field ({FieldName}) has an invalid type for a LazyRow"); return; } var type = SpaghettiGenerator.ExcelTypeToManaged(_cols[ColumnId].Type); sb.AppendLine($"{FieldName} = new LazyRow< {TypeName} >( gameData, parser.ReadColumn< {type} >( {ColumnId} ), language );"); }
public override void WriteReaders(StringBuilder sb) { // todo: this won't be the same column for each but assuming the types are the same and the repeat is correct, this will just work™ var type = SpaghettiGenerator.ExcelTypeToManaged(_cols[ColumnId].Type); if (_cols[ColumnId].IsBoolType) { sb.AppendLine($"#warning generator error: the definition for this repeat ({FieldName}) has an invalid type for a LazyRow"); return; } sb.AppendLine($"{FieldName} = new LazyRow< {TypeName} >[ {Count} ];"); sb.AppendLine($"for( var i = 0; i < {Count}; i++ )"); sb.AppendLine($" {FieldName}[ i ] = new LazyRow< {TypeName} >( gameData, parser.ReadColumn< {type} >( {ColumnId} + i ), language );"); }
public override void WriteStructs(StringBuilder sb) { sb.AppendLine($"public struct {TypeName}"); sb.AppendLine("{"); for (var i = 0; i < _members.Count; i++) { var member = _members[i]; // todo: see todo in writereaders var col = _columns[ColumnId + i]; var type = SpaghettiGenerator.ExcelTypeToManaged(col.Type); sb.AppendLine($" public {type} {SpaghettiGenerator.Clean( member.Name )};"); } sb.AppendLine("}"); }
public override void WriteReaders(StringBuilder sb) { sb.AppendLine($"{FieldName} = new {TypeName}[ {_count} ];"); sb.AppendLine($"for( var i = 0; i < {_count}; i++ )"); sb.AppendLine("{"); sb.AppendLine($" {FieldName}[ i ] = new {TypeName}();"); for (var i = 0; i < _members.Count; i++) { var member = _members[i]; // this will actually return the wrong column, but if the groups are correct that won't be an issue // todo: ^ still f****d up though var col = _columns[ColumnId + i]; var type = SpaghettiGenerator.ExcelTypeToManaged(col.Type); sb.AppendLine($" {FieldName}[ i ].{SpaghettiGenerator.Clean( member.Name )} = parser.ReadColumn< {type} >( {ColumnId} + ( i * {_members.Count} + {i} ) );"); } sb.AppendLine("}"); }