示例#1
0
        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("}");
        }
示例#2
0
        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("}");
        }