-
-
Notifications
You must be signed in to change notification settings - Fork 362
doc(ISocketDataPropertyConverter): add ISocketDataPropertyConverter documentation #6425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's GuideThis PR hardens the socket data property converters by adding data length guards before binary parsing, corrects an attribute reference in the converter base class comment, refines the demo menu entries, and provides comprehensive documentation examples for ISocketDataPropertyConverter usage. Class diagram for SocketDataProperty converters with data length guardclassDiagram
class ISocketDataPropertyConverter {
+object? Convert(ReadOnlyMemory<byte> data)
}
class SocketDataInt32BigEndianConverter {
+object? Convert(ReadOnlyMemory<byte> data)
}
class SocketDataInt32LittleEndianConverter {
+object? Convert(ReadOnlyMemory<byte> data)
}
class SocketDataInt64BigEndianConverter {
+object? Convert(ReadOnlyMemory<byte> data)
}
class SocketDataInt64LittleEndianConverter {
+object? Convert(ReadOnlyMemory<byte> data)
}
class SocketDataDoubleBigEndianConverter {
+object? Convert(ReadOnlyMemory<byte> data)
}
class SocketDataDoubleLittleEndianConverter {
+object? Convert(ReadOnlyMemory<byte> data)
}
class SocketDataInt16BigEndianConverter {
+object? Convert(ReadOnlyMemory<byte> data)
}
class SocketDataInt16LittleEndianConverter {
+object? Convert(ReadOnlyMemory<byte> data)
}
class SocketDataSingleBigEndianConverter {
+object? Convert(ReadOnlyMemory<byte> data)
}
class SocketDataSingleLittleEndianConverter {
+object? Convert(ReadOnlyMemory<byte> data)
}
class SocketDataUInt16BigEndianConverter {
+object? Convert(ReadOnlyMemory<byte> data)
}
class SocketDataUInt16LittleEndianConverter {
+object? Convert(ReadOnlyMemory<byte> data)
}
class SocketDataUInt32BigEndianConverter {
+object? Convert(ReadOnlyMemory<byte> data)
}
class SocketDataUInt32LittleEndianConverter {
+object? Convert(ReadOnlyMemory<byte> data)
}
class SocketDataUInt64BigEndianConverter {
+object? Convert(ReadOnlyMemory<byte> data)
}
class SocketDataUInt64LittleEndianConverter {
+object? Convert(ReadOnlyMemory<byte> data)
}
ISocketDataPropertyConverter <|.. SocketDataInt32BigEndianConverter
ISocketDataPropertyConverter <|.. SocketDataInt32LittleEndianConverter
ISocketDataPropertyConverter <|.. SocketDataInt64BigEndianConverter
ISocketDataPropertyConverter <|.. SocketDataInt64LittleEndianConverter
ISocketDataPropertyConverter <|.. SocketDataDoubleBigEndianConverter
ISocketDataPropertyConverter <|.. SocketDataDoubleLittleEndianConverter
ISocketDataPropertyConverter <|.. SocketDataInt16BigEndianConverter
ISocketDataPropertyConverter <|.. SocketDataInt16LittleEndianConverter
ISocketDataPropertyConverter <|.. SocketDataSingleBigEndianConverter
ISocketDataPropertyConverter <|.. SocketDataSingleLittleEndianConverter
ISocketDataPropertyConverter <|.. SocketDataUInt16BigEndianConverter
ISocketDataPropertyConverter <|.. SocketDataUInt16LittleEndianConverter
ISocketDataPropertyConverter <|.. SocketDataUInt32BigEndianConverter
ISocketDataPropertyConverter <|.. SocketDataUInt32LittleEndianConverter
ISocketDataPropertyConverter <|.. SocketDataUInt64BigEndianConverter
ISocketDataPropertyConverter <|.. SocketDataUInt64LittleEndianConverter
Class diagram for SocketDataConverterBase and attribute usageclassDiagram
class SocketDataConverterBase~TEntity~ {
+bool TryConvertTo(ReadOnlyMemory<byte> data, out TEntity? entity)
#bool Parse(ReadOnlyMemory<byte> data, TEntity entity)
}
class SocketDataConverterAttribute {
+Type Type
}
class SocketDataPropertyAttribute {
+Type Type
+int Offset
+int Length
+string EncodingName
+Type ConverterType
+object[] ConverterParameters
+object? ConvertTo(ReadOnlyMemory<byte> data)
}
SocketDataConverterBase~TEntity~ <.. SocketDataConverterAttribute : uses
SocketDataPropertyAttribute <.. SocketDataConverterBase~TEntity~ : used for property parsing
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ArgoZhang - I've reviewed your changes - here's some feedback:
- The paddedSpan and TryRead… logic is duplicated across all converters; consider extracting it into a shared helper or base implementation to reduce boilerplate.
- I don’t see localization entries for DataEntityTitle, DataEntityDescription, etc., in the en-US.json/zh-CN.json files—please add those keys so the sample page renders correctly.
- Currently inputs longer than the expected length silently return the default value; it may be helpful to log or throw an error in those cases to avoid hidden data truncation issues.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The paddedSpan and TryRead… logic is duplicated across all converters; consider extracting it into a shared helper or base implementation to reduce boilerplate.
- I don’t see localization entries for DataEntityTitle, DataEntityDescription, etc., in the en-US.json/zh-CN.json files—please add those keys so the sample page renders correctly.
- Currently inputs longer than the expected length silently return the default value; it may be helpful to log or throw an error in those cases to avoid hidden data truncation issues.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6425 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 746 746
Lines 32177 32225 +48
Branches 4538 4554 +16
=========================================
+ Hits 32177 32225 +48
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Link issues
fixes #6424
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Add comprehensive documentation and sample for ISocketDataPropertyConverter, update related menu entries, and enhance converters with data length validation before parsing.
Enhancements:
Documentation: