private Object ConvertKeyValue(Key key, out int length) { string keyStr = key.ToByteArray().ToHex(); byte[] keyValue = RH.GetT <byte[]>(keyStr); length = keyValue.Length; ProtobufSerializer ps = new ProtobufSerializer(); string keyType = key.Type; Object returnObj = new Object(); switch (keyType) { case "UInt64Value": returnObj = ps.Deserialize <UInt64Value>(keyValue); break; case "Hash": returnObj = ps.Deserialize <Hash>(keyValue); break; case "BlockBody": returnObj = ps.Deserialize <BlockBody>(keyValue); break; case "BlockHeader": returnObj = ps.Deserialize <BlockHeader>(keyValue); break; case "Chain": returnObj = ps.Deserialize <Chain>(keyValue); break; case "Change": break; case "SmartContractRegistration": returnObj = ps.Deserialize <SmartContractRegistration>(keyValue); break; case "TransactionResult": returnObj = ps.Deserialize <TransactionResult>(keyValue); break; case "Transaction": returnObj = ps.Deserialize <Transaction>(keyValue); break; case "FunctionMetadata": returnObj = ps.Deserialize <FunctionMetadata>(keyValue); break; case "SerializedCallGraph": returnObj = ps.Deserialize <SerializedCallGraph>(keyValue); break; case "WorldState": returnObj = ps.Deserialize <WorldState>(keyValue); break; case "Miners": returnObj = ps.Deserialize <Miners>(keyValue); break; case "BlockProducer": returnObj = ps.Deserialize <BlockProducer>(keyValue); break; case "Round": returnObj = ps.Deserialize <Round>(keyValue); break; case "AElfDPoSInformation": returnObj = ps.Deserialize <AElfDPoSInformation>(keyValue); break; case "Int32Value": returnObj = ps.Deserialize <Int32Value>(keyValue); break; case "StringValue": returnObj = ps.Deserialize <StringValue>(keyValue); break; case "Timestamp": returnObj = ps.Deserialize <Timestamp>(keyValue); break; case "SInt32Value": returnObj = ps.Deserialize <SInt32Value>(keyValue); break; default: break; } return(returnObj); }