-
Notifications
You must be signed in to change notification settings - Fork 246
JAN-13 barcode doesn't automatically calculate checksum when not provided #197
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,12 +6,16 @@ namespace BarcodeLib.Symbologies | |
| /// JAN-13 encoding | ||
| /// Written by: Brad Barnhill | ||
| /// </summary> | ||
| class JAN13 : BarcodeCommon, IBarcode | ||
| internal class JAN13 : BarcodeCommon, IBarcode | ||
| { | ||
| private readonly EAN13 _ean13; | ||
|
|
||
| public JAN13(string input) | ||
| { | ||
| RawData = input; | ||
| _ean13 = new EAN13(input); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. instead of initing an EAN13 here wouldnt it be better to expose the check digit method there and call the check digit here in the constructor OR make a copy of the CheckDigit() method in JAN so we get proper error codes here and just calculate it here. This way the init doesnt have to happen which runs the encoding and such till after the data validation is done? |
||
| RawData = _ean13.RawData; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Encode the raw data using the JAN-13 algorithm. | ||
| /// </summary> | ||
|
|
@@ -21,14 +25,13 @@ private string Encode_JAN13() | |
| if (!CheckNumericOnly(RawData)) | ||
| Error("EJAN13-2: Numeric Data Only"); | ||
|
|
||
| EAN13 ean13 = new EAN13(RawData); | ||
| return ean13.Encoded_Value; | ||
| return _ean13.Encoded_Value; | ||
| }//Encode_JAN13 | ||
|
|
||
| #region IBarcode Members | ||
|
|
||
| public string Encoded_Value => Encode_JAN13(); | ||
|
|
||
| #endregion | ||
| #endregion IBarcode Members | ||
| } | ||
| } | ||
| } | ||
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.
if we mark this symbology as internal shouldnt we mark the others as well?
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.
There’s no reason to mark a class in the global scope internal. That is the default visibility. I’d argue to remove
internalhere instead of adding it.