diff --git a/server/src/Controllers/DebuggerController.cs b/server/src/Controllers/DebuggerController.cs index 0c3507f..916c500 100644 --- a/server/src/Controllers/DebuggerController.cs +++ b/server/src/Controllers/DebuggerController.cs @@ -406,13 +406,15 @@ public class DebuggerController : ControllerBase return StatusCode(StatusCodes.Status500InternalServerError, "数据越界"); } var sampleBytes = rawData[sampleOffset..(sampleOffset + 4)]; - UInt32 sample = BitConverter.ToUInt32(Common.Number.ReverseBytes(sampleBytes, 4).Value, 0); + UInt32 sample = Common.Number.BytesToUInt32(sampleBytes, true).Value; // 提取wireWidth位 UInt32 mask = (wireWidth == 32) ? 0xFFFFFFFF : ((1u << wireWidth) - 1u); channelUintArr[i] = (sample >> wireStart) & mask; } - logger.Debug($"{channel.name} HexData: {BitConverter.ToString(channelUintArr.SelectMany(BitConverter.GetBytes).ToArray())}"); - var base64 = Convert.ToBase64String(channelUintArr.SelectMany(BitConverter.GetBytes).ToArray()); + var channelBytes = new byte[4 * depth]; + Buffer.BlockCopy(channelUintArr, 0, channelBytes, 0, channelBytes.Length); + logger.Debug($"{channel.name} HexData: {BitConverter.ToString(channelBytes)}"); + var base64 = Convert.ToBase64String(channelBytes); channelDataList.Add(new ChannelCaptureData { name = channel.name, data = base64 }); }