-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Rename AlphanumericEncoder.CanEncode #675
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
📝 WalkthroughWalkthroughReplaced AlphanumericEncoder.CanEncode with AlphanumericEncoder.CanEncodeNonDigit in QRCodeGenerator.GetEncodingFromPlaintext, adjusting the alphanumeric detection for non-digit characters. Renamed the public method in AlphanumericEncoder and updated its XML docs. The logic remains unchanged aside from the method name and its use in encoding mode selection. Changes
Sequence Diagram(s)sequenceDiagram
actor Caller
participant Gen as QRCodeGenerator
participant Alpha as AlphanumericEncoder
Caller->>Gen: GetEncodingFromPlaintext(plaintext)
activate Gen
Gen->>Gen: Scan characters
alt Digit-only branch
Gen->>Gen: Select Numeric
else Alphanumeric branch
Gen->>Alpha: CanEncodeNonDigit(c)
Alpha-->>Gen: bool
Gen->>Gen: Select Alphanumeric if all pass
else Fallback
Gen->>Gen: Select Byte
end
Gen-->>Caller: EncodingMode
deactivate Gen
note right of Gen: Change: uses CanEncodeNonDigit for non-digit checks
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧬 Code graph analysis (2)QRCoder/QRCodeGenerator.cs (1)
QRCoder/QRCodeGenerator/AlphanumericEncoder.cs (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| /// Checks if a non-digit character is present in the alphanumeric encoding table. | ||
| /// </summary> | ||
| public static bool CanEncode(char c) => IsInRange(c, 'A', 'Z') || Array.IndexOf(_alphanumEncTable, c) >= 0; | ||
| public static bool CanEncodeNonDigit(char c) => IsInRange(c, 'A', 'Z') || Array.IndexOf(_alphanumEncTable, c) >= 0; |
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.
IsInRange(c, '0', '9') is purposely omitted because it is not required by the caller. So I'm renaming the function to be more appropriately named.
No description provided.