Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>9.0.11</Version>
<Version>9.0.14</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Website: https://www.blazor.zone or https://argozhang.github.io/

using BootstrapBlazor.Socket.Logging;
using System.Diagnostics;
using System.Reflection;

namespace BootstrapBlazor.Socket.DataConverters;
Expand Down Expand Up @@ -65,6 +66,10 @@ protected virtual bool Parse(ReadOnlyMemory<byte> data, TEntity entity)
{
// 通过 SocketDataPropertyConverterAttribute 特性获取属性转换器
var properties = entity.GetType().GetProperties().Where(p => p.CanWrite).ToList();
if (Debugger.IsAttached)
{
SocketLogging.LogDebug($"Data: {BitConverter.ToString(data.ToArray())}");
}
foreach (var p in properties)
{
var attr = p.GetCustomAttribute<DataPropertyConverterAttribute>(false) ?? GetPropertyConverterAttribute(p);
Expand All @@ -78,7 +83,7 @@ protected virtual bool Parse(ReadOnlyMemory<byte> data, TEntity entity)
}
else
{
SocketLogging.LogInformation($"{nameof(Parse)} failed. Can't convert value from {GetValueType(valueType)} to {p.PropertyType}");
SocketLogging.LogInformation($"{nameof(Parse)} failed. Start: {attr.Offset}. Length: {attr.Length}. Can't convert value from {GetValueType(valueType)} to {p.Name}({p.PropertyType})");
}
}
}
Expand Down