private IColumnInfo GetColumnInfo(FrameReader reader, ColumnTypeCode code) { ColumnTypeCode innercode; switch (code) { case ColumnTypeCode.List: innercode = (ColumnTypeCode)reader.ReadUInt16(); return(new ListColumnInfo { ValueTypeCode = innercode, ValueTypeInfo = GetColumnInfo(reader, innercode) }); case ColumnTypeCode.Map: innercode = (ColumnTypeCode)reader.ReadUInt16(); IColumnInfo kci = GetColumnInfo(reader, innercode); var vinnercode = (ColumnTypeCode)reader.ReadUInt16(); IColumnInfo vci = GetColumnInfo(reader, vinnercode); return(new MapColumnInfo { KeyTypeCode = innercode, KeyTypeInfo = kci, ValueTypeCode = vinnercode, ValueTypeInfo = vci }); case ColumnTypeCode.Set: innercode = (ColumnTypeCode)reader.ReadUInt16(); return(new SetColumnInfo { KeyTypeCode = innercode, KeyTypeInfo = GetColumnInfo(reader, innercode) }); case ColumnTypeCode.Custom: return(new CustomColumnInfo { CustomTypeName = reader.ReadString() }); case ColumnTypeCode.Udt: var udtInfo = new UdtColumnInfo(reader.ReadString() + "." + reader.ReadString()); var fieldLength = reader.ReadInt16(); for (var i = 0; i < fieldLength; i++) { var dataType = new ColumnDesc { Name = reader.ReadString(), TypeCode = (ColumnTypeCode)reader.ReadUInt16(), }; dataType.TypeInfo = GetColumnInfo(reader, dataType.TypeCode); udtInfo.Fields.Add(dataType); } return(udtInfo); case ColumnTypeCode.Tuple: { var tupleInfo = new TupleColumnInfo(); var elementLength = reader.ReadInt16(); for (var i = 0; i < elementLength; i++) { var dataType = new ColumnDesc { TypeCode = (ColumnTypeCode)reader.ReadUInt16(), }; dataType.TypeInfo = GetColumnInfo(reader, dataType.TypeCode); tupleInfo.Elements.Add(dataType); } return(tupleInfo); } default: return(null); } }
private IColumnInfo GetColumnInfo(BEBinaryReader reader, ColumnTypeCode code) { ColumnTypeCode innercode; switch (code) { case ColumnTypeCode.List: innercode = (ColumnTypeCode) reader.ReadUInt16(); return new ListColumnInfo { ValueTypeCode = innercode, ValueTypeInfo = GetColumnInfo(reader, innercode) }; case ColumnTypeCode.Map: innercode = (ColumnTypeCode) reader.ReadUInt16(); IColumnInfo kci = GetColumnInfo(reader, innercode); var vinnercode = (ColumnTypeCode) reader.ReadUInt16(); IColumnInfo vci = GetColumnInfo(reader, vinnercode); return new MapColumnInfo { KeyTypeCode = innercode, KeyTypeInfo = kci, ValueTypeCode = vinnercode, ValueTypeInfo = vci }; case ColumnTypeCode.Set: innercode = (ColumnTypeCode) reader.ReadUInt16(); return new SetColumnInfo { KeyTypeCode = innercode, KeyTypeInfo = GetColumnInfo(reader, innercode) }; case ColumnTypeCode.Custom: return new CustomColumnInfo { CustomTypeName = reader.ReadString() }; case ColumnTypeCode.Udt: var udtInfo = new UdtColumnInfo(reader.ReadString() + "." + reader.ReadString()); var fieldLength = reader.ReadInt16(); for (var i = 0; i < fieldLength; i++) { var dataType = new ColumnDesc { Name = reader.ReadString(), TypeCode = (ColumnTypeCode) reader.ReadUInt16(), }; dataType.TypeInfo = GetColumnInfo(reader, dataType.TypeCode); udtInfo.Fields.Add(dataType); } return udtInfo; case ColumnTypeCode.Tuple: { var tupleInfo = new TupleColumnInfo(); var elementLength = reader.ReadInt16(); for (var i = 0; i < elementLength; i++) { var dataType = new ColumnDesc { TypeCode = (ColumnTypeCode) reader.ReadUInt16(), }; dataType.TypeInfo = GetColumnInfo(reader, dataType.TypeCode); tupleInfo.Elements.Add(dataType); } return tupleInfo; } default: return null; } }